comparison lisp/international/iso-acc.el @ 17715:599ab8f1aa84

(iso-languages): Add charset spec to some elements. (iso-accents-compose): Add iso-accents-insert-offset to the code. (iso-accents-insert-offset): New variable. (iso-accents-customize): Set iso-accents-insert-offset according to data from iso-languages.
author Richard M. Stallman <rms@gnu.org>
date Sat, 10 May 1997 01:43:18 +0000
parents 1240e27fbb13
children bef751068f42
comparison
equal deleted inserted replaced
17714:80330736ac67 17715:599ab8f1aa84
61 ;; that you want, then select the language with `iso-accents-customize'. 61 ;; that you want, then select the language with `iso-accents-customize'.
62 62
63 ;;; Code: 63 ;;; Code:
64 64
65 (provide 'iso-acc) 65 (provide 'iso-acc)
66
67 (defvar iso-accents-insert-offset quoted-insert-character-offset
68 "*Offset added by ISO Accents mode to character codes 0200 and above.")
66 69
67 (defvar iso-languages 70 (defvar iso-languages
68 '(("catalan" 71 '(("catalan"
69 ;; Note this includes some extra characters used in Spanish, 72 ;; Note this includes some extra characters used in Spanish,
70 ;; on the idea that someone who uses Catalan is likely to use Spanish 73 ;; on the idea that someone who uses Catalan is likely to use Spanish
124 (?! . ?\241) (?? . ?\277) 127 (?! . ?\241) (?? . ?\277)
125 (?\ . ?\~)) 128 (?\ . ?\~))
126 (?\/ (?A . ?\305) (?E . ?\306) (?O . ?\330) (?a . ?\345) (?e . ?\346) 129 (?\/ (?A . ?\305) (?E . ?\306) (?O . ?\330) (?a . ?\345) (?e . ?\346)
127 (?o . ?\370) (?\/ . ?\260) (?\ . ?\/))) 130 (?o . ?\370) (?\/ . ?\260) (?\ . ?\/)))
128 131
129 ("latin-2" 132 ("latin-2" latin-iso8859-2
130 (?' (?A . ?\301) (?C . ?\306) (?D . ?\320) (?E . ?\311) (?I . ?\315) 133 (?' (?A . ?\301) (?C . ?\306) (?D . ?\320) (?E . ?\311) (?I . ?\315)
131 (?L . ?\305) (?N . ?\321) (?O . ?\323) (?R . ?\300) (?S . ?\246) 134 (?L . ?\305) (?N . ?\321) (?O . ?\323) (?R . ?\300) (?S . ?\246)
132 (?U . ?\332) (?Y . ?\335) (?Z . ?\254) (?a . ?\341) (?c . ?\346) 135 (?U . ?\332) (?Y . ?\335) (?Z . ?\254) (?a . ?\341) (?c . ?\346)
133 (?d . ?\360) (?e . ?\351) (?i . ?\355) (?l . ?\345) (?n . ?\361) 136 (?d . ?\360) (?e . ?\351) (?i . ?\355) (?l . ?\345) (?n . ?\361)
134 (?o . ?\363) (?r . ?\340) (?s . ?\266) (?u . ?\372) (?y . ?\375) 137 (?o . ?\363) (?r . ?\340) (?s . ?\266) (?u . ?\372) (?y . ?\375)
151 (?v . ?\242) ; v accent 154 (?v . ?\242) ; v accent
152 (?\~ . ?\242) ; v accent 155 (?\~ . ?\242) ; v accent
153 (?\. . ?\270) ; cedilla accent 156 (?\. . ?\270) ; cedilla accent
154 (?\ . ?\~))) 157 (?\ . ?\~)))
155 158
156 ("latin-3" 159 ("latin-3" latin-iso8859-3
157 (?' (?A . ?\301) (?E . ?\311) (?I . ?\315) (?O . ?\323) (?U . ?\332) 160 (?' (?A . ?\301) (?E . ?\311) (?I . ?\315) (?O . ?\323) (?U . ?\332)
158 (?a . ?\341) (?e . ?\351) (?i . ?\355) (?o . ?\363) (?u . ?\372) 161 (?a . ?\341) (?e . ?\351) (?i . ?\355) (?o . ?\363) (?u . ?\372)
159 (?' . ?\264) (?\ . ?')) 162 (?' . ?\264) (?\ . ?'))
160 (?` (?A . ?\300) (?E . ?\310) (?I . ?\314) (?O . ?\322) (?U . ?\331) 163 (?` (?A . ?\300) (?E . ?\310) (?I . ?\314) (?O . ?\322) (?U . ?\331)
161 (?a . ?\340) (?e . ?\350) (?i . ?\354) (?o . ?\362) (?u . ?\371) 164 (?a . ?\340) (?e . ?\350) (?i . ?\354) (?o . ?\362) (?u . ?\371)
196 (?? . ?\277) (?\ . ?\~)))) 199 (?? . ?\277) (?\ . ?\~))))
197 "List of language-specific customizations for the ISO Accents mode. 200 "List of language-specific customizations for the ISO Accents mode.
198 201
199 Each element of the list is of the form 202 Each element of the list is of the form
200 203
201 (LANGUAGE 204 (LANGUAGE [CHARSET]
202 (PSEUDO-ACCENT MAPPINGS) 205 (PSEUDO-ACCENT MAPPINGS)
203 (PSEUDO-ACCENT MAPPINGS) 206 (PSEUDO-ACCENT MAPPINGS)
204 ...) 207 ...)
205 208
206 LANGUAGE is a string naming the language. 209 LANGUAGE is a string naming the language.
210 CHARSET (which may be omitted) is the symbol name
211 of the character set used in this language.
212 If CHARSET is omitted, latin-iso8859-1 is the default.
207 PSEUDO-ACCENT is a char specifying an accent key. 213 PSEUDO-ACCENT is a char specifying an accent key.
208 MAPPINGS are cons cells of the form (CHAR . ISO-CHAR). 214 MAPPINGS are cons cells of the form (CHAR . ISO-CHAR).
209 215
210 The net effect is that the key sequence PSEUDO-ACCENT CHAR is mapped 216 The net effect is that the key sequence PSEUDO-ACCENT CHAR is mapped
211 to ISO-CHAR on input.") 217 to ISO-CHAR on input.")
261 (prog1 (read-event) 267 (prog1 (read-event)
262 (delete-region (1- (point)) (point))))) 268 (delete-region (1- (point)) (point)))))
263 (entry (cdr (assq second-char list)))) 269 (entry (cdr (assq second-char list))))
264 (if entry 270 (if entry
265 ;; Found it: return the mapped char 271 ;; Found it: return the mapped char
266 (vector entry) 272 (if (and enable-multibyte-characters
273 (>= entry ?\200))
274 (let ((char (+ iso-accents-insert-offset entry)))
275 (setq unread-command-events
276 (cons (list char) unread-command-events))
277 (vector ?\C-q))
278 (vector entry))
267 ;; Otherwise, advance and schedule the second key for execution. 279 ;; Otherwise, advance and schedule the second key for execution.
268 (setq unread-command-events 280 (setq unread-command-events
269 (cons (list second-char) unread-command-events)) 281 (cons (list second-char) unread-command-events))
270 (vector first-char)))) 282 (vector first-char))))
271 283
316 (defun iso-accents-customize (language) 328 (defun iso-accents-customize (language)
317 "Customize the ISO accents machinery for a particular language. 329 "Customize the ISO accents machinery for a particular language.
318 It selects the customization based on the specifications in the 330 It selects the customization based on the specifications in the
319 `iso-languages' variable." 331 `iso-languages' variable."
320 (interactive (list (completing-read "Language: " iso-languages nil t))) 332 (interactive (list (completing-read "Language: " iso-languages nil t)))
321 (let ((table (assoc language iso-languages)) 333 (let ((table (cdr (assoc language iso-languages)))
322 all-accents tail) 334 all-accents tail)
323 (if (not table) 335 (if (not table)
324 (error "Unknown language '%s'" language) 336 (error "Unknown language `%s'" language)
337 (setq iso-accents-insert-offset (- (make-char (if (symbolp (car table))
338 (car table)
339 'latin-iso8859-1))
340 128))
341 (if (symbolp (car table))
342 (setq table (cdr table)))
325 (setq iso-language language 343 (setq iso-language language
326 iso-accents-list (cdr table)) 344 iso-accents-list table)
327 (if key-translation-map 345 (if key-translation-map
328 (substitute-key-definition 346 (substitute-key-definition
329 'iso-accents-accent-key nil key-translation-map) 347 'iso-accents-accent-key nil key-translation-map)
330 (setq key-translation-map (make-sparse-keymap))) 348 (setq key-translation-map (make-sparse-keymap)))
331 ;; Set up translations for all the characters that are used as 349 ;; Set up translations for all the characters that are used as