aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl Heuer1996-01-09 23:18:40 +0000
committerKarl Heuer1996-01-09 23:18:40 +0000
commit9a71dcfd6de8329e96fa0c756f0f3a632286f9f1 (patch)
tree254c94117714b29cbe5029cab2b8aad2ddc11abc
parentfc0ac20de08a3364e00752ec828e8dc2f5cc066b (diff)
downloademacs-9a71dcfd6de8329e96fa0c756f0f3a632286f9f1.tar.gz
emacs-9a71dcfd6de8329e96fa0c756f0f3a632286f9f1.zip
(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.
-rw-r--r--lisp/international/iso-acc.el56
1 files changed, 30 insertions, 26 deletions
diff --git a/lisp/international/iso-acc.el b/lisp/international/iso-acc.el
index c6b254597ce..2f1a3049fc2 100644
--- a/lisp/international/iso-acc.el
+++ b/lisp/international/iso-acc.el
@@ -116,13 +116,12 @@
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
119Each element of the list is of the form (LANGUAGE ENABLE LIST). 119Each element of the list is of the form (LANGUAGE PREFIXES LIST).
120 120
121LANGUAGE is a string naming the language. 121LANGUAGE is a string naming the language.
122 122
123ENABLE is a list of characters that will be used as accent prefixes. 123PREFIXES is a list of characters that will be used as accent prefixes.
124It will be the value of the `iso-accents-enable' variable 124It is currently not used.
125if you select this language.
126 125
127LIST is a list of accent translations. It will be the value of the 126LIST is a list of accent translations. It will be the value of the
128`iso-accents-list' variable.") 127`iso-accents-list' variable.")
@@ -140,10 +139,21 @@ Setting this variable makes it local to the current buffer.
140See the function `iso-accents-mode'.") 139See 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.
144The default is (?' ?` ?^ ?\" ?~ ?/), which contains all the supported
145accent keys. If you set this variable to a list in which some of those
146characters are missing, the missing ones do not act as accents.
147
148Note that if you specify a language with `iso-accents-customize',
149that can also turn off certain prefixes (whichever ones are not needed in
150the 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
@@ -183,14 +193,6 @@ See the function `iso-accents-mode'.")
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.
188The default is (?' ?` ?^ ?\" ?~ ?/), which contains all the supported
189accent keys. For certain languages, it is better to use a subset of
190the accent characters. Do not set this variable directly;
191instead, define a language in `iso-languages' and then specify that
192language 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.
@@ -241,21 +243,27 @@ 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.
@@ -327,11 +335,7 @@ Noninteractively, this operates on text from START to END."
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