aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1996-01-25 06:34:56 +0000
committerRichard M. Stallman1996-01-25 06:34:56 +0000
commitbbaf7c2857dec407cbe3833255ceda2a723d0484 (patch)
tree75b4f9b633807e87f2d0948c81ea8e6d49c4bc48
parent44a75d487a92ec8413901f8272845e1a03038acd (diff)
downloademacs-bbaf7c2857dec407cbe3833255ceda2a723d0484.tar.gz
emacs-bbaf7c2857dec407cbe3833255ceda2a723d0484.zip
(iso-languages): Restructure the list to remove
redundancy in list elements. (iso-accents-compose-key): Function deleted. (iso-accents-compose, iso-accents-customize, iso-accentuate, iso-accent-rassoc-unit, iso-unaccentuate, iso-deaccentuate): Adapt for new structure of `iso-languages'.
-rw-r--r--lisp/international/iso-acc.el283
1 files changed, 100 insertions, 183 deletions
diff --git a/lisp/international/iso-acc.el b/lisp/international/iso-acc.el
index 8e3f6f58da0..abdafe3cf83 100644
--- a/lisp/international/iso-acc.el
+++ b/lisp/international/iso-acc.el
@@ -58,8 +58,8 @@
58;; minor mode, or disable it. 58;; minor mode, or disable it.
59 59
60;; If you want only some of these characters to serve as accents, 60;; If you want only some of these characters to serve as accents,
61;; add a language to iso-languages which specifies the accent characters 61;; add a language to `iso-languages' which specifies the accent characters
62;; that you want, then select the language with iso-accents-customize. 62;; that you want, then select the language with `iso-accents-customize'.
63 63
64;;; Code: 64;;; Code:
65 65
@@ -67,156 +67,92 @@
67 67
68(defvar iso-languages 68(defvar iso-languages
69 '(("portuguese" 69 '(("portuguese"
70 (?' ?` ?^ ?\" ?~) 70 (?' (?A . ?\301) (?E . ?\311) (?I . ?\315) (?O . ?\323) (?U . ?\332)
71 (((?' ?A) ?\301) ((?' ?E) ?\311) ((?' ?I) ?\315) ((?' ?O) ?\323) 71 (?C . ?\307) (?a . ?\341) (?e . ?\351) (?i . ?\355) (?o . ?\363)
72 ((?' ?U) ?\332) ((?' ?C) ?\307) ((?' ?a) ?\341) ((?' ?e) ?\351) 72 (?u . ?\372) (?c . ?\347) (?\ . ?'))
73 ((?' ?i) ?\355) ((?' ?o) ?\363) ((?' ?u) ?\372) ((?' ?c) ?\347) 73 (?` (?A . ?\300) (?a . ?\340) (?\ . ?`))
74 ((?' ? ) ?') ((?` ?A) ?\300) ((?` ?a) ?\340) ((?` ? ) ?`) 74 (?^ (?A . ?\302) (?E . ?\312) (?O . ?\324) (?a . ?\342) (?e . ?\352)
75 ((?^ ?A) ?\302) ((?^ ?E) ?\312) ((?^ ?O) ?\324) ((?^ ?a) ?\342) 75 (?o . ?\364) (?\ . ?^))
76 ((?^ ?e) ?\352) ((?^ ?o) ?\364) ((?^ ? ) ?^) ((?\" ?U) ?\334) 76 (?\" (?U . ?\334) (?u . ?\374) (?\ . ?\"))
77 ((?\" ?u) ?\374) ((?\" ? ) ?\") ((?\~ ?A) ?\303) ((?\~ ?O) ?\325) 77 (?\~ (?A . ?\303) (?O . ?\325) (?a . ?\343) (?o . ?\365) (?\ . ?\~)))
78 ((?\~ ?a) ?\343) ((?\~ ?o) ?\365) ((?\~ ?\ ) ?\~))) 78
79 ("irish" 79 ("irish"
80 (?') 80 (?' (?A . ?\301) (?E . ?\311) (?I . ?\315) (?O . ?\323) (?U . ?\332)
81 (((?' ?A) ?\301) ((?' ?E) ?\311) ((?' ?I) ?\315) ((?' ?O) ?\323) 81 (?a . ?\341) (?e . ?\351) (?i . ?\355) (?o . ?\363) (?u . ?\372)
82 ((?' ?U) ?\332) ((?' ?a) ?\341) ((?' ?e) ?\351) 82 (?\ . ?')))
83 ((?' ?i) ?\355) ((?' ?o) ?\363) ((?' ?u) ?\372) 83
84 ((?' ? ) ?') ))
85 ("french" 84 ("french"
86 (?' ?` ?^ ?\" ?~) 85 (?' (?A . ?\301) (?E . ?\311) (?I . ?\315) (?O . ?\323) (?U . ?\332)
87 (((?' ?A) ?\301) ((?' ?E) ?\311) ((?' ?I) ?\315) ((?' ?O) ?\323) 86 (?C . ?\307) (?a . ?\341) (?e . ?\351) (?i . ?\355) (?o . ?\363)
88 ((?' ?U) ?\332) ((?' ?C) ?\307) ((?' ?a) ?\341) ((?' ?e) ?\351) 87 (?u . ?\372) (?c . ?\347) (?\ . ?'))
89 ((?' ?i) ?\355) ((?' ?o) ?\363) ((?' ?u) ?\372) ((?' ?c) ?\347) 88 (?` (?A . ?\300) (?E . ?\310) (?a . ?\340) (?e . ?\350) (?\ . ?`))
90 ((?' ? ) ?') ((?` ?A) ?\300) ((?` ?E) ?\310) ((?` ?a) ?\340) 89 (?^ (?A . ?\302) (?E . ?\312) (?I . ?\316) (?O . ?\324) (?U . ?\333)
91 ((?` ?e) ?\350) ((?` ? ) ?`) ((?^ ?A) ?\302) ((?^ ?E) ?\312) 90 (?a . ?\342) (?e . ?\352) (?i . ?\356) (?o . ?\364) (?u . ?\373)
92 ((?^ ?I) ?\316) ((?^ ?O) ?\324) ((?^ ?U) ?\333) ((?^ ?a) ?\342) 91 (?\ . ?^))
93 ((?^ ?e) ?\352) ((?^ ?i) ?\356) ((?^ ?o) ?\364) ((?^ ?u) ?\373) 92 (?\" (?U . ?\334) (?u . ?\374) (?\ . ?\"))
94 ((?^ ? ) ?^) ((?\" ?U) ?\334) ((?\" ?u) ?\374) ((?\" ? ) ?\") 93 (?\~ (?A . ?\303) (?O . ?\325) (?a . ?\343) (?o . ?\365) (?\ . ?\~)))
95 ((?\~ ?A) ?\303) ((?\~ ?O) ?\325) ((?\~ ?a) ?\343) ((?\~ ?o) ?\365) 94
96 ((?\~ ?\ ) ?\~)))
97 ("latin-2" 95 ("latin-2"
98 (?' ?` ?^ ?\" ?~) 96 (?' (?A . ?\301) (?C . ?\306) (?D . ?\320) (?E . ?\311) (?I . ?\315)
99 (((?' ?A) ?\301) 97 (?L . ?\305) (?N . ?\321) (?O . ?\323) (?R . ?\300) (?S . ?\246)
100 ((?' ?C) ?\306) 98 (?U . ?\332) (?Y . ?\335) (?Z . ?\254) (?a . ?\341) (?c . ?\346)
101 ((?' ?D) ?\320) 99 (?d . ?\360) (?e . ?\351) (?i . ?\355) (?l . ?\345) (?n . ?\361)
102 ((?' ?E) ?\311) 100 (?o . ?\363) (?r . ?\340) (?s . ?\266) (?u . ?\372) (?y . ?\375)
103 ((?' ?I) ?\315) 101 (?z . ?\274) (?' . ?\264) (?\ . ?'))
104 ((?' ?L) ?\305) 102 (?` (?A . ?\241) (?C . ?\307) (?E . ?\312) (?L . ?\243) (?S . ?\252)
105 ((?' ?N) ?\321) 103 (?T . ?\336) (?Z . ?\257) (?a . ?\261) (?l . ?\263) (?c . ?\347)
106 ((?' ?O) ?\323) 104 (?e . ?\352) (?s . ?\272) (?t . ?\376) (?z . ?\277) (?` . ?\252)
107 ((?' ?R) ?\300) 105 (?. . ?\377) (?\ . ?`))
108 ((?' ?S) ?\246) 106 (?^ (?A . ?\302) (?O . ?\324) (?a . ?\342) (?o . ?\364)
109 ((?' ?U) ?\332) 107 (?^ . ?^) ; no special code?
110 ((?' ?Y) ?\335) 108 (?\ . ?^))
111 ((?' ?Z) ?\254) 109 (?\" (?A . ?\304) (?E . ?\313) (?O . ?\326) (?U . ?\334) (?a . ?\344)
112 ((?' ?a) ?\341) 110 (?e . ?\353) (?o . ?\366) (?s . ?\337) (?u . ?\374) (?\" . ?\250)
113 ((?' ?c) ?\346) 111 (?\ . ?\"))
114 ((?' ?d) ?\360) 112 (?\~ (?A . ?\303) (?C . ?\310) (?D . ?\317) (?L . ?\245) (?N . ?\322)
115 ((?' ?e) ?\351) 113 (?O . ?\325) (?R . ?\330) (?S . ?\251) (?T . ?\253) (?U . ?\333)
116 ((?' ?i) ?\355) 114 (?Z . ?\256) (?a . ?\323) (?c . ?\350) (?d . ?\357) (?l . ?\265)
117 ((?' ?l) ?\345) 115 (?n . ?\362) (?o . ?\365) (?r . ?\370) (?s . ?\271) (?t . ?\273)
118 ((?' ?n) ?\361) 116 (?u . ?\373) (?z . ?\276)
119 ((?' ?o) ?\363) 117 (?v . ?\242) ; v accent
120 ((?' ?r) ?\340) 118 (?\~ . ?\242) ; v accent
121 ((?' ?s) ?\266) 119 (?\. . ?\270) ; cedilla accent
122 ((?' ?u) ?\372) 120 (?\ . ?\~)))
123 ((?' ?y) ?\375) 121
124 ((?' ?z) ?\274)
125 ((?' ?') ?\264)
126 ((?' ? ) ?')
127 ((?` ?A) ?\241)
128 ((?` ?C) ?\307)
129 ((?` ?E) ?\312)
130 ((?` ?L) ?\243)
131 ((?` ?S) ?\252)
132 ((?` ?T) ?\336)
133 ((?` ?Z) ?\257)
134 ((?` ?a) ?\261)
135 ((?` ?l) ?\263)
136 ((?` ?c) ?\347)
137 ((?` ?e) ?\352)
138 ((?` ?s) ?\272)
139 ((?` ?t) ?\376)
140 ((?` ?z) ?\277)
141 ((?` ? ) ?`)
142 ((?` ?`) ?\252)
143 ((?` ?.) ?\377)
144 ((?^ ?A) ?\302)
145 ((?^ ?O) ?\324)
146 ((?^ ?a) ?\342)
147 ((?^ ?o) ?\364)
148 ((?^ ? ) ?^)
149 ((?^ ?^) ?^) ; no special code?
150 ((?\" ?A) ?\304)
151 ((?\" ?E) ?\313)
152 ((?\" ?O) ?\326)
153 ((?\" ?U) ?\334)
154 ((?\" ?a) ?\344)
155 ((?\" ?e) ?\353)
156 ((?\" ?o) ?\366)
157 ((?\" ?s) ?\337)
158 ((?\" ?u) ?\374)
159 ((?\" ? ) ?\")
160 ((?\" ?\") ?\250)
161 ((?\~ ?A) ?\303)
162 ((?\~ ?C) ?\310)
163 ((?\~ ?D) ?\317)
164 ((?\~ ?L) ?\245)
165 ((?\~ ?N) ?\322)
166 ((?\~ ?O) ?\325)
167 ((?\~ ?R) ?\330)
168 ((?\~ ?S) ?\251)
169 ((?\~ ?T) ?\253)
170 ((?\~ ?U) ?\333)
171 ((?\~ ?Z) ?\256)
172 ((?\~ ?a) ?\323)
173 ((?\~ ?c) ?\350)
174 ((?\~ ?d) ?\357)
175 ((?\~ ?l) ?\265)
176 ((?\~ ?n) ?\362)
177 ((?\~ ?o) ?\365)
178 ((?\~ ?r) ?\370)
179 ((?\~ ?s) ?\271)
180 ((?\~ ?t) ?\273)
181 ((?\~ ?u) ?\373)
182 ((?\~ ?z) ?\276)
183 ((?\~ ?\ ) ?\~)
184 ((?\~ ?v) ?\242);; v accent
185 ((?\~ ?\~) ?\242);; v accent
186 ((?\~ ?\.) ?\270);; cedilla accent
187 ))
188 ("latin-1" 122 ("latin-1"
189 (?' ?` ?^ ?\" ?~ ?/) 123 (?' (?A . ?\301) (?E . ?\311) (?I . ?\315) (?O . ?\323) (?U . ?\332)
190 (((?' ?A) ?\301) ((?' ?E) ?\311) ((?' ?I) ?\315) ((?' ?O) ?\323) 124 (?Y . ?\335) (?a . ?\341) (?e . ?\351) (?i . ?\355) (?o . ?\363)
191 ((?' ?U) ?\332) ((?' ?Y) ?\335) ((?' ?a) ?\341) ((?' ?e) ?\351) 125 (?u . ?\372) (?y . ?\375) (?' . ?\264) (?\ . ?'))
192 ((?' ?i) ?\355) ((?' ?o) ?\363) ((?' ?u) ?\372) ((?' ?y) ?\375) 126 (?` (?A . ?\300) (?E . ?\310) (?I . ?\314) (?O . ?\322) (?U . ?\331)
193 ((?' ?') ?\264) ((?' ? ) ?') ((?` ?A) ?\300) ((?` ?E) ?\310) 127 (?a . ?\340) (?e . ?\350) (?i . ?\354) (?o . ?\362) (?u . ?\371)
194 ((?` ?I) ?\314) ((?` ?O) ?\322) ((?` ?U) ?\331) ((?` ?a) ?\340) 128 (?` . ?`) (?\ . ?`))
195 ((?` ?e) ?\350) ((?` ?i) ?\354) ((?` ?o) ?\362) ((?` ?u) ?\371) 129 (?^ (?A . ?\302) (?E . ?\312) (?I . ?\316) (?O . ?\324) (?U . ?\333)
196 ((?` ? ) ?`) ((?` ?`) ?`) ((?^ ?A) ?\302) ((?^ ?E) ?\312) 130 (?a . ?\342) (?e . ?\352) (?i . ?\356) (?o . ?\364) (?u . ?\373)
197 ((?^ ?I) ?\316) ((?^ ?O) ?\324) ((?^ ?U) ?\333) ((?^ ?a) ?\342) 131 (?^ . ?^) (?\ . ?^))
198 ((?^ ?e) ?\352) ((?^ ?i) ?\356) ((?^ ?o) ?\364) ((?^ ?u) ?\373) 132 (?\" (?A . ?\304) (?E . ?\313) (?I . ?\317) (?O . ?\326) (?U . ?\334)
199 ((?^ ? ) ?^) ((?^ ?^) ?^) ((?\" ?A) ?\304) ((?\" ?E) ?\313) 133 (?a . ?\344) (?e . ?\353) (?i . ?\357) (?o . ?\366) (?s . ?\337)
200 ((?\" ?I) ?\317) ((?\" ?O) ?\326) ((?\" ?U) ?\334) ((?\" ?a) ?\344) 134 (?u . ?\374) (?y . ?\377) (?\" . ?\250) (?\ . ?\"))
201 ((?\" ?e) ?\353) ((?\" ?i) ?\357) ((?\" ?o) ?\366) ((?\" ?s) ?\337) 135 (?\~ (?A . ?\303) (?C . ?\307) (?D . ?\320) (?N . ?\321) (?O . ?\325)
202 ((?\" ?u) ?\374) ((?\" ?y) ?\377) ((?\" ? ) ?\") ((?\" ?\") ?\250) 136 (?T . ?\336) (?a . ?\343) (?c . ?\347) (?d . ?\360) (?n . ?\361)
203 ((?\~ ?A) ?\303) ((?\~ ?C) ?\307) ((?\~ ?D) ?\320) ((?\~ ?N) ?\321) 137 (?o . ?\365) (?t . ?\376) (?> . ?\273) (?< . ?\253) (?\~ . ?\270)
204 ((?\~ ?O) ?\325) ((?\~ ?T) ?\336) ((?\~ ?a) ?\343) ((?\~ ?c) ?\347) 138 (?\ . ?\~))
205 ((?\~ ?d) ?\360) ((?\~ ?n) ?\361) ((?\~ ?o) ?\365) ((?\~ ?t) ?\376) 139 (?\/ (?A . ?\305) (?E . ?\306) (?O . ?\330) (?a . ?\345) (?e . ?\346)
206 ((?\~ ?>) ?\273) ((?\~ ?<) ?\253) ((?\~ ?\ ) ?\~) ((?\~ ?\~) ?\270) 140 (?o . ?\370) (?\/ . ?\260) (?\ . ?\/))))
207 ((?\/ ?A) ?\305) ((?\/ ?E) ?\306) ((?\/ ?O) ?\330) ((?\/ ?a) ?\345)
208 ((?\/ ?e) ?\346) ((?\/ ?o) ?\370) ((?\/ ?\ ) ?\/) ((?\/ ?\/) ?\260))))
209 "List of language-specific customizations for the ISO Accents mode. 141 "List of language-specific customizations for the ISO Accents mode.
210 142
211Each element of the list is of the form (LANGUAGE PREFIXES LIST). 143Each element of the list is of the form
212 144
213LANGUAGE is a string naming the language. 145 (LANGUAGE
146 (PSEUDO-ACCENT MAPPINGS)
147 (PSEUDO-ACCENT MAPPINGS)
148 ...)
214 149
215PREFIXES is a list of characters that will be used as accent prefixes. 150LANGUAGE is a string naming the language.
216It is currently not used. 151PSEUDO-ACCENT is a char specifying an accent key.
152MAPPINGS are cons cells of the form (CHAR . ISO-CHAR).
217 153
218LIST is a list of accent translations. It will be the value of the 154The net effect is that the key sequence PSEUDO-ACCENT CHAR is mapped
219`iso-accents-list' variable.") 155to ISO-CHAR on input.")
220 156
221(defvar iso-language nil 157(defvar iso-language nil
222 "Language for which ISO Accents mode is currently customized. 158 "Language for which ISO Accents mode is currently customized.
@@ -249,20 +185,9 @@ the language you choose).")
249 (iso-accents-compose prompt) 185 (iso-accents-compose prompt)
250 (char-to-string last-input-char))) 186 (char-to-string last-input-char)))
251 187
252(defun iso-accents-compose-key (prompt)
253 "Modify the following character by adding an accent to it."
254 ;; Pick up the accent character.
255 (let ((combined (iso-accents-compose prompt)))
256 (if unread-command-events
257 (let ((unread unread-command-events))
258 (setq unread-command-events nil)
259 (error "Characters %s and %s cannot be composed"
260 (single-key-description (aref combined 0))
261 (single-key-description (car unread)))))
262 combined))
263
264(defun iso-accents-compose (prompt) 188(defun iso-accents-compose (prompt)
265 (let* ((first-char last-input-char) 189 (let* ((first-char last-input-char)
190 (list (assq first-char iso-accents-list))
266 ;; Wait for the second key and look up the combination. 191 ;; Wait for the second key and look up the combination.
267 (second-char (if (or prompt 192 (second-char (if (or prompt
268 (not (eq (key-binding "a") 193 (not (eq (key-binding "a")
@@ -277,10 +202,10 @@ the language you choose).")
277 (insert first-char) 202 (insert first-char)
278 (prog1 (read-event) 203 (prog1 (read-event)
279 (delete-region (1- (point)) (point))))) 204 (delete-region (1- (point)) (point)))))
280 (entry (assoc (list first-char second-char) iso-accents-list))) 205 (entry (cdr (assq second-char list))))
281 (if entry 206 (if entry
282 ;; Found it: delete the first character and insert the combination. 207 ;; Found it: return the mapped char
283 (concat (list (nth 1 entry))) 208 (vector entry)
284 ;; Otherwise, advance and schedule the second key for execution. 209 ;; Otherwise, advance and schedule the second key for execution.
285 (setq unread-command-events (list second-char)) 210 (setq unread-command-events (list second-char))
286 (vector first-char)))) 211 (vector first-char))))
@@ -337,24 +262,18 @@ It selects the customization based on the specifications in the
337 (let ((table (assoc language iso-languages)) 262 (let ((table (assoc language iso-languages))
338 all-accents tail) 263 all-accents tail)
339 (if (not table) 264 (if (not table)
340 (error "Unknown language") 265 (error "Unknown language '%s'" language)
341 (setq iso-language language) 266 (setq iso-language language
342 (setq iso-accents-list (car (cdr (cdr table)))) 267 iso-accents-list (cdr table))
343 (if key-translation-map 268 (if key-translation-map
344 (substitute-key-definition 269 (substitute-key-definition
345 'iso-accents-accent-key nil key-translation-map) 270 'iso-accents-accent-key nil key-translation-map)
346 (setq key-translation-map (make-sparse-keymap))) 271 (setq key-translation-map (make-sparse-keymap)))
347 ;; Find all the characters that are used as accent prefixes 272 ;; Set up translations for all the characters that are used as
348 ;; in this language, and set up translation for them. 273 ;; accent prefixes in this language.
349 (setq tail iso-accents-list) 274 (setq tail iso-accents-list)
350 (while tail 275 (while tail
351 (let ((acc (car (car (car tail))))) 276 (define-key key-translation-map (vector (car (car tail)))
352 (or (memq acc all-accents)
353 (setq all-accents (cons acc all-accents))))
354 (setq tail (cdr tail)))
355 (setq tail all-accents)
356 (while tail
357 (define-key key-translation-map (char-to-string (car tail))
358 'iso-accents-accent-key) 277 'iso-accents-accent-key)
359 (setq tail (cdr tail)))))) 278 (setq tail (cdr tail))))))
360 279
@@ -371,24 +290,22 @@ This uses the same conversion that ISO Accents mode uses for type-in."
371 (let (entry) 290 (let (entry)
372 (while (< (point) end) 291 (while (< (point) end)
373 (if (and (memq (preceding-char) iso-accents-enable) 292 (if (and (memq (preceding-char) iso-accents-enable)
374 (<= ?A (following-char)) 293 (setq entry (cdr (assq (following-char) (assq (preceding-char) iso-accents-list)))))
375 (<= (following-char) ?z)
376 (setq entry (assoc (list (preceding-char) (following-char))
377 iso-accents-list)))
378 (progn 294 (progn
379 (forward-char -1) 295 (forward-char -1)
380 (delete-char 2) 296 (delete-char 2)
381 (insert (car (cdr entry))) 297 (insert entry)
382 (setq end (1- end))) 298 (setq end (1- end)))
383 (forward-char 1))))))) 299 (forward-char 1)))))))
384 300
385(defun iso-accent-rassoc-unit (value alist) 301(defun iso-accent-rassoc-unit (value alist)
386 (while (and alist 302 (let (elt acc)
387 (not (eq (car (cdr (car alist))) value))) 303 (while (and alist (not elt))
388 (setq alist (cdr alist))) 304 (setq acc (car (car alist))
389 (if alist 305 elt (car (rassq value (cdr (car alist))))
390 (car alist) 306 alist (cdr alist)))
391 nil)) 307 (if elt
308 (cons acc elt))))
392 309
393(defun iso-unaccentuate (start end) 310(defun iso-unaccentuate (start end)
394 "Convert accented characters in the region into two-character sequences. 311 "Convert accented characters in the region into two-character sequences.
@@ -406,7 +323,7 @@ This uses the opposite of the conversion done by ISO Accents mode for type-in."
406 iso-accents-list))) 323 iso-accents-list)))
407 (progn 324 (progn
408 (delete-char 1) 325 (delete-char 1)
409 (insert (car (car entry)) (car (cdr (car entry)))) 326 (insert (car entry) (cdr entry))
410 (setq end (1+ end))) 327 (setq end (1+ end)))
411 (forward-char 1))))))) 328 (forward-char 1)))))))
412 329
@@ -425,7 +342,7 @@ Noninteractively, this operates on text from START to END."
425 iso-accents-list))) 342 iso-accents-list)))
426 (progn 343 (progn
427 (delete-char 1) 344 (delete-char 1)
428 (insert (car (cdr (car entry))))) 345 (insert (cdr entry)))
429 (forward-char 1))))))) 346 (forward-char 1)))))))
430 347
431;; Set up the default settings. 348;; Set up the default settings.