155
|
1 ;;; x-compose.el --- Compose-key processing in XEmacs
|
|
2
|
|
3 ;; Copyright (C) 1992, 1993, 1997 Free Software Foundation, Inc.
|
|
4
|
|
5 ;; Author: Jamie Zawinski <jwz@netscape.com>
|
|
6 ;; Maintainer: XEmacs Development Team
|
|
7 ;; Keywords: i18n
|
0
|
8
|
|
9 ;; This file is part of XEmacs.
|
|
10
|
|
11 ;; XEmacs is free software; you can redistribute it and/or modify it
|
|
12 ;; under the terms of the GNU General Public License as published by
|
|
13 ;; the Free Software Foundation; either version 2, or (at your option)
|
|
14 ;; any later version.
|
|
15
|
|
16 ;; XEmacs is distributed in the hope that it will be useful, but
|
|
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
19 ;; General Public License for more details.
|
|
20
|
|
21 ;; You should have received a copy of the GNU General Public License
|
70
|
22 ;; along with XEmacs; see the file COPYING. If not, write to the
|
|
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
24 ;; Boston, MA 02111-1307, USA.
|
0
|
25
|
155
|
26 ;;; Synched up with: Not in FSF.
|
|
27
|
|
28 ;;; Commentary:
|
|
29
|
|
30 ;; created by jwz, 14-jun-92.
|
|
31
|
|
32 ;; This file implements DEC-, OpenWindows-, and HP-compatible "Compose"
|
|
33 ;; processing for XEmacs.
|
|
34
|
|
35 ;; If you are running a version of X which already does compose processing,
|
|
36 ;; then you don't need this file. But the MIT R4 and R5 distributions don't
|
|
37 ;; do compose processing, so you may want to fake it by using this code.
|
|
38
|
|
39 ;; The basic idea is that there are several ways to generate keysyms which
|
|
40 ;; do not have keys devoted to them on your keyboard.
|
|
41
|
|
42 ;; The first method is by using "dead" keys. A dead key is a key which,
|
|
43 ;; when typed, does not insert a character. Instead it modifies the
|
|
44 ;; following character typed. So if you typed "dead-tilde" followed by "A",
|
|
45 ;; then "A-tilde" would be inserted. Of course, this requires you to modify
|
|
46 ;; your keyboard to include a "dead-tilde" key on it somewhere.
|
|
47
|
|
48 ;; The second method is by using a "Compose" key. With a Compose key, you
|
|
49 ;; would type "Compose" then "tilde" then "A" to insert "A-tilde".
|
|
50
|
|
51 ;; There are a small number of dead keys: acute, grave, cedilla, diaeresis,
|
|
52 ;; circumflex, tilde, and ring. There are a larger number of accented and
|
|
53 ;; other characters accessible via the Compose key, so both are useful.
|
|
54
|
|
55 ;; To use this code, you will need to have a Compose key on your keyboard.
|
|
56 ;; The default configuration of most X keyboards doesn't contain one. You
|
|
57 ;; can, for example, turn the right "Meta" key into a "Compose" key with
|
|
58 ;; this command:
|
0
|
59
|
155
|
60 ;; xmodmap -e "remove mod1 = Meta_R" -e "keysym Meta_R = Multi_key"
|
|
61
|
|
62 ;; Multi-key is the name that X (and emacs) know the "Compose" key by.
|
|
63 ;; The "remove..." command is necessary because the "Compose" key must not
|
|
64 ;; have any modifier bits associated with it. This exact command may not
|
|
65 ;; work, depending on what system and keyboard you are using. If it
|
|
66 ;; doesn't, you'll have to read the man page for xmodmap. You might want
|
|
67 ;; to get the "xkeycaps" program from the host export.lcs.mit.edu in the
|
|
68 ;; file contrib/xkeycaps.tar.Z, which is a graphical front end to xmodmap
|
|
69 ;; that hides xmodmap's arcane syntax from you.
|
|
70
|
|
71 ;; If for some reason you don't want to have a dedicated compose key on your
|
|
72 ;; keyboard, you can use some other key as the prefix. For example, to make
|
|
73 ;; "Meta-Shift-C" act as a compose key (so that "M-C , c" would insert the
|
|
74 ;; character "ccedilla") you could do
|
|
75
|
|
76 ;; (global-set-key "\M-C" compose-map)
|
0
|
77
|
155
|
78 ;; I believe the bindings encoded in this file are the same as those used
|
|
79 ;; by OpenWindows versions 2 and 3, and DEC VT320 terminals. Please let me
|
|
80 ;; know if you think otherwise.
|
|
81
|
|
82 ;; Much thanks to Justin Bur <justin@crim.ca> for helping me understand how
|
|
83 ;; this stuff is supposed to work.
|
|
84
|
|
85 ;; You also might want to consider getting Justin's patch for the MIT Xlib
|
|
86 ;; that implements compose processing in the library. This will enable
|
|
87 ;; compose processing in applications other than emacs as well. You can
|
|
88 ;; get it from export.lcs.mit.edu in contrib/compose.tar.Z.
|
|
89
|
|
90 ;; This code has one feature that a more "builtin" Compose mechanism could
|
|
91 ;; not have: at any point you can type C-h to get a list of the possible
|
|
92 ;; completions of what you have typed so far.
|
|
93
|
|
94 ;;; Code:
|
0
|
95
|
|
96 (require 'x-iso8859-1)
|
|
97
|
|
98 (defvar compose-map (make-keymap))
|
|
99 (defvar compose-acute-map (make-sparse-keymap))
|
|
100 (defvar compose-grave-map (make-sparse-keymap))
|
|
101 (defvar compose-cedilla-map (make-sparse-keymap))
|
|
102 (defvar compose-diaeresis-map (make-sparse-keymap))
|
|
103 (defvar compose-circumflex-map (make-sparse-keymap))
|
|
104 (defvar compose-tilde-map (make-sparse-keymap))
|
|
105 (defvar compose-ring-map (make-sparse-keymap))
|
|
106
|
|
107 ;;; The command `compose-key' exists so that this file may be autoloaded.
|
|
108 ;;;this doesn't work yet###autoload
|
70
|
109 (define-function 'compose-key compose-map)
|
0
|
110
|
|
111 ;; The "Compose" key:
|
|
112 ;; (keysym is lower case because we downcase everything in the Symbol font...)
|
|
113 ;;
|
|
114 ;;;this doesn't work yet###autoload
|
80
|
115 (define-key global-map [multi-key] 'compose-key)
|
0
|
116
|
|
117 ;; The "Dead" keys:
|
|
118 ;;
|
70
|
119 (define-key global-map [acute] compose-acute-map)
|
|
120 (define-key global-map [cedilla] compose-cedilla-map)
|
|
121 (define-key global-map [diaeresis] compose-diaeresis-map)
|
|
122 (define-key global-map [degree] compose-ring-map)
|
0
|
123
|
|
124 ;; The dead keys as seen by the "Compose" map:
|
|
125 ;;
|
|
126 (define-key compose-map [acute] compose-acute-map)
|
|
127 (define-key compose-map [cedilla] compose-cedilla-map)
|
|
128 (define-key compose-map [diaeresis] compose-diaeresis-map)
|
|
129 (define-key compose-map [degree] compose-ring-map)
|
|
130
|
|
131 (define-key compose-map "'" compose-acute-map)
|
|
132 (define-key compose-map "`" compose-grave-map)
|
|
133 (define-key compose-map "," compose-cedilla-map)
|
|
134 (define-key compose-map "\"" compose-diaeresis-map)
|
|
135 (define-key compose-map "^" compose-circumflex-map)
|
|
136 (define-key compose-map "~" compose-tilde-map)
|
|
137 (define-key compose-map "*" compose-ring-map)
|
|
138
|
|
139
|
|
140 ;;; The dead keys might really be called just about anything, depending
|
|
141 ;;; on the vendor. MIT thinks that the prefixes are "SunFA_", "D", and
|
|
142 ;;; "hpmute_" for Sun, DEC, and HP respectively. However, OpenWindows 3
|
|
143 ;;; thinks that the prefixes are "SunXK_FA_", "DXK_", and "hpXK_mute_".
|
|
144 ;;; And HP (who don't mention Sun and DEC at all) use "XK_mute_".
|
|
145 ;;; Go figure.
|
|
146
|
|
147 ;;; Presumably if someone is running OpenWindows, they won't be using
|
|
148 ;;; the DEC or HP keysyms, but if they are defined then that is possible,
|
|
149 ;;; so in that case we accept them all.
|
|
150
|
|
151 ;;; If things seem not to be working, you might want to check your
|
|
152 ;;; /usr/lib/X11/XKeysymDB file to see if your vendor has an equally
|
|
153 ;;; mixed up view of what these keys should be called.
|
|
154
|
|
155 ;; Sun according to MIT:
|
|
156 ;;
|
|
157 (cond ((x-valid-keysym-name-p "SunFA_Acute")
|
70
|
158 (define-key global-map [SunFA_Acute] compose-acute-map)
|
0
|
159 (define-key compose-map [SunFA_Acute] compose-acute-map)
|
70
|
160 (define-key global-map [SunFA_Grave] compose-grave-map)
|
0
|
161 (define-key compose-map [SunFA_Grave] compose-grave-map)
|
70
|
162 (define-key global-map [SunFA_Cedilla] compose-cedilla-map)
|
0
|
163 (define-key compose-map [SunFA_Cedilla] compose-cedilla-map)
|
70
|
164 (define-key global-map [SunFA_Diaeresis] compose-diaeresis-map)
|
0
|
165 (define-key compose-map [SunFA_Diaeresis] compose-diaeresis-map)
|
70
|
166 (define-key global-map [SunFA_Circum] compose-circumflex-map)
|
0
|
167 (define-key compose-map [SunFA_Circum] compose-circumflex-map)
|
70
|
168 (define-key global-map [SunFA_Tilde] compose-tilde-map)
|
0
|
169 (define-key compose-map [SunFA_Tilde] compose-tilde-map)
|
|
170 ))
|
|
171
|
|
172 ;; Sun according to OpenWindows 2:
|
|
173 ;;
|
|
174 (cond ((x-valid-keysym-name-p "Dead_Grave")
|
70
|
175 (define-key global-map [Dead_Grave] compose-grave-map)
|
0
|
176 (define-key compose-map [Dead_Grave] compose-grave-map)
|
70
|
177 (define-key global-map [Dead_Circum] compose-circumflex-map)
|
0
|
178 (define-key compose-map [Dead_Circum] compose-circumflex-map)
|
70
|
179 (define-key global-map [Dead_Tilde] compose-tilde-map)
|
0
|
180 (define-key compose-map [Dead_Tilde] compose-tilde-map)
|
|
181 ))
|
|
182
|
|
183 ;; Sun according to OpenWindows 3:
|
|
184 ;;
|
|
185 (cond ((x-valid-keysym-name-p "SunXK_FA_Acute")
|
70
|
186 (define-key global-map [SunXK_FA_Acute] compose-acute-map)
|
0
|
187 (define-key compose-map [SunXK_FA_Acute] compose-acute-map)
|
70
|
188 (define-key global-map [SunXK_FA_Grave] compose-grave-map)
|
0
|
189 (define-key compose-map [SunXK_FA_Grave] compose-grave-map)
|
70
|
190 (define-key global-map [SunXK_FA_Cedilla] compose-cedilla-map)
|
0
|
191 (define-key compose-map [SunXK_FA_Cedilla] compose-cedilla-map)
|
70
|
192 (define-key global-map [SunXK_FA_Diaeresis] compose-diaeresis-map)
|
0
|
193 (define-key compose-map [SunXK_FA_Diaeresis] compose-diaeresis-map)
|
70
|
194 (define-key global-map [SunXK_FA_Circum] compose-circumflex-map)
|
0
|
195 (define-key compose-map [SunXK_FA_Circum] compose-circumflex-map)
|
70
|
196 (define-key global-map [SunXK_FA_Tilde] compose-tilde-map)
|
0
|
197 (define-key compose-map [SunXK_FA_Tilde] compose-tilde-map)
|
|
198 ))
|
|
199
|
|
200 ;; DEC according to MIT:
|
|
201 ;;
|
|
202 (cond ((x-valid-keysym-name-p "Dacute_accent")
|
70
|
203 (define-key global-map [Dacute_accent] compose-acute-map)
|
0
|
204 (define-key compose-map [Dacute_accent] compose-acute-map)
|
70
|
205 (define-key global-map [Dgrave_accent] compose-grave-map)
|
0
|
206 (define-key compose-map [Dgrave_accent] compose-grave-map)
|
70
|
207 (define-key global-map [Dcedilla_accent] compose-cedilla-map)
|
0
|
208 (define-key compose-map [Dcedilla_accent] compose-cedilla-map)
|
70
|
209 (define-key global-map [Dcircumflex_accent] compose-circumflex-map)
|
0
|
210 (define-key compose-map [Dcircumflex_accent] compose-circumflex-map)
|
70
|
211 (define-key global-map [Dtilde] compose-tilde-map)
|
0
|
212 (define-key compose-map [Dtilde] compose-tilde-map)
|
70
|
213 (define-key global-map [Dring_accent] compose-ring-map)
|
0
|
214 (define-key compose-map [Dring_accent] compose-ring-map)
|
|
215 ))
|
|
216
|
|
217 ;; DEC according to OpenWindows 3:
|
|
218 ;;
|
|
219 (cond ((x-valid-keysym-name-p "DXK_acute_accent")
|
70
|
220 (define-key global-map [DXK_acute_accent] compose-acute-map)
|
0
|
221 (define-key compose-map [DXK_acute_accent] compose-acute-map)
|
70
|
222 (define-key global-map [DXK_grave_accent] compose-grave-map)
|
0
|
223 (define-key compose-map [DXK_grave_accent] compose-grave-map)
|
70
|
224 (define-key global-map [DXK_cedilla_accent] compose-cedilla-map)
|
0
|
225 (define-key compose-map [DXK_cedilla_accent] compose-cedilla-map)
|
70
|
226 (define-key global-map [DXK_circumflex_accent] compose-circumflex-map)
|
0
|
227 (define-key compose-map [DXK_circumflex_accent] compose-circumflex-map)
|
70
|
228 (define-key global-map [DXK_tilde] compose-tilde-map)
|
0
|
229 (define-key compose-map [DXK_tilde] compose-tilde-map)
|
70
|
230 (define-key global-map [DXK_ring_accent] compose-ring-map)
|
0
|
231 (define-key compose-map [DXK_ring_accent] compose-ring-map)
|
|
232 ))
|
|
233
|
|
234 ;; HP according to MIT:
|
|
235 ;;
|
|
236 (cond ((x-valid-keysym-name-p "hpmute_acute")
|
70
|
237 (define-key global-map [hpmute_acute] compose-acute-map)
|
0
|
238 (define-key compose-map [hpmute_acute] compose-acute-map)
|
70
|
239 (define-key global-map [hpmute_grave] compose-grave-map)
|
0
|
240 (define-key compose-map [hpmute_grave] compose-grave-map)
|
70
|
241 (define-key global-map [hpmute_diaeresis] compose-diaeresis-map)
|
0
|
242 (define-key compose-map [hpmute_diaeresis] compose-diaeresis-map)
|
70
|
243 (define-key global-map [hpmute_asciicircum] compose-circumflex-map)
|
0
|
244 (define-key compose-map [hpmute_asciicircum] compose-circumflex-map)
|
70
|
245 (define-key global-map [hpmute_asciitilde] compose-tilde-map)
|
0
|
246 (define-key compose-map [hpmute_asciitilde] compose-tilde-map)
|
|
247 ))
|
|
248
|
|
249 ;; HP according to OpenWindows 3:
|
|
250 ;;
|
|
251 (cond ((x-valid-keysym-name-p "hpXK_mute_acute")
|
70
|
252 (define-key global-map [hpXK_mute_acute] compose-acute-map)
|
0
|
253 (define-key compose-map [hpXK_mute_acute] compose-acute-map)
|
70
|
254 (define-key global-map [hpXK_mute_grave] compose-grave-map)
|
0
|
255 (define-key compose-map [hpXK_mute_grave] compose-grave-map)
|
70
|
256 (define-key global-map [hpXK_mute_diaeresis] compose-diaeresis-map)
|
0
|
257 (define-key compose-map [hpXK_mute_diaeresis] compose-diaeresis-map)
|
70
|
258 (define-key global-map [hpXK_mute_asciicircum] compose-circumflex-map)
|
0
|
259 (define-key compose-map [hpXK_mute_asciicircum] compose-circumflex-map)
|
70
|
260 (define-key global-map [hpXK_mute_asciitilde] compose-tilde-map)
|
0
|
261 (define-key compose-map [hpXK_mute_asciitilde] compose-tilde-map)
|
|
262 ))
|
|
263
|
|
264 ;; HP according to HP-UX 8.0:
|
|
265 ;;
|
|
266 (cond ((x-valid-keysym-name-p "XK_mute_acute")
|
70
|
267 (define-key global-map [XK_mute_acute] compose-acute-map)
|
0
|
268 (define-key compose-map [XK_mute_acute] compose-acute-map)
|
70
|
269 (define-key global-map [XK_mute_grave] compose-grave-map)
|
0
|
270 (define-key compose-map [XK_mute_grave] compose-grave-map)
|
70
|
271 (define-key global-map [XK_mute_diaeresis] compose-diaeresis-map)
|
0
|
272 (define-key compose-map [XK_mute_diaeresis] compose-diaeresis-map)
|
70
|
273 (define-key global-map [XK_mute_asciicircum] compose-circumflex-map)
|
0
|
274 (define-key compose-map [XK_mute_asciicircum] compose-circumflex-map)
|
70
|
275 (define-key global-map [XK_mute_asciitilde] compose-tilde-map)
|
0
|
276 (define-key compose-map [XK_mute_asciitilde] compose-tilde-map)
|
|
277 ))
|
|
278
|
|
279 ;;; The contents of the "dead key" maps. These are shared by the
|
|
280 ;;; compose-map.
|
|
281
|
|
282 (set-keymap-name compose-acute-map 'compose-acute-map)
|
114
|
283 (set-keymap-default-binding compose-acute-map 'self-insert-command)
|
0
|
284 (define-key compose-acute-map " " "'")
|
|
285 (define-key compose-acute-map "'" [acute])
|
|
286 (define-key compose-acute-map "A" [Aacute])
|
|
287 (define-key compose-acute-map "E" [Eacute])
|
|
288 (define-key compose-acute-map "I" [Iacute])
|
|
289 (define-key compose-acute-map "O" [Oacute])
|
|
290 (define-key compose-acute-map "U" [Uacute])
|
|
291 (define-key compose-acute-map "Y" [Yacute])
|
|
292 (define-key compose-acute-map "a" [aacute])
|
|
293 (define-key compose-acute-map "e" [eacute])
|
|
294 (define-key compose-acute-map "i" [iacute])
|
|
295 (define-key compose-acute-map "o" [oacute])
|
|
296 (define-key compose-acute-map "u" [uacute])
|
|
297 (define-key compose-acute-map "y" [yacute])
|
|
298
|
|
299 (set-keymap-name compose-grave-map 'compose-grave-map)
|
114
|
300 (set-keymap-default-binding compose-grave-map 'self-insert-command)
|
70
|
301 (define-key compose-grave-map " " [grave])
|
0
|
302 (define-key compose-grave-map "A" [Agrave])
|
|
303 (define-key compose-grave-map "E" [Egrave])
|
|
304 (define-key compose-grave-map "I" [Igrave])
|
|
305 (define-key compose-grave-map "O" [Ograve])
|
|
306 (define-key compose-grave-map "U" [Ugrave])
|
|
307 (define-key compose-grave-map "a" [agrave])
|
|
308 (define-key compose-grave-map "e" [egrave])
|
|
309 (define-key compose-grave-map "i" [igrave])
|
|
310 (define-key compose-grave-map "o" [ograve])
|
|
311 (define-key compose-grave-map "u" [ugrave])
|
|
312
|
|
313 (set-keymap-name compose-cedilla-map 'compose-cedilla-map)
|
114
|
314 (set-keymap-default-binding compose-cedilla-map 'self-insert-command)
|
0
|
315 (define-key compose-cedilla-map "," [cedilla])
|
|
316 (define-key compose-cedilla-map "C" [Ccedilla])
|
|
317 (define-key compose-cedilla-map "c" [ccedilla])
|
|
318
|
|
319 (set-keymap-name compose-diaeresis-map 'compose-diaeresis-map)
|
114
|
320 (set-keymap-default-binding compose-diaeresis-map 'self-insert-command)
|
0
|
321 (define-key compose-diaeresis-map " " [diaeresis])
|
|
322 (define-key compose-diaeresis-map "\"" [diaeresis])
|
|
323 (define-key compose-diaeresis-map "A" [Adiaeresis])
|
|
324 (define-key compose-diaeresis-map "E" [Ediaeresis])
|
|
325 (define-key compose-diaeresis-map "I" [Idiaeresis])
|
|
326 (define-key compose-diaeresis-map "O" [Odiaeresis])
|
|
327 (define-key compose-diaeresis-map "U" [Udiaeresis])
|
|
328 (define-key compose-diaeresis-map "a" [adiaeresis])
|
|
329 (define-key compose-diaeresis-map "e" [ediaeresis])
|
|
330 (define-key compose-diaeresis-map "i" [idiaeresis])
|
|
331 (define-key compose-diaeresis-map "o" [odiaeresis])
|
|
332 (define-key compose-diaeresis-map "u" [udiaeresis])
|
|
333 (define-key compose-diaeresis-map "y" [ydiaeresis])
|
|
334
|
|
335 (set-keymap-name compose-circumflex-map 'compose-circumflex-map)
|
114
|
336 (set-keymap-default-binding compose-circumflex-map 'self-insert-command)
|
0
|
337 (define-key compose-circumflex-map " " "^")
|
|
338 (define-key compose-circumflex-map "/" "|")
|
|
339 (define-key compose-circumflex-map "!" [brokenbar])
|
|
340 (define-key compose-circumflex-map "-" [macron])
|
|
341 (define-key compose-circumflex-map "_" [macron])
|
70
|
342 (define-key compose-circumflex-map "0" [degree])
|
0
|
343 (define-key compose-circumflex-map "1" [onesuperior])
|
|
344 (define-key compose-circumflex-map "2" [twosuperior])
|
|
345 (define-key compose-circumflex-map "3" [threesuperior])
|
|
346 (define-key compose-circumflex-map "." [periodcentered])
|
|
347 (define-key compose-circumflex-map "A" [Acircumflex])
|
|
348 (define-key compose-circumflex-map "E" [Ecircumflex])
|
|
349 (define-key compose-circumflex-map "I" [Icircumflex])
|
|
350 (define-key compose-circumflex-map "O" [Ocircumflex])
|
|
351 (define-key compose-circumflex-map "U" [Ucircumflex])
|
|
352 (define-key compose-circumflex-map "a" [acircumflex])
|
|
353 (define-key compose-circumflex-map "e" [ecircumflex])
|
|
354 (define-key compose-circumflex-map "i" [icircumflex])
|
|
355 (define-key compose-circumflex-map "o" [ocircumflex])
|
|
356 (define-key compose-circumflex-map "u" [ucircumflex])
|
|
357
|
|
358 (set-keymap-name compose-tilde-map 'compose-tilde-map)
|
114
|
359 (set-keymap-default-binding compose-tilde-map 'self-insert-command)
|
0
|
360 (define-key compose-tilde-map " " "~")
|
|
361 (define-key compose-tilde-map "A" [Atilde])
|
|
362 (define-key compose-tilde-map "N" [Ntilde])
|
|
363 (define-key compose-tilde-map "O" [Otilde])
|
|
364 (define-key compose-tilde-map "a" [atilde])
|
|
365 (define-key compose-tilde-map "n" [ntilde])
|
|
366 (define-key compose-tilde-map "o" [otilde])
|
|
367
|
|
368 (set-keymap-name compose-ring-map 'compose-ring-map)
|
114
|
369 (set-keymap-default-binding compose-ring-map 'self-insert-command)
|
70
|
370 (define-key compose-ring-map " " [degree])
|
0
|
371 (define-key compose-ring-map "A" [Aring])
|
|
372 (define-key compose-ring-map "a" [aring])
|
|
373
|
|
374
|
|
375 ;;; The rest of the compose-map. These are the composed characters
|
|
376 ;;; that are not accessible via "dead" keys.
|
|
377
|
|
378 (set-keymap-name compose-map 'compose-map)
|
114
|
379 (set-keymap-default-binding compose-map 'self-insert-command)
|
0
|
380 (define-key compose-map " '" "'")
|
|
381 (define-key compose-map " ^" "^")
|
|
382 (define-key compose-map " `" "`")
|
|
383 (define-key compose-map " ~" "~")
|
|
384 (define-key compose-map " " [nobreakspace])
|
|
385 (define-key compose-map " \"" [diaeresis])
|
70
|
386 (define-key compose-map " *" [degree])
|
0
|
387
|
|
388 (define-key compose-map "!!" [exclamdown])
|
|
389 (define-key compose-map "!^" [brokenbar])
|
|
390 (define-key compose-map "!S" [section])
|
|
391 (define-key compose-map "!s" [section])
|
|
392 (define-key compose-map "!P" [paragraph])
|
|
393 (define-key compose-map "!p" [paragraph])
|
|
394
|
|
395 (define-key compose-map "((" "[")
|
|
396 (define-key compose-map "(-" "{")
|
|
397
|
|
398 (define-key compose-map "))" "]")
|
|
399 (define-key compose-map ")-" "}")
|
|
400
|
|
401 (define-key compose-map "++" "#")
|
|
402 (define-key compose-map "+-" [plusminus])
|
|
403
|
|
404 (define-key compose-map "-(" "{")
|
|
405 (define-key compose-map "-)" "}")
|
|
406 (define-key compose-map "--" "-")
|
|
407 (define-key compose-map "-L" [sterling])
|
|
408 (define-key compose-map "-l" [sterling])
|
|
409 (define-key compose-map "-Y" [yen])
|
|
410 (define-key compose-map "-y" [yen])
|
|
411 (define-key compose-map "-," [notsign])
|
|
412 (define-key compose-map "-|" [notsign])
|
|
413 (define-key compose-map "-^" [macron])
|
|
414 (define-key compose-map "-+" [plusminus])
|
|
415 (define-key compose-map "-:" [division])
|
|
416 (define-key compose-map "-D" [ETH])
|
|
417 (define-key compose-map "-d" [eth])
|
|
418 (define-key compose-map "-a" [ordfeminine])
|
|
419
|
|
420 (define-key compose-map ".^" [periodcentered])
|
|
421
|
|
422 (define-key compose-map "//" "\\")
|
|
423 (define-key compose-map "/<" "\\")
|
|
424 (define-key compose-map "/^" "|")
|
|
425 (define-key compose-map "/C" [cent])
|
|
426 (define-key compose-map "/c" [cent])
|
|
427 (define-key compose-map "/U" [mu])
|
|
428 (define-key compose-map "/u" [mu])
|
|
429 (define-key compose-map "/O" [Ooblique])
|
|
430 (define-key compose-map "/o" [oslash])
|
|
431
|
|
432 (define-key compose-map "0X" [currency])
|
|
433 (define-key compose-map "0x" [currency])
|
|
434 (define-key compose-map "0S" [section])
|
|
435 (define-key compose-map "0s" [section])
|
|
436 (define-key compose-map "0C" [copyright])
|
|
437 (define-key compose-map "0c" [copyright])
|
|
438 (define-key compose-map "0R" [registered])
|
|
439 (define-key compose-map "0r" [registered])
|
70
|
440 (define-key compose-map "0^" [degree])
|
0
|
441
|
|
442 (define-key compose-map "1^" [onesuperior])
|
|
443 (define-key compose-map "14" [onequarter])
|
|
444 (define-key compose-map "12" [onehalf])
|
|
445
|
|
446 (define-key compose-map "2^" [twosuperior])
|
|
447
|
|
448 (define-key compose-map "3^" [threesuperior])
|
|
449 (define-key compose-map "34" [threequarters])
|
|
450
|
|
451 (define-key compose-map ":-" [division])
|
|
452
|
|
453 (define-key compose-map "</" "\\")
|
|
454 (define-key compose-map "<<" [guillemotleft])
|
|
455
|
|
456 (define-key compose-map "=L" [sterling])
|
|
457 (define-key compose-map "=l" [sterling])
|
|
458 (define-key compose-map "=Y" [yen])
|
|
459 (define-key compose-map "=y" [yen])
|
|
460
|
|
461 (define-key compose-map ">>" [guillemotright])
|
|
462
|
|
463 (define-key compose-map "??" [questiondown])
|
|
464
|
|
465 (define-key compose-map "AA" "@")
|
|
466 (define-key compose-map "Aa" "@")
|
|
467 (define-key compose-map "A_" [ordfeminine])
|
|
468 (define-key compose-map "A`" [Agrave])
|
|
469 (define-key compose-map "A'" [Aacute])
|
|
470 (define-key compose-map "A^" [Acircumflex])
|
|
471 (define-key compose-map "A~" [Atilde])
|
|
472 (define-key compose-map "A\"" [Adiaeresis])
|
|
473 (define-key compose-map "A*" [Aring])
|
|
474 (define-key compose-map "AE" [AE])
|
|
475
|
|
476 (define-key compose-map "C/" [cent])
|
|
477 (define-key compose-map "C|" [cent])
|
|
478 (define-key compose-map "C0" [copyright])
|
|
479 (define-key compose-map "CO" [copyright])
|
|
480 (define-key compose-map "Co" [copyright])
|
|
481 (define-key compose-map "C," [Ccedilla])
|
|
482
|
|
483 (define-key compose-map "D-" [ETH])
|
|
484
|
|
485 (define-key compose-map "E`" [Egrave])
|
|
486 (define-key compose-map "E'" [Eacute])
|
|
487 (define-key compose-map "E^" [Ecircumflex])
|
|
488 (define-key compose-map "E\"" [Ediaeresis])
|
|
489
|
|
490 (define-key compose-map "I`" [Igrave])
|
|
491 (define-key compose-map "I'" [Iacute])
|
|
492 (define-key compose-map "I^" [Icircumflex])
|
|
493 (define-key compose-map "I\"" [Idiaeresis])
|
|
494
|
|
495 (define-key compose-map "L-" [sterling])
|
|
496 (define-key compose-map "L=" [sterling])
|
|
497
|
|
498 (define-key compose-map "N~" [Ntilde])
|
|
499
|
|
500 (define-key compose-map "OX" [currency])
|
|
501 (define-key compose-map "Ox" [currency])
|
|
502 (define-key compose-map "OS" [section])
|
|
503 (define-key compose-map "Os" [section])
|
|
504 (define-key compose-map "OC" [copyright])
|
|
505 (define-key compose-map "Oc" [copyright])
|
|
506 (define-key compose-map "OR" [registered])
|
|
507 (define-key compose-map "Or" [registered])
|
|
508 (define-key compose-map "O_" [masculine])
|
|
509 (define-key compose-map "O`" [Ograve])
|
|
510 (define-key compose-map "O'" [Oacute])
|
|
511 (define-key compose-map "O^" [Ocircumflex])
|
|
512 (define-key compose-map "O~" [Otilde])
|
|
513 (define-key compose-map "O\"" [Odiaeresis])
|
|
514 (define-key compose-map "O/" [Ooblique])
|
|
515
|
|
516 (define-key compose-map "P!" [paragraph])
|
|
517
|
|
518 (define-key compose-map "R0" [registered])
|
|
519 (define-key compose-map "RO" [registered])
|
|
520 (define-key compose-map "Ro" [registered])
|
|
521
|
|
522 (define-key compose-map "S!" [section])
|
|
523 (define-key compose-map "S0" [section])
|
|
524 (define-key compose-map "SO" [section])
|
|
525 (define-key compose-map "So" [section])
|
|
526 (define-key compose-map "SS" [ssharp])
|
|
527
|
|
528 (define-key compose-map "TH" [THORN])
|
|
529
|
|
530 (define-key compose-map "U`" [Ugrave])
|
|
531 (define-key compose-map "U'" [Uacute])
|
|
532 (define-key compose-map "U^" [Ucircumflex])
|
|
533 (define-key compose-map "U\"" [Udiaeresis])
|
|
534
|
|
535 (define-key compose-map "X0" [currency])
|
|
536 (define-key compose-map "XO" [currency])
|
|
537 (define-key compose-map "Xo" [currency])
|
|
538
|
|
539 (define-key compose-map "Y-" [yen])
|
|
540 (define-key compose-map "Y=" [yen])
|
|
541 (define-key compose-map "Y'" [Yacute])
|
|
542
|
|
543 (define-key compose-map "_A" [ordfeminine])
|
|
544 (define-key compose-map "_a" [ordfeminine])
|
|
545 (define-key compose-map "_^" [macron])
|
|
546 (define-key compose-map "_O" [masculine])
|
|
547 (define-key compose-map "_o" [masculine])
|
|
548
|
|
549 (define-key compose-map "aA" "@")
|
|
550 (define-key compose-map "aa" "@")
|
|
551 (define-key compose-map "a_" [ordfeminine])
|
|
552 (define-key compose-map "a-" [ordfeminine])
|
|
553 (define-key compose-map "a`" [agrave])
|
|
554 (define-key compose-map "a'" [aacute])
|
|
555 (define-key compose-map "a^" [acircumflex])
|
|
556 (define-key compose-map "a~" [atilde])
|
|
557 (define-key compose-map "a\"" [adiaeresis])
|
|
558 (define-key compose-map "a*" [aring])
|
|
559 (define-key compose-map "ae" [ae])
|
|
560
|
|
561 (define-key compose-map "c/" [cent])
|
|
562 (define-key compose-map "c|" [cent])
|
|
563 (define-key compose-map "c0" [copyright])
|
|
564 (define-key compose-map "cO" [copyright])
|
|
565 (define-key compose-map "co" [copyright])
|
|
566 (define-key compose-map "c," [ccedilla])
|
|
567
|
|
568 (define-key compose-map "d-" [eth])
|
|
569
|
|
570 (define-key compose-map "e`" [egrave])
|
|
571 (define-key compose-map "e'" [eacute])
|
|
572 (define-key compose-map "e^" [ecircumflex])
|
|
573 (define-key compose-map "e\"" [ediaeresis])
|
|
574
|
|
575 (define-key compose-map "i`" [igrave])
|
|
576 (define-key compose-map "i'" [iacute])
|
|
577 (define-key compose-map "i^" [icircumflex])
|
|
578 (define-key compose-map "i\"" [idiaeresis])
|
|
579
|
|
580 (define-key compose-map "l-" [sterling])
|
|
581 (define-key compose-map "l=" [sterling])
|
|
582
|
|
583 (define-key compose-map "n~" [ntilde])
|
|
584
|
|
585 (define-key compose-map "oX" [currency])
|
|
586 (define-key compose-map "ox" [currency])
|
|
587 (define-key compose-map "oC" [copyright])
|
|
588 (define-key compose-map "oc" [copyright])
|
|
589 (define-key compose-map "oR" [registered])
|
|
590 (define-key compose-map "or" [registered])
|
|
591 (define-key compose-map "oS" [section])
|
|
592 (define-key compose-map "os" [section])
|
|
593 (define-key compose-map "o_" [masculine])
|
|
594 (define-key compose-map "o`" [ograve])
|
|
595 (define-key compose-map "o'" [oacute])
|
|
596 (define-key compose-map "o^" [ocircumflex])
|
|
597 (define-key compose-map "o~" [otilde])
|
|
598 (define-key compose-map "o\"" [odiaeresis])
|
|
599 (define-key compose-map "o/" [oslash])
|
|
600
|
|
601 (define-key compose-map "p!" [paragraph])
|
|
602
|
|
603 (define-key compose-map "r0" [registered])
|
|
604 (define-key compose-map "rO" [registered])
|
|
605 (define-key compose-map "ro" [registered])
|
|
606
|
|
607 (define-key compose-map "s!" [section])
|
|
608 (define-key compose-map "s0" [section])
|
|
609 (define-key compose-map "sO" [section])
|
|
610 (define-key compose-map "so" [section])
|
|
611 (define-key compose-map "ss" [ssharp])
|
|
612
|
|
613 (define-key compose-map "th" [thorn])
|
|
614
|
|
615 (define-key compose-map "u`" [ugrave])
|
|
616 (define-key compose-map "u'" [uacute])
|
|
617 (define-key compose-map "u^" [ucircumflex])
|
|
618 (define-key compose-map "u\"" [udiaeresis])
|
|
619 (define-key compose-map "u/" [mu])
|
|
620
|
|
621 (define-key compose-map "x0" [currency])
|
|
622 (define-key compose-map "xO" [currency])
|
|
623 (define-key compose-map "xo" [currency])
|
|
624 (define-key compose-map "xx" [multiply])
|
|
625
|
|
626 (define-key compose-map "y-" [yen])
|
|
627 (define-key compose-map "y=" [yen])
|
|
628 (define-key compose-map "y'" [yacute])
|
|
629 (define-key compose-map "y\"" [ydiaeresis])
|
|
630
|
|
631 (define-key compose-map "|C" [cent])
|
|
632 (define-key compose-map "|c" [cent])
|
|
633 (define-key compose-map "||" [brokenbar])
|
|
634
|
|
635
|
|
636 ;;; Electric dead keys: making a' mean a-acute.
|
|
637
|
|
638 (defun electric-diacritic (&optional count)
|
|
639 "Modify the previous character with an accent.
|
|
640 For example, if `:' is bound to this command, then typing `a:'
|
|
641 will first insert `a' and then turn it into `\344' (adiaeresis).
|
|
642 The keys to which this command may be bound (and the accents
|
|
643 which it understands) are:
|
|
644
|
|
645 ' (acute) \301\311\315\323\332\335 \341\351\355\363\372\375
|
|
646 ` (grave) \300\310\314\322\331 \340\350\354\362\371
|
|
647 : (diaeresis) \304\313\317\326\334 \344\353\357\366\374\377
|
|
648 ^ (circumflex) \302\312\316\324\333 \342\352\356\364\373
|
|
649 , (cedilla) \307\347
|
|
650 . (ring) \305\345"
|
|
651 (interactive "p")
|
|
652 (or count (setq count 1))
|
|
653
|
|
654 (if (not (eq last-command 'self-insert-command))
|
|
655 ;; Only do the magic if the two chars were typed in succession.
|
|
656 (self-insert-command count)
|
|
657
|
|
658 ;; This is so that ``a : C-x u'' will transform `adiaeresis' back into `a:'
|
|
659 (self-insert-command count)
|
|
660 (undo-boundary)
|
|
661 (delete-char (- count))
|
|
662
|
|
663 (let* ((c last-command-char)
|
|
664 (map (cond ((eq c ?') compose-acute-map)
|
|
665 ((eq c ?`) compose-grave-map)
|
|
666 ((eq c ?,) compose-cedilla-map)
|
|
667 ((eq c ?:) compose-diaeresis-map)
|
|
668 ((eq c ?^) compose-circumflex-map)
|
|
669 ((eq c ?~) compose-tilde-map)
|
|
670 ((eq c ?.) compose-ring-map)
|
|
671 (t (error "unknown diacritic: %s (%c)" c c))))
|
|
672 (base-char (preceding-char))
|
|
673 (mod-char (and (>= (downcase base-char) ?a) ; only do alphabetics?
|
|
674 (<= (downcase base-char) ?z)
|
|
675 (lookup-key map (make-string 1 base-char)))))
|
|
676 (if (and (vectorp mod-char) (= (length mod-char) 1))
|
|
677 (setq mod-char (aref mod-char 0)))
|
|
678 (if (and mod-char (symbolp mod-char))
|
|
679 (setq mod-char (or (get mod-char character-set-property) mod-char)))
|
|
680 (if (and mod-char (> count 0))
|
|
681 (delete-char -1)
|
|
682 (setq mod-char c))
|
|
683 (while (> count 0)
|
|
684 (insert mod-char)
|
|
685 (setq count (1- count))))))
|
|
686
|
70
|
687 ;; should "::" mean "¨" and ": " mean ":"?
|
0
|
688 ;; should we also do
|
|
689 ;; (?~
|
|
690 ;; (?A "\303")
|
|
691 ;; (?C "\307")
|
|
692 ;; (?D "\320")
|
|
693 ;; (?N "\321")
|
|
694 ;; (?O "\325")
|
|
695 ;; (?a "\343")
|
|
696 ;; (?c "\347")
|
|
697 ;; (?d "\360")
|
|
698 ;; (?n "\361")
|
|
699 ;; (?o "\365")
|
|
700 ;; (?> "\273")
|
|
701 ;; (?< "\253")
|
|
702 ;; (? "~")) ; no special code
|
|
703 ;; (?\/
|
|
704 ;; (?A "\305") ;; A-with-ring (Norwegian and Danish)
|
|
705 ;; (?E "\306") ;; AE-ligature (Norwegian and Danish)
|
|
706 ;; (?O "\330")
|
|
707 ;; (?a "\345") ;; a-with-ring (Norwegian and Danish)
|
|
708 ;; (?e "\346") ;; ae-ligature (Norwegian and Danish)
|
|
709 ;; (?o "\370")
|
|
710 ;; (? "/")) ; no special code
|
|
711
|
|
712
|
|
713 ;;; Providing help in the middle of a compose sequence. (Way cool.)
|
|
714
|
|
715 (defun compose-help ()
|
|
716 (interactive)
|
|
717 (let* ((keys (apply 'vector
|
|
718 (nreverse
|
|
719 (cdr (nreverse (append (this-command-keys) nil))))))
|
|
720 (map (or (key-binding keys)
|
70
|
721 (error "can't find map? %s" (this-command-keys)))))
|
0
|
722 (with-output-to-temp-buffer "*Help*"
|
|
723 (set-buffer "*Help*")
|
|
724 (erase-buffer)
|
|
725 (message "Working...")
|
|
726 (setq ctl-arrow 'compose) ; non-t-non-nil
|
|
727 (insert "You are typing a compose sequence. So far you have typed: ")
|
|
728 (insert (key-description keys))
|
|
729 (insert "\nCompletions from here are:\n\n")
|
|
730 (map-keymap 'compose-help-mapper map t)
|
|
731 (message "? "))
|
|
732 (let (event)
|
|
733 (while (progn
|
|
734 (setq event (next-command-event))
|
|
735 (setq map (lookup-key map (vector event)))
|
|
736 (keymapp map))
|
|
737 )
|
|
738 (if map
|
|
739 (command-execute map)
|
|
740 (setq unread-command-event event)))))
|
|
741
|
|
742 (put 'compose-help 'isearch-command t) ; so that it doesn't terminate isearch
|
|
743
|
|
744 (defun compose-help-mapper (key binding)
|
|
745 (if (and (symbolp key)
|
|
746 (get key character-set-property))
|
|
747 (setq key (get key character-set-property)))
|
|
748 (if (eq binding 'compose-help) ; suppress that...
|
|
749 nil
|
|
750 (if (keymapp binding)
|
|
751 (let ((p (point)))
|
|
752 (map-keymap 'compose-help-mapper binding t)
|
|
753 (goto-char p)
|
|
754 (while (not (eobp))
|
70
|
755 (if (characterp key)
|
0
|
756 (insert (make-string 1 key))
|
|
757 (insert (single-key-description key)))
|
|
758 (insert " ")
|
|
759 (forward-line 1)))
|
70
|
760 (if (characterp key)
|
0
|
761 (insert (make-string 1 key))
|
|
762 (insert (single-key-description key)))
|
|
763 (indent-to 16)
|
|
764 (let ((code (and (vectorp binding)
|
|
765 (= 1 (length binding))
|
|
766 (get (aref binding 0) character-set-property))))
|
|
767 (if code
|
|
768 (insert (make-string 1 code))
|
|
769 (if (stringp binding)
|
|
770 (insert binding)
|
|
771 (insert (prin1-to-string binding)))))
|
|
772 (if (and (vectorp binding) (= 1 (length binding)))
|
|
773 (progn
|
|
774 (indent-to 32)
|
|
775 (insert (symbol-name (aref binding 0))))))
|
|
776 (insert "\n")))
|
|
777
|
|
778 ;; define it at top-level in the compose map...
|
|
779 (define-key compose-map '(control h) 'compose-help)
|
|
780 (define-key compose-map 'help 'compose-help)
|
|
781 ;; and then define it in each sub-map of the compose map.
|
|
782 (map-keymap
|
|
783 (function (lambda (key binding)
|
|
784 (if (keymapp binding)
|
|
785 (progn
|
|
786 (define-key binding '(control h) 'compose-help)
|
|
787 (define-key binding 'help 'compose-help)))))
|
|
788 compose-map nil)
|
|
789
|
2
|
790 ;; Make redisplay display the accented letters
|
0
|
791 (if (memq (default-value 'ctl-arrow) '(t nil))
|
|
792 (setq-default ctl-arrow 'iso-8859/1))
|
|
793
|
|
794
|
|
795 (provide 'x-compose)
|
155
|
796
|
|
797 ;;; x-compose.el ends here
|