All of SXEmacs' http URLs are now https. WooHoo!
[sxemacs] / lisp / x-iso8859-1.el
1 ;;; x-iso8859-1 --- Mapping between X keysym names and ISO 8859-1
2
3 ;; Copyright (C) 1992, 1993, 1997 Free Software Foundation, Inc.
4
5 ;; Author: Jamie Zawinski <jwz@jwz.org>
6 ;; Created: 15-jun-92
7 ;; Maintainer: SXEmacs Development Team
8 ;; Keywords: extensions, internal, dumped
9
10 ;; This file is part of SXEmacs.
11
12 ;; SXEmacs is free software: you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation, either version 3 of the License, or
15 ;; (at your option) any later version.
16
17 ;; SXEmacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 ;; GNU General Public License for more details.
21
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
24
25 ;;; Synched up with: Not synched.
26
27 ;;; Commentary:
28
29 ;; created by jwz, 13-jun-92.
30 ;; changed by Heiko Muenkel, 12-jun-1997: Added a grave keysym.
31
32 ;; Under X, when the user types a character that is ISO-8859/1 but not ASCII,
33 ;; it comes in as a symbol instead of as a character code.  This keeps things
34 ;; nice and character-set independent.  This file takes all of those symbols
35 ;; (the symbols that are the X names for the 8859/1 characters) and puts a
36 ;; property on them which holds the character code that should be inserted in
37 ;; the buffer when they are typed.  The self-insert-command function will look
38 ;; at this.  It also binds them all to self-insert-command.
39
40 ;; It puts the same property on the keypad keys, so that (read-char) will
41 ;; think that they are the same as the digit characters.  However, those
42 ;; keys are bound to one-character keyboard macros, so that `kp-9' will, by
43 ;; default, do the same thing that `9' does, in whatever the current mode is.
44
45 ;; The standard case and syntax tables are set in iso8859-1.el, since
46 ;; that is not X-specific.
47
48 ;;; Code:
49
50 (require 'iso8859-1)
51
52 (defconst iso8859/1-code-to-x-keysym-table nil
53   "Maps iso8859/1 to an X keysym name which corresponds to it.
54 There may be more than one X name for this keycode; this returns the first one.
55 Note that this is X specific; one should avoid using this table whenever
56 possible, in the interest of portability.")
57
58 ;; (This esoteric little construct is how you do MACROLET in elisp.  It
59 ;; generates the most efficient code for the .elc file by unwinding the
60 ;; loop at compile-time.)
61
62 ((macro
63   . (lambda (&rest syms-and-iso8859/1-codes)
64       (cons
65        'progn
66        (nconc
67         ;;
68         ;; First emit code that puts the `x-iso8859/1' property on all of
69         ;; the keysym symbols.
70         ;;
71         (mapcar '(lambda (sym-and-code)
72                   (list 'put (list 'quote (car sym-and-code))
73                         ''x-iso8859/1 (car (cdr sym-and-code))))
74                 syms-and-iso8859/1-codes)
75         ;;
76         ;; Then emit code that binds all of those keysym symbols to
77         ;; `self-insert-command'.
78         ;;
79         (mapcar '(lambda (sym-and-code)
80                   (list 'global-set-key (list 'quote (car sym-and-code))
81                         ''self-insert-command))
82                 syms-and-iso8859/1-codes)
83         ;;
84         ;; Then emit the value of iso8859/1-code-to-x-keysym-table.
85         ;;
86         (let ((v (make-vector 256 nil)))
87           ;; the printing ASCII chars have 1-char names.
88           (let ((i 33))
89             (while (< i 127)
90               (aset v i (intern (make-string 1 i)))
91               (setq i (1+ i))))
92           ;; these are from the keyboard character set.
93           (mapcar '(lambda (x) (aset v (car x) (car (cdr x))))
94                   '((8 backspace) (9 tab) (10 linefeed) (13 return)
95                     (27 escape) (32 space) (127 delete)))
96           (mapcar '(lambda (sym-and-code)
97                     (or (aref v (car (cdr sym-and-code)))
98                         (aset v (car (cdr sym-and-code)) (car sym-and-code))))
99                   syms-and-iso8859/1-codes)
100           (list (list 'setq 'iso8859/1-code-to-x-keysym-table v)))
101         ))))
102
103  ;; The names and capitalization here are as per the MIT X11R4 and X11R5
104  ;; distributions.  If a vendor varies from this, adjustments will need
105  ;; to be made...
106
107  (grave                 ?\140)
108  (nobreakspace          ?\240)
109  (exclamdown            ?\241)
110  (cent                  ?\242)
111  (sterling              ?\243)
112  (currency              ?\244)
113  (yen                   ?\245)
114  (brokenbar             ?\246)
115  (section               ?\247)
116  (diaeresis             ?\250)
117  (copyright             ?\251)
118  (ordfeminine           ?\252)
119  (guillemotleft         ?\253)
120  (notsign               ?\254)
121  (hyphen                ?\255)
122  (registered            ?\256)
123  (macron                ?\257)
124  (degree                ?\260)
125  (plusminus             ?\261)
126  (twosuperior           ?\262)
127  (threesuperior         ?\263)
128  (acute                 ?\264)  ; Why is there an acute keysym that is
129  (mu                    ?\265)  ; distinct from apostrophe/quote, but
130  (paragraph             ?\266)  ; no grave keysym that is distinct from
131  (periodcentered        ?\267)  ; backquote?
132  (cedilla               ?\270)  ; I've added the grave keysym, because it's
133  (onesuperior           ?\271)  ; used in x-compose (Heiko Muenkel).
134  (masculine             ?\272)
135  (guillemotright        ?\273)
136  (onequarter            ?\274)
137  (onehalf               ?\275)
138  (threequarters         ?\276)
139  (questiondown          ?\277)
140
141  (Agrave                ?\300)
142  (Aacute                ?\301)
143  (Acircumflex           ?\302)
144  (Atilde                ?\303)
145  (Adiaeresis            ?\304)
146  (Aring                 ?\305)
147  (AE                    ?\306)
148  (Ccedilla              ?\307)
149  (Egrave                ?\310)
150  (Eacute                ?\311)
151  (Ecircumflex           ?\312)
152  (Ediaeresis            ?\313)
153  (Igrave                ?\314)
154  (Iacute                ?\315)
155  (Icircumflex           ?\316)
156  (Idiaeresis            ?\317)
157  (ETH                   ?\320)
158  (Ntilde                ?\321)
159  (Ograve                ?\322)
160  (Oacute                ?\323)
161  (Ocircumflex           ?\324)
162  (Otilde                ?\325)
163  (Odiaeresis            ?\326)
164  (multiply              ?\327)
165  (Ooblique              ?\330)
166  (Ugrave                ?\331)
167  (Uacute                ?\332)
168  (Ucircumflex           ?\333)
169  (Udiaeresis            ?\334)
170  (Yacute                ?\335)
171  (THORN                 ?\336)
172  (ssharp                ?\337)
173
174  (agrave                ?\340)
175  (aacute                ?\341)
176  (acircumflex           ?\342)
177  (atilde                ?\343)
178  (adiaeresis            ?\344)
179  (aring                 ?\345)
180  (ae                    ?\346)
181  (ccedilla              ?\347)
182  (egrave                ?\350)
183  (eacute                ?\351)
184  (ecircumflex           ?\352)
185  (ediaeresis            ?\353)
186  (igrave                ?\354)
187  (iacute                ?\355)
188  (icircumflex           ?\356)
189  (idiaeresis            ?\357)
190  (eth                   ?\360)
191  (ntilde                ?\361)
192  (ograve                ?\362)
193  (oacute                ?\363)
194  (ocircumflex           ?\364)
195  (otilde                ?\365)
196  (odiaeresis            ?\366)
197  (division              ?\367)
198  (oslash                ?\370)
199  (ugrave                ?\371)
200  (uacute                ?\372)
201  (ucircumflex           ?\373)
202  (udiaeresis            ?\374)
203  (yacute                ?\375)
204  (thorn                 ?\376)
205  (ydiaeresis            ?\377)
206
207  )
208
209 ((macro . (lambda (&rest syms-and-iso8859/1-codes)
210             (cons 'progn
211                   (mapcar '(lambda (sym-and-code)
212                             (list 'put (list 'quote (car sym-and-code))
213                                   ''x-iso8859/1 (car (cdr sym-and-code))))
214                           syms-and-iso8859/1-codes))))
215  ;;
216  ;; Let's do the appropriate thing for some vendor-specific keysyms too...
217  ;; Apparently nobody agrees on what the names of these keysyms are.
218  ;;
219  (SunFA_Acute           ?\264)
220  (SunXK_FA_Acute        ?\264)
221  (Dacute_accent         ?\264)
222  (DXK_acute_accent      ?\264)
223  (hpmute_acute          ?\264)
224  (hpXK_mute_acute       ?\264)
225  (XK_mute_acute         ?\264)
226
227  (SunFA_Grave            ?`)
228  (Dead_Grave             ?`)
229  (SunXK_FA_Grave         ?`)
230  (Dgrave_accent          ?`)
231  (DXK_grave_accent       ?`)
232  (hpmute_grave           ?`)
233  (hpXK_mute_grave        ?`)
234  (XK_mute_grave          ?`)
235
236  (SunFA_Cedilla         ?\270)
237  (SunXK_FA_Cedilla      ?\270)
238  (Dcedilla_accent       ?\270)
239  (DXK_cedilla_accent    ?\270)
240
241  (SunFA_Diaeresis       ?\250)
242  (SunXK_FA_Diaeresis    ?\250)
243  (hpmute_diaeresis      ?\250)
244  (hpXK_mute_diaeresis   ?\250)
245  (XK_mute_diaeresis     ?\250)
246
247  (SunFA_Circum           ?^)
248  (Dead_Circum            ?^)
249  (SunXK_FA_Circum        ?^)
250  (Dcircumflex_accent     ?^)
251  (DXK_circumflex_accent  ?^)
252  (hpmute_asciicircum     ?^)
253  (hpXK_mute_asciicircum  ?^)
254  (XK_mute_asciicircum    ?^)
255
256  (SunFA_Tilde            ?~)
257  (Dead_Tilde             ?~)
258  (SunXK_FA_Tilde         ?~)
259  (Dtilde                 ?~)
260  (DXK_tilde              ?~)
261  (hpmute_asciitilde      ?~)
262  (hpXK_mute_asciitilde   ?~)
263  (XK_mute_asciitilde     ?~)
264
265  (Dring_accent          ?\260)
266  (DXK_ring_accent       ?\260)
267  )
268
269 (provide 'x-iso8859-1)
270
271 ;;; x-iso8859-1.el ends here