Mercurial > hg > xemacs-beta
comparison lisp/x-init.el @ 4482:e3ef34f57070
Bind function-key-map correctly in device-specific startup code.
2008-07-26 Aidan Kehoe <kehoea@parhasard.net>
* x-init.el (x-initialize-compose):
Rewrite to use #'loop, as does similar code in x-win-sun.el,
x-win-xfree86.el. Locally bind function-key-map to the correct
value for the device's console.
* x-win-xfree86.el (x-win-init-xfree86):
Locally bind function-key-map to the correct value for the
device's console.
* x-win-sun.el (x-win-init-sun):
Locally bind function-key-map to the correct value for the
device's console.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sat, 26 Jul 2008 09:37:08 +0200 |
parents | e34711681f30 |
children | b75b075a9041 |
comparison
equal
deleted
inserted
replaced
4481:f9c70d94f427 | 4482:e3ef34f57070 |
---|---|
82 (ow-find t)) | 82 (ow-find t)) |
83 | 83 |
84 ;; Load X-server specific code. | 84 ;; Load X-server specific code. |
85 ;; Specifically, load some code to repair the grievous damage that MIT and | 85 ;; Specifically, load some code to repair the grievous damage that MIT and |
86 ;; Sun have done to the default keymap for the Sun keyboards. | 86 ;; Sun have done to the default keymap for the Sun keyboards. |
87 | |
88 (eval-when-compile | |
89 (defmacro x-define-dead-key (key map device) | |
90 `(when (x-keysym-on-keyboard-p ',key device) | |
91 (define-key function-key-map [,key] ',map)))) | |
92 | |
93 (defun x-initialize-compose (device) | 87 (defun x-initialize-compose (device) |
94 "Enable compose key and dead key processing on DEVICE." | 88 "Enable compose key and dead key processing on DEVICE." |
95 (autoload 'compose-map "x-compose" nil t 'keymap) | 89 (autoload 'compose-map "x-compose" nil t 'keymap) |
96 (autoload 'compose-acute-map "x-compose" nil t 'keymap) | 90 (autoload 'compose-acute-map "x-compose" nil t 'keymap) |
97 (autoload 'compose-grave-map "x-compose" nil t 'keymap) | 91 (autoload 'compose-grave-map "x-compose" nil t 'keymap) |
98 (autoload 'compose-cedilla-map "x-compose" nil t 'keymap) | 92 (autoload 'compose-cedilla-map "x-compose" nil t 'keymap) |
99 (autoload 'compose-diaeresis-map "x-compose" nil t 'keymap) | 93 (autoload 'compose-diaeresis-map "x-compose" nil t 'keymap) |
100 (autoload 'compose-circumflex-map "x-compose" nil t 'keymap) | 94 (autoload 'compose-circumflex-map "x-compose" nil t 'keymap) |
101 (autoload 'compose-tilde-map "x-compose" nil t 'keymap) | 95 (autoload 'compose-tilde-map "x-compose" nil t 'keymap) |
102 | 96 |
103 (when (x-keysym-on-keyboard-p 'multi-key device) | 97 (loop |
104 (define-key function-key-map [multi-key] 'compose-map)) | 98 for (key map) |
105 | 99 ;; The dead keys might really be called just about anything, depending |
106 ;; The dead keys might really be called just about anything, depending | 100 ;; on the vendor. MIT thinks that the prefixes are "SunFA_", "D", and |
107 ;; on the vendor. MIT thinks that the prefixes are "SunFA_", "D", and | 101 ;; "hpmute_" for Sun, DEC, and HP respectively. However, OpenWindows 3 |
108 ;; "hpmute_" for Sun, DEC, and HP respectively. However, OpenWindows 3 | 102 ;; thinks that the prefixes are "SunXK_FA_", "DXK_", and "hpXK_mute_". |
109 ;; thinks that the prefixes are "SunXK_FA_", "DXK_", and "hpXK_mute_". | 103 ;; And HP (who don't mention Sun and DEC at all) use "XK_mute_". Go |
110 ;; And HP (who don't mention Sun and DEC at all) use "XK_mute_". | 104 ;; figure. |
111 ;; Go figure. | 105 |
112 | 106 ;; Presumably if someone is running OpenWindows, they won't be using the |
113 ;; Presumably if someone is running OpenWindows, they won't be using | 107 ;; DEC or HP keysyms, but if they are defined then that is possible, so |
114 ;; the DEC or HP keysyms, but if they are defined then that is possible, | 108 ;; in that case we accept them all. |
115 ;; so in that case we accept them all. | 109 |
116 | 110 ;; If things seem not to be working, you might want to check your |
117 ;; If things seem not to be working, you might want to check your | 111 ;; /usr/lib/X11/XKeysymDB file to see if your vendor has an equally |
118 ;; /usr/lib/X11/XKeysymDB file to see if your vendor has an equally | 112 ;; mixed up view of what these keys should be called. |
119 ;; mixed up view of what these keys should be called. | 113 |
120 | 114 ;; Canonical names: |
121 ;; Canonical names: | 115 in '((acute compose-acute-map) |
122 (x-define-dead-key acute compose-acute-map device) | 116 (grave compose-grave-map) |
123 (x-define-dead-key grave compose-grave-map device) | 117 (cedilla compose-cedilla-map) |
124 (x-define-dead-key cedilla compose-cedilla-map device) | 118 (diaeresis compose-diaeresis-map) |
125 (x-define-dead-key diaeresis compose-diaeresis-map device) | 119 (circumflex compose-circumflex-map) |
126 (x-define-dead-key circumflex compose-circumflex-map device) | 120 (tilde compose-tilde-map) |
127 (x-define-dead-key tilde compose-tilde-map device) | 121 (degree compose-ring-map) |
128 (x-define-dead-key degree compose-ring-map device) | 122 (multi-key compose-map) |
129 | 123 |
130 ;; Sun according to MIT: | 124 ;; Sun according to MIT: |
131 (x-define-dead-key SunFA_Acute compose-acute-map device) | 125 (SunFA_Acute compose-acute-map) |
132 (x-define-dead-key SunFA_Grave compose-grave-map device) | 126 (SunFA_Grave compose-grave-map) |
133 (x-define-dead-key SunFA_Cedilla compose-cedilla-map device) | 127 (SunFA_Cedilla compose-cedilla-map) |
134 (x-define-dead-key SunFA_Diaeresis compose-diaeresis-map device) | 128 (SunFA_Diaeresis compose-diaeresis-map) |
135 (x-define-dead-key SunFA_Circum compose-circumflex-map device) | 129 (SunFA_Circum compose-circumflex-map) |
136 (x-define-dead-key SunFA_Tilde compose-tilde-map device) | 130 (SunFA_Tilde compose-tilde-map) |
137 | 131 |
138 ;; Sun according to OpenWindows 2: | 132 ;; Sun according to OpenWindows 2: |
139 (x-define-dead-key Dead_Grave compose-grave-map device) | 133 (Dead_Grave compose-grave-map) |
140 (x-define-dead-key Dead_Circum compose-circumflex-map device) | 134 (Dead_Circum compose-circumflex-map) |
141 (x-define-dead-key Dead_Tilde compose-tilde-map device) | 135 (Dead_Tilde compose-tilde-map) |
142 | 136 |
143 ;; Sun according to OpenWindows 3: | 137 ;; Sun according to OpenWindows 3: |
144 (x-define-dead-key SunXK_FA_Acute compose-acute-map device) | 138 (SunXK_FA_Acute compose-acute-map) |
145 (x-define-dead-key SunXK_FA_Grave compose-grave-map device) | 139 (SunXK_FA_Grave compose-grave-map) |
146 (x-define-dead-key SunXK_FA_Cedilla compose-cedilla-map device) | 140 (SunXK_FA_Cedilla compose-cedilla-map) |
147 (x-define-dead-key SunXK_FA_Diaeresis compose-diaeresis-map device) | 141 (SunXK_FA_Diaeresis compose-diaeresis-map) |
148 (x-define-dead-key SunXK_FA_Circum compose-circumflex-map device) | 142 (SunXK_FA_Circum compose-circumflex-map) |
149 (x-define-dead-key SunXK_FA_Tilde compose-tilde-map device) | 143 (SunXK_FA_Tilde compose-tilde-map) |
150 | 144 |
151 ;; DEC according to MIT: | 145 ;; DEC according to MIT: |
152 (x-define-dead-key Dacute_accent compose-acute-map device) | 146 (Dacute_accent compose-acute-map) |
153 (x-define-dead-key Dgrave_accent compose-grave-map device) | 147 (Dgrave_accent compose-grave-map) |
154 (x-define-dead-key Dcedilla_accent compose-cedilla-map device) | 148 (Dcedilla_accent compose-cedilla-map) |
155 (x-define-dead-key Dcircumflex_accent compose-circumflex-map device) | 149 (Dcircumflex_accent compose-circumflex-map) |
156 (x-define-dead-key Dtilde compose-tilde-map device) | 150 (Dtilde compose-tilde-map) |
157 (x-define-dead-key Dring_accent compose-ring-map device) | 151 (Dring_accent compose-ring-map) |
158 | 152 |
159 ;; DEC according to OpenWindows 3: | 153 ;; DEC according to OpenWindows 3: |
160 (x-define-dead-key DXK_acute_accent compose-acute-map device) | 154 (DXK_acute_accent compose-acute-map) |
161 (x-define-dead-key DXK_grave_accent compose-grave-map device) | 155 (DXK_grave_accent compose-grave-map) |
162 (x-define-dead-key DXK_cedilla_accent compose-cedilla-map device) | 156 (DXK_cedilla_accent compose-cedilla-map) |
163 (x-define-dead-key DXK_circumflex_accent compose-circumflex-map device) | 157 (DXK_circumflex_accent compose-circumflex-map) |
164 (x-define-dead-key DXK_tilde compose-tilde-map device) | 158 (DXK_tilde compose-tilde-map) |
165 (x-define-dead-key DXK_ring_accent compose-ring-map device) | 159 (DXK_ring_accent compose-ring-map) |
166 | 160 |
167 ;; HP according to MIT: | 161 ;; HP according to MIT: |
168 (x-define-dead-key hpmute_acute compose-acute-map device) | 162 (hpmute_acute compose-acute-map) |
169 (x-define-dead-key hpmute_grave compose-grave-map device) | 163 (hpmute_grave compose-grave-map) |
170 (x-define-dead-key hpmute_diaeresis compose-diaeresis-map device) | 164 (hpmute_diaeresis compose-diaeresis-map) |
171 (x-define-dead-key hpmute_asciicircum compose-circumflex-map device) | 165 (hpmute_asciicircum compose-circumflex-map) |
172 (x-define-dead-key hpmute_asciitilde compose-tilde-map device) | 166 (hpmute_asciitilde compose-tilde-map) |
173 | 167 |
174 ;; Empirically discovered on Linux XFree86 MetroX: | 168 ;; Empirically discovered on Linux XFree86 MetroX: |
175 (x-define-dead-key usldead_acute compose-acute-map device) | 169 (usldead_acute compose-acute-map) |
176 (x-define-dead-key usldead_grave compose-grave-map device) | 170 (usldead_grave compose-grave-map) |
177 (x-define-dead-key usldead_diaeresis compose-diaeresis-map device) | 171 (usldead_diaeresis compose-diaeresis-map) |
178 (x-define-dead-key usldead_asciicircum compose-circumflex-map device) | 172 (usldead_asciicircum compose-circumflex-map) |
179 (x-define-dead-key usldead_asciitilde compose-tilde-map device) | 173 (usldead_asciitilde compose-tilde-map) |
180 | 174 |
181 ;; HP according to OpenWindows 3: | 175 ;; HP according to OpenWindows 3: |
182 (x-define-dead-key hpXK_mute_acute compose-acute-map device) | 176 (hpXK_mute_acute compose-acute-map) |
183 (x-define-dead-key hpXK_mute_grave compose-grave-map device) | 177 (hpXK_mute_grave compose-grave-map) |
184 (x-define-dead-key hpXK_mute_diaeresis compose-diaeresis-map device) | 178 (hpXK_mute_diaeresis compose-diaeresis-map) |
185 (x-define-dead-key hpXK_mute_asciicircum compose-circumflex-map device) | 179 (hpXK_mute_asciicircum compose-circumflex-map) |
186 (x-define-dead-key hpXK_mute_asciitilde compose-tilde-map device) | 180 (hpXK_mute_asciitilde compose-tilde-map) |
187 | 181 |
188 ;; HP according to HP-UX 8.0: | 182 ;; HP according to HP-UX 8.0: |
189 (x-define-dead-key XK_mute_acute compose-acute-map device) | 183 (XK_mute_acute compose-acute-map) |
190 (x-define-dead-key XK_mute_grave compose-grave-map device) | 184 (XK_mute_grave compose-grave-map) |
191 (x-define-dead-key XK_mute_diaeresis compose-diaeresis-map device) | 185 (XK_mute_diaeresis compose-diaeresis-map) |
192 (x-define-dead-key XK_mute_asciicircum compose-circumflex-map device) | 186 (XK_mute_asciicircum compose-circumflex-map) |
193 (x-define-dead-key XK_mute_asciitilde compose-tilde-map device) | 187 (XK_mute_asciitilde compose-tilde-map) |
194 | 188 |
195 ;; [[ XFree86 seems to use lower case and a hyphen ]] Not true; they use | 189 ;; [[ XFree86 seems to use lower case and a hyphen ]] Not true; |
196 ;; lower case and an underscore. XEmacs converts the underscore to a | 190 ;; they use lower case and an underscore. XEmacs converts the |
197 ;; hyphen in x_keysym_to_emacs_keysym because the keysym is in the | 191 ;; underscore to a hyphen in x_keysym_to_emacs_keysym because the |
198 ;; "Keyboard" character set, which is just totally fucking random, | 192 ;; keysym is in the "Keyboard" character set, which is just totally |
199 ;; considering it doesn't happen for any other character sets. | 193 ;; fucking random, considering it doesn't happen for any other |
200 (x-define-dead-key dead-acute compose-acute-map device) | 194 ;; character sets. |
201 (x-define-dead-key dead-grave compose-grave-map device) | 195 (dead-acute compose-acute-map) |
202 (x-define-dead-key dead-cedilla compose-cedilla-map device) | 196 (dead-grave compose-grave-map) |
203 (x-define-dead-key dead-diaeresis compose-diaeresis-map device) | 197 (dead-cedilla compose-cedilla-map) |
204 (x-define-dead-key dead-circum compose-circumflex-map device) | 198 (dead-diaeresis compose-diaeresis-map) |
205 (x-define-dead-key dead-circumflex compose-circumflex-map device) | 199 (dead-circum compose-circumflex-map) |
206 (x-define-dead-key dead-tilde compose-tilde-map device) | 200 (dead-circumflex compose-circumflex-map) |
207 ) | 201 (dead-tilde compose-tilde-map)) |
202 | |
203 ;; Get the correct value for function-key-map | |
204 with function-key-map = (symbol-value-in-console 'function-key-map | |
205 (device-console device) | |
206 function-key-map) | |
207 do (when (x-keysym-on-keyboard-p key device) | |
208 (define-key function-key-map (vector key) map)))) | |
208 | 209 |
209 (eval-when-compile | 210 (eval-when-compile |
210 (load "x-win-sun" nil t) | 211 (load "x-win-sun" nil t) |
211 (load "x-win-xfree86" nil t)) | 212 (load "x-win-xfree86" nil t)) |
212 | 213 |