comparison lisp/international/iso-acc.el @ 14115:bc30354daf1f

(iso-accents-accent-key): Check iso-accents-enable here. (iso-accents-customize): Define all possible accent keys with translations, not just the enabled ones. Don't bind iso-accents-enable around the initial call to this function. (iso-accents-enable): Make the default once again include all prefixes.
author Karl Heuer <kwzh@gnu.org>
date Tue, 09 Jan 1996 23:18:40 +0000
parents 15305606a97a
children 83f275dcd93a
comparison
equal deleted inserted replaced
14114:b8c7c891ed63 14115:bc30354daf1f
114 ((?\/ ?A) ?\305) ((?\/ ?E) ?\306) ((?\/ ?O) ?\330) ((?\/ ?a) ?\345) 114 ((?\/ ?A) ?\305) ((?\/ ?E) ?\306) ((?\/ ?O) ?\330) ((?\/ ?a) ?\345)
115 ((?\/ ?e) ?\346) ((?\/ ?o) ?\370) ((?\/ ?\ ) ?\/) ((?\/ ?\/) ?\260)))) 115 ((?\/ ?e) ?\346) ((?\/ ?o) ?\370) ((?\/ ?\ ) ?\/) ((?\/ ?\/) ?\260))))
116 116
117 "List of language-specific customizations for the ISO Accents mode. 117 "List of language-specific customizations for the ISO Accents mode.
118 118
119 Each element of the list is of the form (LANGUAGE ENABLE LIST). 119 Each element of the list is of the form (LANGUAGE PREFIXES LIST).
120 120
121 LANGUAGE is a string naming the language. 121 LANGUAGE is a string naming the language.
122 122
123 ENABLE is a list of characters that will be used as accent prefixes. 123 PREFIXES is a list of characters that will be used as accent prefixes.
124 It will be the value of the `iso-accents-enable' variable 124 It is currently not used.
125 if you select this language.
126 125
127 LIST is a list of accent translations. It will be the value of the 126 LIST is a list of accent translations. It will be the value of the
128 `iso-accents-list' variable.") 127 `iso-accents-list' variable.")
129 128
130 (defvar iso-language nil 129 (defvar iso-language nil
138 "*Non-nil enables ISO Accents mode. 137 "*Non-nil enables ISO Accents mode.
139 Setting this variable makes it local to the current buffer. 138 Setting this variable makes it local to the current buffer.
140 See the function `iso-accents-mode'.") 139 See the function `iso-accents-mode'.")
141 (make-variable-buffer-local 'iso-accents-mode) 140 (make-variable-buffer-local 'iso-accents-mode)
142 141
142 (defvar iso-accents-enable '(?' ?` ?^ ?\" ?~ ?/)
143 "*List of accent keys that become prefixes in ISO Accents mode.
144 The default is (?' ?` ?^ ?\" ?~ ?/), which contains all the supported
145 accent keys. If you set this variable to a list in which some of those
146 characters are missing, the missing ones do not act as accents.
147
148 Note that if you specify a language with `iso-accents-customize',
149 that can also turn off certain prefixes (whichever ones are not needed in
150 the language you choose).")
151
143 (defun iso-accents-accent-key (prompt) 152 (defun iso-accents-accent-key (prompt)
144 "Modify the following character by adding an accent to it." 153 "Modify the following character by adding an accent to it."
145 ;; Pick up the accent character. 154 ;; Pick up the accent character.
146 (if iso-accents-mode 155 (if (and iso-accents-mode
156 (memq last-input-char iso-accents-enable))
147 (iso-accents-compose prompt) 157 (iso-accents-compose prompt)
148 (char-to-string last-input-char))) 158 (char-to-string last-input-char)))
149 159
150 (defun iso-accents-compose-key (prompt) 160 (defun iso-accents-compose-key (prompt)
151 "Modify the following character by adding an accent to it." 161 "Modify the following character by adding an accent to it."
181 (concat (list (nth 1 entry))) 191 (concat (list (nth 1 entry)))
182 ;; Otherwise, advance and schedule the second key for execution. 192 ;; Otherwise, advance and schedule the second key for execution.
183 (setq unread-command-events (list second-char)) 193 (setq unread-command-events (list second-char))
184 (vector first-char)))) 194 (vector first-char))))
185 195
186 (defvar iso-accents-enable nil
187 "*List of accent keys that become prefixes in ISO Accents mode.
188 The default is (?' ?` ?^ ?\" ?~ ?/), which contains all the supported
189 accent keys. For certain languages, it is better to use a subset of
190 the accent characters. Do not set this variable directly;
191 instead, define a language in `iso-languages' and then specify that
192 language with `iso-accents-customize'.")
193
194 ;; It is a matter of taste if you want the minor mode indicated 196 ;; It is a matter of taste if you want the minor mode indicated
195 ;; in the mode line... 197 ;; in the mode line...
196 ;; If so, uncomment the next four lines. 198 ;; If so, uncomment the next four lines.
197 ;; (or (assq 'iso-accents-mode minor-mode-map-alist) 199 ;; (or (assq 'iso-accents-mode minor-mode-map-alist)
198 ;; (setq minor-mode-alist 200 ;; (setq minor-mode-alist
239 "Customize the ISO accents machinery for a particular language. 241 "Customize the ISO accents machinery for a particular language.
240 It selects the customization based on the specifications in the 242 It selects the customization based on the specifications in the
241 `iso-languages' variable." 243 `iso-languages' variable."
242 (interactive (list (completing-read "Language: " iso-languages nil t))) 244 (interactive (list (completing-read "Language: " iso-languages nil t)))
243 (let ((table (assoc language iso-languages)) 245 (let ((table (assoc language iso-languages))
244 c) 246 all-accents tail)
245 (if (not table) 247 (if (not table)
246 (error "Unknown language") 248 (error "Unknown language")
247 (setq iso-language language) 249 (setq iso-language language)
248 (setq iso-accents-enable (car (cdr table)))
249 (setq iso-accents-list (car (cdr (cdr table)))) 250 (setq iso-accents-list (car (cdr (cdr table))))
250 (if key-translation-map 251 (if key-translation-map
251 (substitute-key-definition 252 (substitute-key-definition
252 'iso-accents-accent-key nil key-translation-map) 253 'iso-accents-accent-key nil key-translation-map)
253 (setq key-translation-map (make-sparse-keymap))) 254 (setq key-translation-map (make-sparse-keymap)))
254 (setq c iso-accents-enable) 255 ;; Find all the characters that are used as accent prefixes
255 (while c 256 ;; in this language, and set up translation for them.
256 (define-key 257 (setq tail iso-accents-list)
257 key-translation-map (char-to-string (car c)) 'iso-accents-accent-key) 258 (while tail
258 (setq c (cdr c)))))) 259 (or (memq (car (car tail)) all-accents)
260 (setq all-accents (cons (car (car tail)) all-accents)))
261 (setq tail (cdr tail)))
262 (setq tail all-accents)
263 (while tail
264 (define-key key-translation-map (char-to-string (car tail))
265 'iso-accents-accent-key)
266 (setq tail (cdr tail))))))
259 267
260 (defun iso-accentuate (start end) 268 (defun iso-accentuate (start end)
261 "Convert two-character sequences in region into accented characters. 269 "Convert two-character sequences in region into accented characters.
262 Noninteractively, this operates on text from START to END. 270 Noninteractively, this operates on text from START to END.
263 This uses the same conversion that ISO Accents mode uses for type-in." 271 This uses the same conversion that ISO Accents mode uses for type-in."
325 (progn 333 (progn
326 (delete-char 1) 334 (delete-char 1)
327 (insert (car (cdr (car entry))))) 335 (insert (car (cdr (car entry)))))
328 (forward-char 1))))))) 336 (forward-char 1)))))))
329 337
330 ;; Set up the default settings, but don't override 338 ;; Set up the default settings.
331 ;; iso-accents-enable if the user has already set it. 339 (iso-accents-customize "default")
332 (let ((old iso-accents-enable))
333 (iso-accents-customize "default")
334 (if old
335 (setq iso-accents-enable old)))
336 340
337 ;;; iso-acc.el ends here 341 ;;; iso-acc.el ends here