annotate lisp/international/iso-acc.el @ 13108:04466bd88580

(Vsuggest_key_bindings): New variable. (syms_of_keyboard): Set up Lisp variable. (Fexecute_extended_command): When enabled, show an equivalent key binding.
author Richard M. Stallman <rms@gnu.org>
date Tue, 03 Oct 1995 09:17:37 +0000
parents abe3fc783a45
children b37ba01d6e27
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4720
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1 ;;; iso-acc.el -- minor mode providing electric accent keys
7300
cc7cd83ccf3f Update copyright.
Karl Heuer <kwzh@gnu.org>
parents: 6421
diff changeset
2 ;;; Copyright (C) 1993, 1994 Free Software Foundation, Inc.
4720
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4 ;; Author: Johan Vromans <jv@mh.nl>
5040
34ce5cc32eb8 (iso-accents-list): Added /A for A-with-ring
Richard M. Stallman <rms@gnu.org>
parents: 4924
diff changeset
5 ;; Version: 1.7 (modified)
4921
e96cc77d9a7c Support ~ and /. Support 'Y, 'y, "y.
Richard M. Stallman <rms@gnu.org>
parents: 4877
diff changeset
6 ;; Maintainer: FSF
e96cc77d9a7c Support ~ and /. Support 'Y, 'y, "y.
Richard M. Stallman <rms@gnu.org>
parents: 4877
diff changeset
7 ;; Keywords: i18n
4720
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14 ;; any later version.
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19 ;; GNU General Public License for more details.
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25 ;;; Commentary:
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26
9740
ba689bf126fb (iso-accents-mode): Variable renamed from iso-accents-minor-mode.
Richard M. Stallman <rms@gnu.org>
parents: 7300
diff changeset
27 ;; Function `iso-accents-mode' activates a minor mode in which
ba689bf126fb (iso-accents-mode): Variable renamed from iso-accents-minor-mode.
Richard M. Stallman <rms@gnu.org>
parents: 7300
diff changeset
28 ;; typewriter "dead keys" are emulated. The purpose of this emulation
ba689bf126fb (iso-accents-mode): Variable renamed from iso-accents-minor-mode.
Richard M. Stallman <rms@gnu.org>
parents: 7300
diff changeset
29 ;; is to provide a simple means for inserting accented characters
ba689bf126fb (iso-accents-mode): Variable renamed from iso-accents-minor-mode.
Richard M. Stallman <rms@gnu.org>
parents: 7300
diff changeset
30 ;; according to the ISO-8859-1 character set.
4720
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31 ;;
9740
ba689bf126fb (iso-accents-mode): Variable renamed from iso-accents-minor-mode.
Richard M. Stallman <rms@gnu.org>
parents: 7300
diff changeset
32 ;; In `iso-accents-mode', pseudo accent characters are used to
10599
bbf3a30a4d39 (iso-accents-list): Add Icelandic thorn.
Karl Heuer <kwzh@gnu.org>
parents: 9740
diff changeset
33 ;; introduce accented keys. The pseudo-accent characters are:
4720
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34 ;;
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35 ;; ' (minute) -> grave accent
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
36 ;; ` (backtick) -> acute accent
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37 ;; " (second) -> diaeresis
4921
e96cc77d9a7c Support ~ and /. Support 'Y, 'y, "y.
Richard M. Stallman <rms@gnu.org>
parents: 4877
diff changeset
38 ;; ^ (caret) -> circumflex
e96cc77d9a7c Support ~ and /. Support 'Y, 'y, "y.
Richard M. Stallman <rms@gnu.org>
parents: 4877
diff changeset
39 ;; ~ (tilde) -> tilde over the character
e96cc77d9a7c Support ~ and /. Support 'Y, 'y, "y.
Richard M. Stallman <rms@gnu.org>
parents: 4877
diff changeset
40 ;; / (slash) -> slash through the character.
5040
34ce5cc32eb8 (iso-accents-list): Added /A for A-with-ring
Richard M. Stallman <rms@gnu.org>
parents: 4924
diff changeset
41 ;; Also: /A is A-with-ring and /E is AE ligature.
4720
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
42 ;;
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
43 ;; The action taken depends on the key that follows the pseudo accent.
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
44 ;; In general:
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
45 ;;
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
46 ;; pseudo-accent + appropriate letter -> accented letter
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
47 ;; pseudo-accent + space -> pseudo-accent
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
48 ;; pseudo-accent + pseudo-accent -> accent (if available)
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
49 ;; pseudo-accent + other -> pseudo-accent + other
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
50 ;;
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51 ;; If the pseudo-accent is followed by anything else than a
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
52 ;; self-insert-command, the dead-key code is terminated, the
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
53 ;; pseudo-accent inserted 'as is' and the bell is rung to signal this.
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
54 ;;
4721
d34c02ddea9f Fix lots of doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 4720
diff changeset
55 ;; Function `iso-accents-mode' can be used to enable the iso accents
d34c02ddea9f Fix lots of doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 4720
diff changeset
56 ;; minor mode, or disable it.
5101
c95efc1cf15b (iso-accents-enable): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 5060
diff changeset
57
c95efc1cf15b (iso-accents-enable): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 5060
diff changeset
58 ;; If you want only some of these characters to serve as accents,
c95efc1cf15b (iso-accents-enable): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 5060
diff changeset
59 ;; set iso-accents-enable to the list of characters that should be special.
4720
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
60
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
61 ;;; Code:
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
62
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
63 (provide 'iso-acc)
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
64
12728
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
65 (defvar iso-languages
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
66 '(("portuguese"
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
67 (?' ?` ?^ ?\" ?~)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
68 (((?' ?A) ?\301) ((?' ?E) ?\311) ((?' ?I) ?\315) ((?' ?O) ?\323)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
69 ((?' ?U) ?\332) ((?' ?C) ?\307) ((?' ?a) ?\341) ((?' ?e) ?\351)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
70 ((?' ?i) ?\355) ((?' ?o) ?\363) ((?' ?u) ?\372) ((?' ?c) ?\347)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
71 ((?' ? ) ?') ((?` ?A) ?\300) ((?` ?a) ?\340) ((?` ? ) ?`)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
72 ((?^ ?A) ?\302) ((?^ ?E) ?\312) ((?^ ?O) ?\324) ((?^ ?a) ?\342)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
73 ((?^ ?e) ?\352) ((?^ ?o) ?\364) ((?^ ? ) ?^) ((?\" ?U) ?\334)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
74 ((?\" ?u) ?\374) ((?\" ? ) ?\") ((?\~ ?A) ?\303) ((?\~ ?O) ?\325)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
75 ((?\~ ?a) ?\343) ((?\~ ?o) ?\365) ((?\~ ?\ ) ?\~)))
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
76 ("french"
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
77 (?' ?` ?^ ?\" ?~)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
78 (((?' ?A) ?\301) ((?' ?E) ?\311) ((?' ?I) ?\315) ((?' ?O) ?\323)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
79 ((?' ?U) ?\332) ((?' ?C) ?\307) ((?' ?a) ?\341) ((?' ?e) ?\351)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
80 ((?' ?i) ?\355) ((?' ?o) ?\363) ((?' ?u) ?\372) ((?' ?c) ?\347)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
81 ((?' ? ) ?') ((?` ?A) ?\300) ((?` ?E) ?\310) ((?` ?a) ?\340)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
82 ((?` ?e) ?\350) ((?` ? ) ?`) ((?^ ?A) ?\302) ((?^ ?E) ?\312)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
83 ((?^ ?I) ?\316) ((?^ ?O) ?\324) ((?^ ?U) ?\333) ((?^ ?a) ?\342)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
84 ((?^ ?e) ?\352) ((?^ ?i) ?\356) ((?^ ?o) ?\364) ((?^ ?u) ?\373)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
85 ((?^ ? ) ?^) ((?\" ?U) ?\334) ((?\" ?u) ?\374) ((?\" ? ) ?\")
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
86 ((?\~ ?A) ?\303) ((?\~ ?O) ?\325) ((?\~ ?a) ?\343) ((?\~ ?o) ?\365)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
87 ((?\~ ?\ ) ?\~)))
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
88 ("default"
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
89 (?' ?` ?^ ?\" ?~ ?/)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
90 (((?' ?A) ?\301) ((?' ?E) ?\311) ((?' ?I) ?\315) ((?' ?O) ?\323)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
91 ((?' ?U) ?\332) ((?' ?Y) ?\335) ((?' ?a) ?\341) ((?' ?e) ?\351)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
92 ((?' ?i) ?\355) ((?' ?o) ?\363) ((?' ?u) ?\372) ((?' ?y) ?\375)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
93 ((?' ?') ?\264) ((?' ? ) ?') ((?` ?A) ?\300) ((?` ?E) ?\310)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
94 ((?` ?I) ?\314) ((?` ?O) ?\322) ((?` ?U) ?\331) ((?` ?a) ?\340)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
95 ((?` ?e) ?\350) ((?` ?i) ?\354) ((?` ?o) ?\362) ((?` ?u) ?\371)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
96 ((?` ? ) ?`) ((?` ?`) ?`) ((?^ ?A) ?\302) ((?^ ?E) ?\312)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
97 ((?^ ?I) ?\316) ((?^ ?O) ?\324) ((?^ ?U) ?\333) ((?^ ?a) ?\342)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
98 ((?^ ?e) ?\352) ((?^ ?i) ?\356) ((?^ ?o) ?\364) ((?^ ?u) ?\373)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
99 ((?^ ? ) ?^) ((?^ ?^) ?^) ((?\" ?A) ?\304) ((?\" ?E) ?\313)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
100 ((?\" ?I) ?\317) ((?\" ?O) ?\326) ((?\" ?U) ?\334) ((?\" ?a) ?\344)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
101 ((?\" ?e) ?\353) ((?\" ?i) ?\357) ((?\" ?o) ?\366) ((?\" ?s) ?\337)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
102 ((?\" ?u) ?\374) ((?\" ?y) ?\377) ((?\" ? ) ?\") ((?\" ?\") ?\250)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
103 ((?\~ ?A) ?\303) ((?\~ ?C) ?\307) ((?\~ ?D) ?\320) ((?\~ ?N) ?\321)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
104 ((?\~ ?O) ?\325) ((?\~ ?T) ?\336) ((?\~ ?a) ?\343) ((?\~ ?c) ?\347)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
105 ((?\~ ?d) ?\360) ((?\~ ?n) ?\361) ((?\~ ?o) ?\365) ((?\~ ?t) ?\376)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
106 ((?\~ ?>) ?\273) ((?\~ ?<) ?\253) ((?\~ ?\ ) ?\~) ((?\~ ?\~) ?\270)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
107 ((?\/ ?A) ?\305) ((?\/ ?E) ?\306) ((?\/ ?O) ?\330) ((?\/ ?a) ?\345)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
108 ((?\/ ?e) ?\346) ((?\/ ?o) ?\370) ((?\/ ?\ ) ?\/) ((?\/ ?\/) ?\260))))
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
109
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
110 "List of language-specific customizations for the ISO Accents mode.
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
111
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
112 Each element of the list is of the form (LANGUAGE ENABLE LIST).
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
113
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
114 LANGUAGE is a string naming the language.
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
115
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
116 ENABLE is a list of characters that will be used as accent prefixes.
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
117 It will be the value of the iso-accents-enable variable.
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
118
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
119 LIST is a list of accent translations. It will be the value of the
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
120 iso-accents-list variable.")
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
121
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
122 (defvar iso-language nil
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
123 "Language for which ISO Accents mode is currently customized.
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
124 Change it with the `iso-accents-customize' function.")
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
125
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
126 (defvar iso-accents-list nil
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
127 "Association list for ISO accent combinations, for the chosen language.")
4720
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
128
9740
ba689bf126fb (iso-accents-mode): Variable renamed from iso-accents-minor-mode.
Richard M. Stallman <rms@gnu.org>
parents: 7300
diff changeset
129 (defvar iso-accents-mode nil
4924
fb527936ca61 (iso-accents-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 4922
diff changeset
130 "*Non-nil enables ISO Accents mode.
4733
4d378f483cf4 Set up keymap at load time.
Richard M. Stallman <rms@gnu.org>
parents: 4721
diff changeset
131 Setting this variable makes it local to the current buffer.
12728
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
132 See the function `iso-accents-mode'.")
9740
ba689bf126fb (iso-accents-mode): Variable renamed from iso-accents-minor-mode.
Richard M. Stallman <rms@gnu.org>
parents: 7300
diff changeset
133 (make-variable-buffer-local 'iso-accents-mode)
4720
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
134
4877
4c51d8a8b09f Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents: 4734
diff changeset
135 (defun iso-accents-accent-key (prompt)
4c51d8a8b09f Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents: 4734
diff changeset
136 "Modify the following character by adding an accent to it."
4c51d8a8b09f Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents: 4734
diff changeset
137 ;; Pick up the accent character.
9740
ba689bf126fb (iso-accents-mode): Variable renamed from iso-accents-minor-mode.
Richard M. Stallman <rms@gnu.org>
parents: 7300
diff changeset
138 (if iso-accents-mode
4877
4c51d8a8b09f Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents: 4734
diff changeset
139 (iso-accents-compose prompt)
4c51d8a8b09f Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents: 4734
diff changeset
140 (char-to-string last-input-char)))
4c51d8a8b09f Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents: 4734
diff changeset
141
4c51d8a8b09f Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents: 4734
diff changeset
142 (defun iso-accents-compose-key (prompt)
4c51d8a8b09f Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents: 4734
diff changeset
143 "Modify the following character by adding an accent to it."
4c51d8a8b09f Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents: 4734
diff changeset
144 ;; Pick up the accent character.
4c51d8a8b09f Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents: 4734
diff changeset
145 (let ((combined (iso-accents-compose prompt)))
4c51d8a8b09f Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents: 4734
diff changeset
146 (if unread-command-events
4c51d8a8b09f Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents: 4734
diff changeset
147 (let ((unread unread-command-events))
4c51d8a8b09f Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents: 4734
diff changeset
148 (setq unread-command-events nil)
4c51d8a8b09f Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents: 4734
diff changeset
149 (error "Characters %s and %s cannot be composed"
4c51d8a8b09f Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents: 4734
diff changeset
150 (single-key-description (aref combined 0))
4c51d8a8b09f Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents: 4734
diff changeset
151 (single-key-description (car unread)))))
4c51d8a8b09f Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents: 4734
diff changeset
152 combined))
4720
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
153
4877
4c51d8a8b09f Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents: 4734
diff changeset
154 (defun iso-accents-compose (prompt)
4c51d8a8b09f Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents: 4734
diff changeset
155 (let* ((first-char last-input-char)
4c51d8a8b09f Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents: 4734
diff changeset
156 ;; Wait for the second key and look up the combination.
4c51d8a8b09f Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents: 4734
diff changeset
157 (second-char (if (or prompt
4c51d8a8b09f Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents: 4734
diff changeset
158 (not (eq (key-binding "a")
4c51d8a8b09f Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents: 4734
diff changeset
159 'self-insert-command)))
4c51d8a8b09f Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents: 4734
diff changeset
160 (progn
4c51d8a8b09f Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents: 4734
diff changeset
161 (message "%s%c"
4c51d8a8b09f Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents: 4734
diff changeset
162 (or prompt "Compose with ")
4c51d8a8b09f Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents: 4734
diff changeset
163 first-char)
4c51d8a8b09f Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents: 4734
diff changeset
164 (read-event))
4c51d8a8b09f Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents: 4734
diff changeset
165 (insert first-char)
4c51d8a8b09f Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents: 4734
diff changeset
166 (prog1 (read-event)
4c51d8a8b09f Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents: 4734
diff changeset
167 (delete-region (1- (point)) (point)))))
4c51d8a8b09f Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents: 4734
diff changeset
168 (entry (assoc (list first-char second-char) iso-accents-list)))
4c51d8a8b09f Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents: 4734
diff changeset
169 (if entry
4c51d8a8b09f Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents: 4734
diff changeset
170 ;; Found it: delete the first character and insert the combination.
4c51d8a8b09f Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents: 4734
diff changeset
171 (concat (list (nth 1 entry)))
4c51d8a8b09f Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents: 4734
diff changeset
172 ;; Otherwise, advance and schedule the second key for execution.
4c51d8a8b09f Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents: 4734
diff changeset
173 (setq unread-command-events (list second-char))
4c51d8a8b09f Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents: 4734
diff changeset
174 (vector first-char))))
4733
4d378f483cf4 Set up keymap at load time.
Richard M. Stallman <rms@gnu.org>
parents: 4721
diff changeset
175
12728
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
176 (defvar iso-accents-enable nil
5101
c95efc1cf15b (iso-accents-enable): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 5060
diff changeset
177 "*List of accent keys that become prefixes in ISO Accents mode.
c95efc1cf15b (iso-accents-enable): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 5060
diff changeset
178 The default is (?' ?` ?^ ?\" ?~ ?/), which contains all the supported
c95efc1cf15b (iso-accents-enable): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 5060
diff changeset
179 accent keys. For certain languages, you might want to remove some of
c95efc1cf15b (iso-accents-enable): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 5060
diff changeset
180 those characters that are not actually used.")
c95efc1cf15b (iso-accents-enable): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 5060
diff changeset
181
4720
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
182 ;; It is a matter of taste if you want the minor mode indicated
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
183 ;; in the mode line...
4733
4d378f483cf4 Set up keymap at load time.
Richard M. Stallman <rms@gnu.org>
parents: 4721
diff changeset
184 ;; If so, uncomment the next four lines.
9740
ba689bf126fb (iso-accents-mode): Variable renamed from iso-accents-minor-mode.
Richard M. Stallman <rms@gnu.org>
parents: 7300
diff changeset
185 ;; (or (assq 'iso-accents-mode minor-mode-map-alist)
4720
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
186 ;; (setq minor-mode-alist
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
187 ;; (append minor-mode-alist
9740
ba689bf126fb (iso-accents-mode): Variable renamed from iso-accents-minor-mode.
Richard M. Stallman <rms@gnu.org>
parents: 7300
diff changeset
188 ;; '((iso-accents-mode " ISO-Acc")))))
4720
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
189
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
190 ;;;###autoload
4721
d34c02ddea9f Fix lots of doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 4720
diff changeset
191 (defun iso-accents-mode (&optional arg)
4924
fb527936ca61 (iso-accents-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 4922
diff changeset
192 "Toggle ISO Accents mode, in which accents modify the following letter.
4721
d34c02ddea9f Fix lots of doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 4720
diff changeset
193 This permits easy insertion of accented characters according to ISO-8859-1.
d34c02ddea9f Fix lots of doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 4720
diff changeset
194 When Iso-accents mode is enabled, accent character keys
4921
e96cc77d9a7c Support ~ and /. Support 'Y, 'y, "y.
Richard M. Stallman <rms@gnu.org>
parents: 4877
diff changeset
195 \(`, ', \", ^, / and ~) do not self-insert; instead, they modify the following
4721
d34c02ddea9f Fix lots of doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 4720
diff changeset
196 letter key so that it inserts an ISO accented letter.
d34c02ddea9f Fix lots of doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 4720
diff changeset
197
5101
c95efc1cf15b (iso-accents-enable): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 5060
diff changeset
198 The variable `iso-accents-enable' specifies the list of characters to
c95efc1cf15b (iso-accents-enable): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 5060
diff changeset
199 enable as accents. If you don't need all of them, remove the ones you
c95efc1cf15b (iso-accents-enable): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 5060
diff changeset
200 don't need from that list.
c95efc1cf15b (iso-accents-enable): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 5060
diff changeset
201
4921
e96cc77d9a7c Support ~ and /. Support 'Y, 'y, "y.
Richard M. Stallman <rms@gnu.org>
parents: 4877
diff changeset
202 Special combinations: ~c gives a c with cedilla,
10599
bbf3a30a4d39 (iso-accents-list): Add Icelandic thorn.
Karl Heuer <kwzh@gnu.org>
parents: 9740
diff changeset
203 ~d gives an Icelandic eth (d with dash).
bbf3a30a4d39 (iso-accents-list): Add Icelandic thorn.
Karl Heuer <kwzh@gnu.org>
parents: 9740
diff changeset
204 ~t gives an Icelandic thorn.
5060
0f70551a445a (iso-accents-list): Add "s.
Richard M. Stallman <rms@gnu.org>
parents: 5059
diff changeset
205 \"s gives German sharp s.
0f70551a445a (iso-accents-list): Add "s.
Richard M. Stallman <rms@gnu.org>
parents: 5059
diff changeset
206 /a gives a with ring.
0f70551a445a (iso-accents-list): Add "s.
Richard M. Stallman <rms@gnu.org>
parents: 5059
diff changeset
207 /e gives an a-e ligature.
4922
60ef6d1946b0 (iso-accents-list): Fix typo in ^A code. Support ~< and ~>.
Richard M. Stallman <rms@gnu.org>
parents: 4921
diff changeset
208 ~< and ~> give guillemets.
11642
ffbb4fa31092 (iso-accents-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 11523
diff changeset
209 ~! gives an inverted exclamation mark.
ffbb4fa31092 (iso-accents-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 11523
diff changeset
210 ~? gives an inverted question mark.
4921
e96cc77d9a7c Support ~ and /. Support 'Y, 'y, "y.
Richard M. Stallman <rms@gnu.org>
parents: 4877
diff changeset
211
5101
c95efc1cf15b (iso-accents-enable): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 5060
diff changeset
212 With an argument, a positive argument enables ISO Accents mode,
4721
d34c02ddea9f Fix lots of doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 4720
diff changeset
213 and a negative argument disables it."
4720
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
214
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
215 (interactive "P")
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
216
4721
d34c02ddea9f Fix lots of doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 4720
diff changeset
217 (if (if arg
d34c02ddea9f Fix lots of doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 4720
diff changeset
218 ;; Negative arg means switch it off.
d34c02ddea9f Fix lots of doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 4720
diff changeset
219 (<= (prefix-numeric-value arg) 0)
d34c02ddea9f Fix lots of doc strings.
Richard M. Stallman <rms@gnu.org>
parents: 4720
diff changeset
220 ;; No arg means toggle.
9740
ba689bf126fb (iso-accents-mode): Variable renamed from iso-accents-minor-mode.
Richard M. Stallman <rms@gnu.org>
parents: 7300
diff changeset
221 iso-accents-mode)
ba689bf126fb (iso-accents-mode): Variable renamed from iso-accents-minor-mode.
Richard M. Stallman <rms@gnu.org>
parents: 7300
diff changeset
222 (setq iso-accents-mode nil)
4720
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
223
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
224 ;; Enable electric accents.
9740
ba689bf126fb (iso-accents-mode): Variable renamed from iso-accents-minor-mode.
Richard M. Stallman <rms@gnu.org>
parents: 7300
diff changeset
225 (setq iso-accents-mode t)))
4720
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
226
12728
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
227 (defun iso-accents-customize (language)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
228 "Customize the ISO accents machinery for a particular language.
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
229 It selects the customization based on the specifications in the
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
230 `iso-languages' variable."
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
231 (interactive (list (completing-read "Language: " iso-languages nil t)))
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
232 (let ((table (assoc language iso-languages))
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
233 c)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
234 (if (not table)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
235 (error "Unknown language")
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
236 (setq iso-language language)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
237 (setq iso-accents-enable (car (cdr table)))
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
238 (setq iso-accents-list (car (cdr (cdr table))))
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
239 (if key-translation-map
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
240 (substitute-key-definition
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
241 'iso-accents-accent-key nil key-translation-map)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
242 (setq key-translation-map (make-sparse-keymap)))
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
243 (setq c iso-accents-enable)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
244 (while c
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
245 (define-key
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
246 key-translation-map (char-to-string (car c)) 'iso-accents-accent-key)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
247 (setq c (cdr c))))))
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
248
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
249 (defun iso-accentuate (start end)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
250 "Convert two-character sequences in region into accented characters.
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
251 Noninteractively, this operates on text from START to END.
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
252 This uses the same conversion that ISO Accents mode uses for type-in."
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
253 (interactive "r")
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
254 (save-excursion
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
255 (save-restriction
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
256 (narrow-to-region start end)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
257 (goto-char start)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
258 (forward-char 1)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
259 (let (entry)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
260 (while (< (point) end)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
261 (if (and (memq (preceding-char) iso-accents-enable)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
262 (<= ?A (following-char))
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
263 (<= (following-char) ?z)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
264 (setq entry (assoc (list (preceding-char) (following-char))
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
265 iso-accents-list)))
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
266 (progn
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
267 (forward-char -1)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
268 (delete-char 2)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
269 (insert (car (cdr entry)))
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
270 (setq end (1- end)))
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
271 (forward-char 1)))))))
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
272
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
273 (defun iso-accent-rassoc-unit (value alist)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
274 (while (and alist
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
275 (not (eq (car (cdr (car alist))) value)))
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
276 (setq alist (cdr alist)))
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
277 (if alist
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
278 (car alist)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
279 nil))
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
280
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
281 (defun iso-unaccentuate (start end)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
282 "Convert accented characters in the region into two-character sequences.
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
283 Noninteractively, this operates on text from START to END.
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
284 This uses the opposite of the conversion done by ISO Accents mode for type-in."
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
285 (interactive "r")
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
286 (save-excursion
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
287 (save-restriction
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
288 (narrow-to-region start end)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
289 (goto-char start)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
290 (let (entry)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
291 (while (< (point) end)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
292 (if (and (> (following-char) 127)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
293 (setq entry (iso-accent-rassoc-unit (following-char)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
294 iso-accents-list)))
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
295 (progn
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
296 (delete-char 1)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
297 (insert (car (car entry)) (car (cdr (car entry))))
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
298 (setq end (1+ end)))
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
299 (forward-char 1)))))))
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
300
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
301 (defun iso-deaccentuate (start end)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
302 "Convert accented characters in the region into unaccented characters.
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
303 Noninteractively, this operates on text from START to END."
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
304 (interactive "r")
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
305 (save-excursion
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
306 (save-restriction
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
307 (narrow-to-region start end)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
308 (goto-char start)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
309 (let (entry)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
310 (while (< (point) end)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
311 (if (and (> (following-char) 127)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
312 (setq entry (iso-accent-rassoc-unit (following-char)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
313 iso-accents-list)))
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
314 (progn
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
315 (delete-char 1)
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
316 (insert (car (cdr (car entry)))))
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
317 (forward-char 1)))))))
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
318
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
319 (iso-customize-accents "default")
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
320
4720
797fe2b66800 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
321 ;;; iso-acc.el ends here
12728
abe3fc783a45 Major additions by Gustavo Chaves.
Richard M. Stallman <rms@gnu.org>
parents: 11642
diff changeset
322