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 the
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA.
28 ;; Loading this package defines three ways of entering the non-ASCII
29 ;; printable characters with codes above 127: the prefix C-x 8, or the
30 ;; Alt key, or a dead accent key. For example, you can enter uppercase
31 ;; A-umlaut as `C-x 8 " A' or `Alt-" A' (if you have an Alt key) or
32 ;; `umlaut A' (if you have an umlaut/diaeresis key).
36 (defvar iso-transl-dead-key-alist
39 (?
\" . mute-diaeresis
)
40 (?^ . mute-asciicircum
) ;; Don't use \, since \^ is special.
41 (?\~ . mute-asciitilde
))
42 "Mapping of ASCII characters to their corresponding dead-key symbols.")
44 ;; Some X servers use these alternate names.
45 (or key-translation-map
46 (setq key-translation-map
(make-sparse-keymap)))
47 (define-key key-translation-map
[dead-acute
] [mute-acute
])
48 (define-key key-translation-map
[dead-grave
] [mute-grave
])
49 (define-key key-translation-map
[dead-diaeresis
] [mute-diaeresis
])
50 (define-key key-translation-map
[dead-asciicircum
] [mute-asciicircum
])
51 (define-key key-translation-map
[dead-asciitilde
] [mute-asciitilde
])
52 ;; Someone reports that these keys don't work if shifted.
53 ;; This might fix it--no word yet.
54 (define-key key-translation-map
[S-dead-acute
] [mute-acute
])
55 (define-key key-translation-map
[S-dead-grave
] [mute-grave
])
56 (define-key key-translation-map
[S-dead-diaeresis
] [mute-diaeresis
])
57 (define-key key-translation-map
[S-dead-asciicircum
] [mute-asciicircum
])
58 (define-key key-translation-map
[S-dead-asciitilde
] [mute-asciitilde
])
60 ;; The two-character mnemonics are intended to be available in all languages.
61 ;; The ones beginning with `*' have one-character synonyms, but a
62 ;; language-specific table might override the short form for its own use.
63 (defvar iso-transl-char-map
64 '(("* " .
[160])(" " . [160])
65 ("*!" .
[161])("!" . [161])
92 ("*$" . [164])("$" . [164])
93 ("*+" . [177])("+" . [177])
97 ("*-" . [173])("-" . [173])
98 ("*." . [183])("." . [183])
109 ("*<" . [171])("<" . [171])
110 ("*=" . [175])("=" . [175])
111 ("*>" . [187])(">" . [187])
112 ("*?" . [191])("?" . [191])
113 ("*C" . [169])("C" . [169])
114 ("*L" . [163])("L" . [163])
115 ("*P" . [182])("P" . [182])
116 ("*R" . [174])("R" . [174])
117 ("*S" . [167])("S" . [167])
118 ("*Y" . [165])("Y" . [165])
144 ("*c" . [162])("c" . [162])
145 ("*o" . [176])("o" . [176])
146 ("*u" . [181])("u" . [181])
147 ("*m" . [181])("m" . [181])
148 ("*x" . [215])("x" . [215])
149 ("*|" . [166])("|" . [166])
161 "Alist of character translations for entering ISO characters.
162 Each element has the form (STRING . VECTOR).
163 The sequence STRING of ASCII chars translates into the
164 sequence VECTOR. (VECTOR is normally one character long.)")
166 ;; Language-specific translation lists.
167 (defvar iso-transl-language-alist
201 (defvar iso-transl-ctl-x-8-map nil
202 "Keymap for C-x 8 prefix.")
203 (or iso-transl-ctl-x-8-map
204 (setq iso-transl-ctl-x-8-map (make-sparse-keymap)))
205 (or key-translation-map
206 (setq key-translation-map (make-sparse-keymap)))
207 (define-key key-translation-map "\C-x8" iso-transl-ctl-x-8-map)
209 ;; For each entry in the alist, we'll make up to three ways to generate
210 ;; the character in question: the prefix `C-x 8'; the ALT modifier on
211 ;; the first key of the sequence; and (if applicable) replacing the first
212 ;; key of the sequence with the corresponding dead key. For example, a
213 ;; character associated with the string "~n" can be input with `C-x 8 ~ n'
214 ;; or `Alt-~ n' or `mute-asciitilde n'.
215 (defun iso-transl-define-keys (alist)
217 (define-key iso-transl-ctl-x-8-map (car (car alist)) (cdr (car alist)))
218 (let ((vec (vconcat (car (car alist))))
219 (deadpair (assq (aref (car (car alist)) 0)
220 iso-transl-dead-key-alist)))
221 (aset vec 0 (logior (aref vec 0) ?\A-\^@))
222 (define-key key-translation-map vec (cdr (car alist)))
223 (define-key isearch-mode-map (vector (aref vec 0)) nil)
225 (let ((deadvec (copy-sequence vec)))
226 (aset deadvec 0 (cdr deadpair))
227 (define-key isearch-mode-map (vector (aref deadvec 0)) nil)
228 (define-key key-translation-map deadvec (cdr (car alist))))))
229 (setq alist (cdr alist))))
231 (defun iso-transl-set-language (lang)
232 (interactive (list (let ((completion-ignore-case t))
233 (completing-read "Set which language? "
234 iso-transl-language-alist nil t))))
235 (iso-transl-define-keys (cdr (assoc lang iso-transl-language-alist))))
238 ;; The standard mapping comes automatically. You can partially overlay it
239 ;; with a language-specific mapping by using `M-x iso-transl-set-language'.
240 (iso-transl-define-keys iso-transl-char-map)
242 (define-key isearch-mode-map "\C-x" nil)
243 (define-key isearch-mode-map [?\C-x t] 'isearch-other-control-char)
244 (define-key isearch-mode-map "\C-x8" nil)
247 (provide 'iso-transl)
249 ;;; iso-transl.el ends here