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)
41 (?\~ . mute-asciitilde)
44 (?\" . dead-diaeresis)
45 (?^ . dead-asciicircum)
46 (?\~ . dead-asciitilde)
48 (?^ . dead-circumflex)
50 ;; Someone reports that these keys don't work if shifted.
51 ;; This might fix it--no word yet.
54 (?\" . S-dead-diaeresis)
55 (?^ . S-dead-asciicircum)
56 (?\~ . S-dead-asciitilde)
58 (?^ . S-dead-circumflex)
60 "Mapping of ASCII characters to their corresponding dead-key symbols.")
62 ;; The two-character mnemonics are intended to be available in all languages.
63 ;; The ones beginning with `*' have one-character synonyms, but a
64 ;; language-specific table might override the short form for its own use.
65 (defvar iso-transl-char-map
66 '(("* " . [160])(" " . [160])
67 ("*!" . [161])("!" . [161])
94 ("*$" . [164])("$" . [164])
95 ("*+" . [177])("+" . [177])
99 ("*-" . [173])("-" . [173])
100 ("*." . [183])("." . [183])
111 ("*<" . [171])("<" . [171])
112 ("*=" . [175])("=" . [175])
113 ("*>" . [187])(">" . [187])
114 ("*?" . [191])("?" . [191])
115 ("*C" . [169])("C" . [169])
116 ("*L" . [163])("L" . [163])
117 ("*P" . [182])("P" . [182])
118 ("*R" . [174])("R" . [174])
119 ("*S" . [167])("S" . [167])
120 ("*Y" . [165])("Y" . [165])
146 ("*c" . [162])("c" . [162])
147 ("*o" . [176])("o" . [176])
148 ("*u" . [181])("u" . [181])
149 ("*m" . [181])("m" . [181])
150 ("*x" . [215])("x" . [215])
151 ("*|" . [166])("|" . [166])
168 "Alist of character translations for entering ISO characters.
169 Each element has the form (STRING . VECTOR).
170 The sequence STRING of ASCII chars translates into the
171 sequence VECTOR. (VECTOR is normally one character long.)")
173 ;; Language-specific translation lists.
174 (defvar iso-transl-language-alist
208 (defvar iso-transl-ctl-x-8-map nil
209 "Keymap for C-x 8 prefix.")
210 (or iso-transl-ctl-x-8-map
211 (setq iso-transl-ctl-x-8-map (make-sparse-keymap)))
212 (or key-translation-map
213 (setq key-translation-map (make-sparse-keymap)))
214 (define-key key-translation-map "\C-x8" iso-transl-ctl-x-8-map)
216 ;; For each entry in the alist, we'll make up to three ways to generate
217 ;; the character in question: the prefix `C-x 8'; the ALT modifier on
218 ;; the first key of the sequence; and (if applicable) replacing the first
219 ;; key of the sequence with the corresponding dead key. For example, a
220 ;; character associated with the string "~n" can be input with `C-x 8 ~ n'
221 ;; or `Alt-~ n' or `mute-asciitilde n'.
222 (defun iso-transl-define-keys (alist)
224 (define-key iso-transl-ctl-x-8-map (car (car alist)) (cdr (car alist)))
225 (let ((inchar (aref (car (car alist)) 0))
226 (vec (vconcat (car (car alist))))
227 (tail iso-transl-dead-key-alist))
228 (aset vec 0 (logior (aref vec 0) ?\A-\^@))
229 (define-key key-translation-map vec (cdr (car alist)))
230 (define-key isearch-mode-map (vector (aref vec 0)) nil)
232 (if (eq (car (car tail)) inchar)
233 (let ((deadvec (copy-sequence vec))
234 (deadkey (cdr (car tail))))
235 (aset deadvec 0 deadkey)
236 (define-key isearch-mode-map (vector deadkey) nil)
237 (define-key key-translation-map deadvec (cdr (car alist)))))
238 (setq tail (cdr tail))))
239 (setq alist (cdr alist))))
241 (defun iso-transl-set-language (lang)
242 (interactive (list (let ((completion-ignore-case t))
243 (completing-read "Set which language? "
244 iso-transl-language-alist nil t))))
245 (iso-transl-define-keys (cdr (assoc lang iso-transl-language-alist))))
248 ;; The standard mapping comes automatically. You can partially overlay it
249 ;; with a language-specific mapping by using `M-x iso-transl-set-language'.
250 (iso-transl-define-keys iso-transl-char-map)
252 (define-key isearch-mode-map "\C-x" nil)
253 (define-key isearch-mode-map [?\C-x t] 'isearch-other-control-char)
254 (define-key isearch-mode-map "\C-x8" nil)
257 (provide 'iso-transl)
259 ;;; iso-transl.el ends here