(paragraph-start, paragraph-separate): Default values no longer start
[bpt/emacs.git] / lisp / international / iso-transl.el
1 ;;; iso-transl.el --- keyboard input definitions for ISO 8859/1.
2
3 ;; Copyright (C) 1987, 1993, 1994, 1995 Free Software Foundation, Inc.
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
25 ;;; Commentary:
26
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).
32
33 ;;; Code:
34
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.
46 (defvar iso-transl-char-map
47 '(("* " . [160])(" " . [160])
48 ("*!" . [161])("!" . [161])
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 ("\"s" . [223])
60 ("\"u" . [252])
61 ("\"y" . [255])
62 ("''" . [180])
63 ("'A" . [193])
64 ("'E" . [201])
65 ("'I" . [205])
66 ("'O" . [211])
67 ("'U" . [218])
68 ("'Y" . [221])
69 ("'a" . [225])
70 ("'e" . [233])
71 ("'i" . [237])
72 ("'o" . [243])
73 ("'u" . [250])
74 ("'y" . [253])
75 ("*$" . [164])("$" . [164])
76 ("*+" . [177])("+" . [177])
77 (",," . [184])
78 (",C" . [199])
79 (",c" . [231])
80 ("*-" . [173])("-" . [173])
81 ("*." . [183])("." . [183])
82 ("//" . [247])
83 ("/A" . [197])
84 ("/E" . [198])
85 ("/O" . [216])
86 ("/a" . [229])
87 ("/e" . [230])
88 ("/o" . [248])
89 ("1/2" . [189])
90 ("1/4" . [188])
91 ("3/4" . [190])
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])
102 ("^1" . [185])
103 ("^2" . [178])
104 ("^3" . [179])
105 ("^A" . [194])
106 ("^E" . [202])
107 ("^I" . [206])
108 ("^O" . [212])
109 ("^U" . [219])
110 ("^a" . [226])
111 ("^e" . [234])
112 ("^i" . [238])
113 ("^o" . [244])
114 ("^u" . [251])
115 ("_a" . [170])
116 ("_o" . [186])
117 ("`A" . [192])
118 ("`E" . [200])
119 ("`I" . [204])
120 ("`O" . [210])
121 ("`U" . [217])
122 ("`a" . [224])
123 ("`e" . [232])
124 ("`i" . [236])
125 ("`o" . [242])
126 ("`u" . [249])
127 ("*c" . [162])("c" . [162])
128 ("*o" . [176])("o" . [176])
129 ("*u" . [181])("u" . [181])
130 ("*x" . [215])("x" . [215])
131 ("*|" . [166])("|" . [166])
132 ("~A" . [195])
133 ("~D" . [208])
134 ("~N" . [209])
135 ("~O" . [213])
136 ("~T" . [222])
137 ("~a" . [227])
138 ("~d" . [240])
139 ("~n" . [241])
140 ("~o" . [245])
141 ("~t" . [254])
142 ("~~" . [172]))
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.)")
147
148 ;; Language-specific translation lists.
149 (defvar iso-transl-language-alist
150 '(("Esperanto"
151 ("C" . [198])
152 ("G" . [216])
153 ("H" . [166])
154 ("J" . [172])
155 ("S" . [222])
156 ("U" . [221])
157 ("c" . [230])
158 ("g" . [248])
159 ("h" . [182])
160 ("j" . [188])
161 ("s" . [254])
162 ("u" . [253]))
163 ("French"
164 ("C" . [199])
165 ("c" . [231]))
166 ("German"
167 ("A" . [196])
168 ("O" . [214])
169 ("U" . [220])
170 ("a" . [228])
171 ("o" . [246])
172 ("s" . [223])
173 ("u" . [252]))
174 ("Portuguese"
175 ("C" . [199])
176 ("c" . [231]))
177 ("Spanish"
178 ("!" . [161])
179 ("?" . [191])
180 ("N" . [241])
181 ("n" . [209]))))
182
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)
190
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)
198 (while 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)
206 (if deadpair
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))))
212
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))))
218
219
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)
223
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)
227
228
229 (provide 'iso-transl)
230
231 ;;; iso-transl.el ends here