1 ;;; iso-transl.el --- keyboard input definitions for ISO 8859/1.
3 ;; Copyright (C) 1987, 1993, 1994, 1995 Free Software Foundation, Inc.
5 ;; Author: Howard Gayle
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to
23 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
27 ;; Loading this package defines three ways of entering the non-ASCII
28 ;; printable characters with codes above 127: the prefix C-x 8, or the
29 ;; Alt key, or a dead accent key. For example, you can enter uppercase
30 ;; A-umlaut as `C-x 8 " A' or `Alt-" A' (if you have an Alt key) or
31 ;; `umlaut A' (if you have an umlaut/diaeresis key).
35 (defvar iso-transl-dead-key-alist
38 (?
\" . mute-diaeresis
)
39 (?\^ . mute-asciicircum
)
40 (?\~ . mute-asciitilde
))
41 "Mapping of ASCII characters to their corresponding dead-key symbols.")
43 ;; Some X servers use these alternate names.
44 (or key-translation-map
45 (setq key-translation-map
(make-sparse-keymap)))
46 (define-key key-translation-map
[dead-acute
] [mute-acute
])
47 (define-key key-translation-map
[dead-grave
] [mute-grave
])
48 (define-key key-translation-map
[dead-diaeresis
] [mute-diaeresis
])
49 (define-key key-translation-map
[dead-asciicircum
] [mute-asciicircum
])
50 (define-key key-translation-map
[dead-asciitilde
] [mute-asciitilde
])
51 ;; Someone reports that these keys don't work if shifted.
52 ;; This might fix it--no word yet.
53 (define-key key-translation-map
[S-dead-acute
] [mute-acute
])
54 (define-key key-translation-map
[S-dead-grave
] [mute-grave
])
55 (define-key key-translation-map
[S-dead-diaeresis
] [mute-diaeresis
])
56 (define-key key-translation-map
[S-dead-asciicircum
] [mute-asciicircum
])
57 (define-key key-translation-map
[S-dead-asciitilde
] [mute-asciitilde
])
59 ;; The two-character mnemonics are intended to be available in all languages.
60 ;; The ones beginning with `*' have one-character synonyms, but a
61 ;; language-specific table might override the short form for its own use.
62 (defvar iso-transl-char-map
63 '(("* " .
[160])(" " . [160])
64 ("*!" .
[161])("!" . [161])
91 ("*$" . [164])("$" . [164])
92 ("*+" . [177])("+" . [177])
96 ("*-" . [173])("-" . [173])
97 ("*." . [183])("." . [183])
108 ("*<" . [171])("<" . [171])
109 ("*=" . [175])("=" . [175])
110 ("*>" . [187])(">" . [187])
111 ("*?" . [191])("?" . [191])
112 ("*C" . [169])("C" . [169])
113 ("*L" . [163])("L" . [163])
114 ("*P" . [182])("P" . [182])
115 ("*R" . [174])("R" . [174])
116 ("*S" . [167])("S" . [167])
117 ("*Y" . [165])("Y" . [165])
143 ("*c" . [162])("c" . [162])
144 ("*o" . [176])("o" . [176])
145 ("*u" . [181])("u" . [181])
146 ("*m" . [181])("m" . [181])
147 ("*x" . [215])("x" . [215])
148 ("*|" . [166])("|" . [166])
160 "Alist of character translations for entering ISO characters.
161 Each element has the form (STRING . VECTOR).
162 The sequence STRING of ASCII chars translates into the
163 sequence VECTOR. (VECTOR is normally one character long.)")
165 ;; Language-specific translation lists.
166 (defvar iso-transl-language-alist
200 (defvar iso-transl-ctl-x-8-map nil
201 "Keymap for C-x 8 prefix.")
202 (or iso-transl-ctl-x-8-map
203 (setq iso-transl-ctl-x-8-map (make-sparse-keymap)))
204 (or key-translation-map
205 (setq key-translation-map (make-sparse-keymap)))
206 (define-key key-translation-map "\C-x8" iso-transl-ctl-x-8-map)
208 ;; For each entry in the alist, we'll make up to three ways to generate
209 ;; the character in question: the prefix `C-x 8'; the ALT modifier on
210 ;; the first key of the sequence; and (if applicable) replacing the first
211 ;; key of the sequence with the corresponding dead key. For example, a
212 ;; character associated with the string "~n" can be input with `C-x 8 ~ n'
213 ;; or `Alt-~ n' or `mute-asciitilde n'.
214 (defun iso-transl-define-keys (alist)
216 (define-key iso-transl-ctl-x-8-map (car (car alist)) (cdr (car alist)))
217 (let ((vec (vconcat (car (car alist))))
218 (deadpair (assq (aref (car (car alist)) 0)
219 iso-transl-dead-key-alist)))
220 (aset vec 0 (logior (aref vec 0) ?\A-\^@))
221 (define-key key-translation-map vec (cdr (car alist)))
222 (define-key isearch-mode-map (vector (aref vec 0)) nil)
224 (let ((deadvec (copy-sequence vec)))
225 (aset deadvec 0 (cdr deadpair))
226 (define-key isearch-mode-map (vector (aref deadvec 0)) nil)
227 (define-key key-translation-map deadvec (cdr (car alist))))))
228 (setq alist (cdr alist))))
230 (defun iso-transl-set-language (lang)
231 (interactive (list (let ((completion-ignore-case t))
232 (completing-read "Set which language? "
233 iso-transl-language-alist nil t))))
234 (iso-transl-define-keys (cdr (assoc lang iso-transl-language-alist))))
237 ;; The standard mapping comes automatically. You can partially overlay it
238 ;; with a language-specific mapping by using `M-x iso-transl-set-language'.
239 (iso-transl-define-keys iso-transl-char-map)
241 (define-key isearch-mode-map "\C-x" nil)
242 (define-key isearch-mode-map [?\C-x t] 'isearch-other-control-char)
243 (define-key isearch-mode-map "\C-x8" nil)
246 (provide 'iso-transl)
248 ;;; iso-transl.el ends here