(iso-accents-list): Add Icelandic thorn.
[bpt/emacs.git] / lisp / international / iso-transl.el
CommitLineData
9a726cd6 1;;; iso-transl.el --- keyboard input definitions for ISO 8859/1.
5970f3d0 2
a36db1ea 3;; Copyright (C) 1987, 1993, 1994, 1995 Free Software Foundation, Inc.
5970f3d0
RS
4
5;; Author: Howard Gayle
6;; Maintainer: FSF
7;; Keywords: i18n
8
9;; This file is part of GNU Emacs.
10
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)
14;; any later version.
15
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.
20
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.
24
63202134
RS
25;;; Commentary:
26
a36db1ea
KH
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).
63202134 32
5970f3d0
RS
33;;; Code:
34
a36db1ea
KH
35(defvar iso-transl-dead-key-alist
36 '((?\' . mute-acute)
37 (?\` . mute-grave)
38 (?\" . mute-diaeresis)
39 (?\^ . mute-asciicircum)
40 (?\~ . mute-asciitilde))
41 "Mapping of ASCII characters to their corresponding dead-key symbols.")
42
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.
63202134 46(defvar iso-transl-char-map
a36db1ea
KH
47 '(("* " . [160])(" " . [160])
48 ("*!" . [161])("!" . [161])
63202134
RS
49 ("\"\"" . [168])
50 ("\"A" . [196])
51 ("\"E" . [203])
52 ("\"I" . [207])
53 ("\"O" . [214])
54 ("\"U" . [220])
55 ("\"a" . [228])
56 ("\"e" . [235])
57 ("\"i" . [239])
58 ("\"o" . [246])
59 ("\"u" . [252])
60 ("\"y" . [255])
61 ("''" . [180])
62 ("'A" . [193])
63 ("'E" . [201])
64 ("'I" . [205])
65 ("'O" . [211])
66 ("'U" . [218])
67 ("'Y" . [221])
68 ("'a" . [225])
69 ("'e" . [233])
70 ("'i" . [237])
71 ("'o" . [243])
72 ("'u" . [250])
73 ("'y" . [253])
a36db1ea
KH
74 ("*$" . [164])("$" . [164])
75 ("*+" . [177])("+" . [177])
63202134
RS
76 (",," . [184])
77 (",C" . [199])
78 (",c" . [231])
a36db1ea
KH
79 ("*-" . [173])("-" . [173])
80 ("*." . [183])("." . [183])
63202134
RS
81 ("//" . [247])
82 ("/O" . [216])
83 ("/o" . [248])
84 ("1/2" . [189])
85 ("1/4" . [188])
86 ("3/4" . [190])
a36db1ea
KH
87 ("*<" . [171])("<" . [171])
88 ("*=" . [175])("=" . [175])
89 ("*>" . [187])(">" . [187])
90 ("*?" . [191])("?" . [191])
91 ("*A" . [197])("A" . [197])
92 ("*E" . [198])("E" . [198])
93 ("*C" . [169])("C" . [169])
94 ("*D" . [208])("D" . [208])
95 ("*L" . [163])("L" . [163])
96 ("*P" . [182])("P" . [182])
97 ("*R" . [174])("R" . [174])
98 ("*S" . [167])("S" . [167])
99 ("*T" . [222])("T" . [222])
100 ("*Y" . [165])("Y" . [165])
63202134
RS
101 ("^1" . [185])
102 ("^2" . [178])
103 ("^3" . [179])
104 ("^A" . [194])
105 ("^E" . [202])
106 ("^I" . [206])
107 ("^O" . [212])
108 ("^U" . [219])
109 ("^a" . [226])
110 ("^e" . [234])
111 ("^i" . [238])
112 ("^o" . [244])
113 ("^u" . [251])
114 ("_a" . [170])
115 ("_o" . [186])
116 ("`A" . [192])
117 ("`E" . [200])
118 ("`I" . [204])
119 ("`O" . [210])
120 ("`U" . [217])
121 ("`a" . [224])
122 ("`e" . [232])
123 ("`i" . [236])
124 ("`o" . [242])
125 ("`u" . [249])
a36db1ea
KH
126 ("*a" . [229])("a" . [229])
127 ("*e" . [230])("e" . [230])
128 ("*c" . [162])("c" . [162])
129 ("*d" . [240])("d" . [240])
130 ("*o" . [176])("o" . [176])
131 ("*s" . [223])("s" . [223])
132 ("*t" . [254])("t" . [254])
133 ("*u" . [181])("u" . [181])
134 ("*x" . [215])("x" . [215])
135 ("*|" . [166])("|" . [166])
63202134
RS
136 ("~A" . [195])
137 ("~N" . [209])
138 ("~O" . [213])
139 ("~a" . [227])
140 ("~n" . [241])
141 ("~o" . [245])
142 ("~~" . [172]))
143 "Alist of character translations for entering ISO characters.
144Each element has the form (STRING . VECTOR).
145The sequence STRING of ASCII chars translates into the
146sequence VECTOR. (VECTOR is normally one character long.)")
147
a36db1ea
KH
148;; Language-specific translation lists.
149(defvar iso-transl-language-alist
150 '(("German"
151 ("A" . [196])
152 ("O" . [214])
153 ("U" . [220])
154 ("a" . [228])
155 ("o" . [246])
156 ("s" . [223])
157 ("u" . [252]))
158 ("Spanish"
159 ("!" . [161])
160 ("?" . [191])
161 ("N" . [241])
162 ("n" . [209]))
163 ("Esperanto"
164 ("C" . [198])
165 ("G" . [216])
166 ("H" . [166])
167 ("J" . [172])
168 ("S" . [222])
169 ("U" . [221])
170 ("c" . [230])
171 ("g" . [248])
172 ("h" . [182])
173 ("j" . [188])
174 ("s" . [254])
175 ("u" . [253]))))
176
177(defvar iso-transl-ctl-x-8-map nil
178 "Keymap for C-x 8 prefix.")
179(or iso-transl-ctl-x-8-map
180 (setq iso-transl-ctl-x-8-map (make-sparse-keymap)))
181(or key-translation-map
182 (setq key-translation-map (make-sparse-keymap)))
183(define-key key-translation-map "\C-x8" iso-transl-ctl-x-8-map)
184
185;; For each entry in the alist, we'll make up to three ways to generate
186;; the character in question: the prefix `C-x 8'; the ALT modifier on
187;; the first key of the sequence; and (if applicable) replacing the first
188;; key of the sequence with the corresponding dead key. For example, a
189;; character associated with the string "~n" can be input with `C-x 8 ~ n'
190;; or `Alt-~ c' or `mute-asciitilde c'.
191(defun iso-transl-define-keys (alist)
192 (while alist
193 (define-key iso-transl-ctl-x-8-map (car (car alist)) (cdr (car alist)))
194 (let ((vec (vconcat (car (car alist))))
195 (deadpair (assq (aref (car (car alist)) 0)
196 iso-transl-dead-key-alist)))
197 (aset vec 0 (logior (aref vec 0) ?\A-\^@))
198 (define-key key-translation-map vec (cdr (car alist)))
199 (define-key isearch-mode-map (vector (aref vec 0)) nil)
200 (if deadpair
201 (let ((deadvec (copy-sequence vec)))
202 (aset deadvec 0 (cdr deadpair))
203 (define-key isearch-mode-map (vector (aref deadvec 0)) nil)
204 (define-key key-translation-map deadvec (cdr (car alist))))))
205 (setq alist (cdr alist))))
206
207(defun iso-transl-set-language (lang)
208 (interactive (list (let ((completion-ignore-case t))
209 (completing-read "Set which language? "
210 iso-transl-language-alist nil t))))
211 (iso-transl-define-keys (cdr (assoc lang iso-transl-language-alist))))
212
213
214;; The standard mapping comes automatically. You can partially overlay it
215;; with a language-specific mapping by using `M-x iso-transl-set-language'.
216(iso-transl-define-keys iso-transl-char-map)
217
218(define-key isearch-mode-map "\C-x" nil)
219(define-key isearch-mode-map [?\C-x t] 'isearch-other-control-char)
220(define-key isearch-mode-map "\C-x8" nil)
63202134 221
4579dd42
RS
222
223(provide 'iso-transl)
224
225;;; iso-transl.el ends here