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 ;; The two-character mnemonics are intended to be available in all languages.
44 ;; The ones beginning with `*' have one-character synonyms, but a
45 ;; language-specific table might override the short form for its own use.
46 (defvar iso-transl-char-map
47 '(("* " .
[160])(" " . [160])
48 ("*!" .
[161])("!" . [161])
75 ("*$" . [164])("$" . [164])
76 ("*+" . [177])("+" . [177])
80 ("*-" . [173])("-" . [173])
81 ("*." . [183])("." . [183])
92 ("*<" . [171])("<" . [171])
93 ("*=" . [175])("=" . [175])
94 ("*>" . [187])(">" . [187])
95 ("*?" . [191])("?" . [191])
96 ("*C" . [169])("C" . [169])
97 ("*L" . [163])("L" . [163])
98 ("*P" . [182])("P" . [182])
99 ("*R" . [174])("R" . [174])
100 ("*S" . [167])("S" . [167])
101 ("*Y" . [165])("Y" . [165])
127 ("*c" . [162])("c" . [162])
128 ("*o" . [176])("o" . [176])
129 ("*u" . [181])("u" . [181])
130 ("*x" . [215])("x" . [215])
131 ("*|" . [166])("|" . [166])
143 "Alist of character translations for entering ISO characters.
144 Each element has the form (STRING . VECTOR).
145 The sequence STRING of ASCII chars translates into the
146 sequence VECTOR. (VECTOR is normally one character long.)")
148 ;; Language-specific translation lists.
149 (defvar iso-transl-language-alist
183 (defvar iso-transl-ctl-x-8-map nil
184 "Keymap for C-x 8 prefix.")
185 (or iso-transl-ctl-x-8-map
186 (setq iso-transl-ctl-x-8-map (make-sparse-keymap)))
187 (or key-translation-map
188 (setq key-translation-map (make-sparse-keymap)))
189 (define-key key-translation-map "\C-x8" iso-transl-ctl-x-8-map)
191 ;; For each entry in the alist, we'll make up to three ways to generate
192 ;; the character in question: the prefix `C-x 8'; the ALT modifier on
193 ;; the first key of the sequence; and (if applicable) replacing the first
194 ;; key of the sequence with the corresponding dead key. For example, a
195 ;; character associated with the string "~n" can be input with `C-x 8 ~ n'
196 ;; or `Alt-~ n' or `mute-asciitilde n'.
197 (defun iso-transl-define-keys (alist)
199 (define-key iso-transl-ctl-x-8-map (car (car alist)) (cdr (car alist)))
200 (let ((vec (vconcat (car (car alist))))
201 (deadpair (assq (aref (car (car alist)) 0)
202 iso-transl-dead-key-alist)))
203 (aset vec 0 (logior (aref vec 0) ?\A-\^@))
204 (define-key key-translation-map vec (cdr (car alist)))
205 (define-key isearch-mode-map (vector (aref vec 0)) nil)
207 (let ((deadvec (copy-sequence vec)))
208 (aset deadvec 0 (cdr deadpair))
209 (define-key isearch-mode-map (vector (aref deadvec 0)) nil)
210 (define-key key-translation-map deadvec (cdr (car alist))))))
211 (setq alist (cdr alist))))
213 (defun iso-transl-set-language (lang)
214 (interactive (list (let ((completion-ignore-case t))
215 (completing-read "Set which language? "
216 iso-transl-language-alist nil t))))
217 (iso-transl-define-keys (cdr (assoc lang iso-transl-language-alist))))
220 ;; The standard mapping comes automatically. You can partially overlay it
221 ;; with a language-specific mapping by using `M-x iso-transl-set-language'.
222 (iso-transl-define-keys iso-transl-char-map)
224 (define-key isearch-mode-map "\C-x" nil)
225 (define-key isearch-mode-map [?\C-x t] 'isearch-other-control-char)
226 (define-key isearch-mode-map "\C-x8" nil)
229 (provide 'iso-transl)
231 ;;; iso-transl.el ends here