Mercurial > emacs
annotate lisp/international/iso-acc.el @ 11831:7e5af94d9527
Add provide call.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Tue, 16 May 1995 21:58:47 +0000 |
parents | ffbb4fa31092 |
children | abe3fc783a45 |
rev | line source |
---|---|
4720 | 1 ;;; iso-acc.el -- minor mode providing electric accent keys |
7300 | 2 ;;; Copyright (C) 1993, 1994 Free Software Foundation, Inc. |
4720 | 3 |
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 | 8 |
9 ;; This file is part of GNU Emacs. | |
10 | |
11 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
12 ;; it under the terms of the GNU General Public License as published by | |
13 ;; the Free Software Foundation; either version 2, or (at your option) | |
14 ;; any later version. | |
15 | |
16 ;; GNU Emacs is distributed in the hope that it will be useful, | |
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 ;; GNU General Public License for more details. | |
20 | |
21 ;; You should have received a copy of the GNU General Public License | |
22 ;; along with GNU Emacs; see the file COPYING. If not, write to | |
23 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
24 | |
25 ;;; Commentary: | |
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 | 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 | 34 ;; |
35 ;; ' (minute) -> grave accent | |
36 ;; ` (backtick) -> acute accent | |
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 | 42 ;; |
43 ;; The action taken depends on the key that follows the pseudo accent. | |
44 ;; In general: | |
45 ;; | |
46 ;; pseudo-accent + appropriate letter -> accented letter | |
47 ;; pseudo-accent + space -> pseudo-accent | |
48 ;; pseudo-accent + pseudo-accent -> accent (if available) | |
49 ;; pseudo-accent + other -> pseudo-accent + other | |
50 ;; | |
51 ;; If the pseudo-accent is followed by anything else than a | |
52 ;; self-insert-command, the dead-key code is terminated, the | |
53 ;; pseudo-accent inserted 'as is' and the bell is rung to signal this. | |
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 | 60 |
61 ;;; Code: | |
62 | |
63 (provide 'iso-acc) | |
64 | |
65 (defvar iso-accents-list | |
66 '(((?' ?A) ?\301) | |
67 ((?' ?E) ?\311) | |
68 ((?' ?I) ?\315) | |
69 ((?' ?O) ?\323) | |
70 ((?' ?U) ?\332) | |
4921
e96cc77d9a7c
Support ~ and /. Support 'Y, 'y, "y.
Richard M. Stallman <rms@gnu.org>
parents:
4877
diff
changeset
|
71 ((?' ?Y) ?\335) |
4720 | 72 ((?' ?a) ?\341) |
73 ((?' ?e) ?\351) | |
74 ((?' ?i) ?\355) | |
75 ((?' ?o) ?\363) | |
76 ((?' ?u) ?\372) | |
5059
44c915e72774
(iso-accents-list): Fix entries for 'y and ~c.
Richard M. Stallman <rms@gnu.org>
parents:
5040
diff
changeset
|
77 ((?' ?y) ?\375) |
4720 | 78 ((?' ?') ?\264) |
79 ((?' ? ) ?') | |
80 ((?` ?A) ?\300) | |
81 ((?` ?E) ?\310) | |
82 ((?` ?I) ?\314) | |
83 ((?` ?O) ?\322) | |
84 ((?` ?U) ?\331) | |
85 ((?` ?a) ?\340) | |
86 ((?` ?e) ?\350) | |
87 ((?` ?i) ?\354) | |
88 ((?` ?o) ?\362) | |
89 ((?` ?u) ?\371) | |
90 ((?` ? ) ?`) | |
91 ((?` ?`) ?`) ; no special code? | |
4922
60ef6d1946b0
(iso-accents-list): Fix typo in ^A code. Support ~< and ~>.
Richard M. Stallman <rms@gnu.org>
parents:
4921
diff
changeset
|
92 ((?^ ?A) ?\302) |
4720 | 93 ((?^ ?E) ?\312) |
94 ((?^ ?I) ?\316) | |
95 ((?^ ?O) ?\324) | |
96 ((?^ ?U) ?\333) | |
97 ((?^ ?a) ?\342) | |
98 ((?^ ?e) ?\352) | |
99 ((?^ ?i) ?\356) | |
100 ((?^ ?o) ?\364) | |
101 ((?^ ?u) ?\373) | |
102 ((?^ ? ) ?^) | |
103 ((?^ ?^) ?^) ; no special code? | |
104 ((?\" ?A) ?\304) | |
105 ((?\" ?E) ?\313) | |
106 ((?\" ?I) ?\317) | |
107 ((?\" ?O) ?\326) | |
108 ((?\" ?U) ?\334) | |
109 ((?\" ?a) ?\344) | |
110 ((?\" ?e) ?\353) | |
111 ((?\" ?i) ?\357) | |
112 ((?\" ?o) ?\366) | |
5060
0f70551a445a
(iso-accents-list): Add "s.
Richard M. Stallman <rms@gnu.org>
parents:
5059
diff
changeset
|
113 ((?\" ?s) ?\337) |
4720 | 114 ((?\" ?u) ?\374) |
4921
e96cc77d9a7c
Support ~ and /. Support 'Y, 'y, "y.
Richard M. Stallman <rms@gnu.org>
parents:
4877
diff
changeset
|
115 ((?\" ?y) ?\377) |
4720 | 116 ((?\" ? ) ?\") |
117 ((?\" ?\") ?\250) | |
4921
e96cc77d9a7c
Support ~ and /. Support 'Y, 'y, "y.
Richard M. Stallman <rms@gnu.org>
parents:
4877
diff
changeset
|
118 ((?\~ ?A) ?\303) |
e96cc77d9a7c
Support ~ and /. Support 'Y, 'y, "y.
Richard M. Stallman <rms@gnu.org>
parents:
4877
diff
changeset
|
119 ((?\~ ?C) ?\307) |
e96cc77d9a7c
Support ~ and /. Support 'Y, 'y, "y.
Richard M. Stallman <rms@gnu.org>
parents:
4877
diff
changeset
|
120 ((?\~ ?D) ?\320) |
e96cc77d9a7c
Support ~ and /. Support 'Y, 'y, "y.
Richard M. Stallman <rms@gnu.org>
parents:
4877
diff
changeset
|
121 ((?\~ ?N) ?\321) |
e96cc77d9a7c
Support ~ and /. Support 'Y, 'y, "y.
Richard M. Stallman <rms@gnu.org>
parents:
4877
diff
changeset
|
122 ((?\~ ?O) ?\325) |
10599
bbf3a30a4d39
(iso-accents-list): Add Icelandic thorn.
Karl Heuer <kwzh@gnu.org>
parents:
9740
diff
changeset
|
123 ((?\~ ?T) ?\336) |
4921
e96cc77d9a7c
Support ~ and /. Support 'Y, 'y, "y.
Richard M. Stallman <rms@gnu.org>
parents:
4877
diff
changeset
|
124 ((?\~ ?a) ?\343) |
5059
44c915e72774
(iso-accents-list): Fix entries for 'y and ~c.
Richard M. Stallman <rms@gnu.org>
parents:
5040
diff
changeset
|
125 ((?\~ ?c) ?\347) |
4921
e96cc77d9a7c
Support ~ and /. Support 'Y, 'y, "y.
Richard M. Stallman <rms@gnu.org>
parents:
4877
diff
changeset
|
126 ((?\~ ?d) ?\360) |
e96cc77d9a7c
Support ~ and /. Support 'Y, 'y, "y.
Richard M. Stallman <rms@gnu.org>
parents:
4877
diff
changeset
|
127 ((?\~ ?n) ?\361) |
e96cc77d9a7c
Support ~ and /. Support 'Y, 'y, "y.
Richard M. Stallman <rms@gnu.org>
parents:
4877
diff
changeset
|
128 ((?\~ ?o) ?\365) |
10599
bbf3a30a4d39
(iso-accents-list): Add Icelandic thorn.
Karl Heuer <kwzh@gnu.org>
parents:
9740
diff
changeset
|
129 ((?\~ ?t) ?\376) |
4922
60ef6d1946b0
(iso-accents-list): Fix typo in ^A code. Support ~< and ~>.
Richard M. Stallman <rms@gnu.org>
parents:
4921
diff
changeset
|
130 ((?\~ ?>) ?\273) |
60ef6d1946b0
(iso-accents-list): Fix typo in ^A code. Support ~< and ~>.
Richard M. Stallman <rms@gnu.org>
parents:
4921
diff
changeset
|
131 ((?\~ ?<) ?\253) |
11523
fa1abeedc2d0
(iso-accents-list): Add ~! and ~? combinations.
Richard M. Stallman <rms@gnu.org>
parents:
10599
diff
changeset
|
132 ((?\~ ?!) ?\241) ;; Inverted exclamation mark |
fa1abeedc2d0
(iso-accents-list): Add ~! and ~? combinations.
Richard M. Stallman <rms@gnu.org>
parents:
10599
diff
changeset
|
133 ((?\~ ??) ?\277) ;; Inverted question mark |
6421
db0bbe836298
(iso-accents-list): Add entries for unadorned accents.
Karl Heuer <kwzh@gnu.org>
parents:
5101
diff
changeset
|
134 ((?\~ ?\ ) ?\~) |
db0bbe836298
(iso-accents-list): Add entries for unadorned accents.
Karl Heuer <kwzh@gnu.org>
parents:
5101
diff
changeset
|
135 ((?\~ ?\~) ?\270) ;; cedilla accent |
5040
34ce5cc32eb8
(iso-accents-list): Added /A for A-with-ring
Richard M. Stallman <rms@gnu.org>
parents:
4924
diff
changeset
|
136 ((?\/ ?A) ?\305) ;; A-with-ring (Norwegian and Danish) |
34ce5cc32eb8
(iso-accents-list): Added /A for A-with-ring
Richard M. Stallman <rms@gnu.org>
parents:
4924
diff
changeset
|
137 ((?\/ ?E) ?\306) ;; AE-ligature (Norwegian and Danish) |
4921
e96cc77d9a7c
Support ~ and /. Support 'Y, 'y, "y.
Richard M. Stallman <rms@gnu.org>
parents:
4877
diff
changeset
|
138 ((?\/ ?O) ?\330) |
5040
34ce5cc32eb8
(iso-accents-list): Added /A for A-with-ring
Richard M. Stallman <rms@gnu.org>
parents:
4924
diff
changeset
|
139 ((?\/ ?a) ?\345) ;; a-with-ring (Norwegian and Danish) |
34ce5cc32eb8
(iso-accents-list): Added /A for A-with-ring
Richard M. Stallman <rms@gnu.org>
parents:
4924
diff
changeset
|
140 ((?\/ ?e) ?\346) ;; ae-ligature (Norwegian and Danish) |
4921
e96cc77d9a7c
Support ~ and /. Support 'Y, 'y, "y.
Richard M. Stallman <rms@gnu.org>
parents:
4877
diff
changeset
|
141 ((?\/ ?o) ?\370) |
6421
db0bbe836298
(iso-accents-list): Add entries for unadorned accents.
Karl Heuer <kwzh@gnu.org>
parents:
5101
diff
changeset
|
142 ((?\/ ?\ ) ?\/) |
db0bbe836298
(iso-accents-list): Add entries for unadorned accents.
Karl Heuer <kwzh@gnu.org>
parents:
5101
diff
changeset
|
143 ((?\/ ?\/) ?\260) ;; ring accent (actually degree sign?) |
4720 | 144 ) |
4721
d34c02ddea9f
Fix lots of doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
4720
diff
changeset
|
145 "Association list for ISO accent combinations.") |
4720 | 146 |
9740
ba689bf126fb
(iso-accents-mode): Variable renamed from iso-accents-minor-mode.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
147 (defvar iso-accents-mode nil |
4924
fb527936ca61
(iso-accents-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
4922
diff
changeset
|
148 "*Non-nil enables ISO Accents mode. |
4733
4d378f483cf4
Set up keymap at load time.
Richard M. Stallman <rms@gnu.org>
parents:
4721
diff
changeset
|
149 Setting this variable makes it local to the current buffer. |
9740
ba689bf126fb
(iso-accents-mode): Variable renamed from iso-accents-minor-mode.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
150 See function `iso-accents-mode'.") |
ba689bf126fb
(iso-accents-mode): Variable renamed from iso-accents-minor-mode.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
151 (make-variable-buffer-local 'iso-accents-mode) |
4720 | 152 |
4877
4c51d8a8b09f
Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents:
4734
diff
changeset
|
153 (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
|
154 "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
|
155 ;; 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
|
156 (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
|
157 (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
|
158 (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
|
159 |
4c51d8a8b09f
Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents:
4734
diff
changeset
|
160 (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
|
161 "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
|
162 ;; 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
|
163 (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
|
164 (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
|
165 (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
|
166 (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
|
167 (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
|
168 (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
|
169 (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
|
170 combined)) |
4720 | 171 |
4877
4c51d8a8b09f
Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents:
4734
diff
changeset
|
172 (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
|
173 (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
|
174 ;; 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
|
175 (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
|
176 (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
|
177 '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
|
178 (progn |
4c51d8a8b09f
Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents:
4734
diff
changeset
|
179 (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
|
180 (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
|
181 first-char) |
4c51d8a8b09f
Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents:
4734
diff
changeset
|
182 (read-event)) |
4c51d8a8b09f
Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents:
4734
diff
changeset
|
183 (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
|
184 (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
|
185 (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
|
186 (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
|
187 (if entry |
4c51d8a8b09f
Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents:
4734
diff
changeset
|
188 ;; 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
|
189 (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
|
190 ;; 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
|
191 (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
|
192 (vector first-char)))) |
4733
4d378f483cf4
Set up keymap at load time.
Richard M. Stallman <rms@gnu.org>
parents:
4721
diff
changeset
|
193 |
5101
c95efc1cf15b
(iso-accents-enable): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
5060
diff
changeset
|
194 (defvar iso-accents-enable '(?' ?` ?^ ?\" ?~ ?/) |
c95efc1cf15b
(iso-accents-enable): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
5060
diff
changeset
|
195 "*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
|
196 The default is (?' ?` ?^ ?\" ?~ ?/), which contains all the supported |
c95efc1cf15b
(iso-accents-enable): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
5060
diff
changeset
|
197 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
|
198 those characters that are not actually used.") |
c95efc1cf15b
(iso-accents-enable): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
5060
diff
changeset
|
199 |
4877
4c51d8a8b09f
Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents:
4734
diff
changeset
|
200 (or key-translation-map (setq key-translation-map (make-sparse-keymap))) |
4c51d8a8b09f
Define "dead keys" in key-translation-map, not in global-map.
Richard M. Stallman <rms@gnu.org>
parents:
4734
diff
changeset
|
201 ;; For sequences starting with an accent character, |
9740
ba689bf126fb
(iso-accents-mode): Variable renamed from iso-accents-minor-mode.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
202 ;; use a function that tests iso-accents-mode. |
5101
c95efc1cf15b
(iso-accents-enable): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
5060
diff
changeset
|
203 (if (memq ?' iso-accents-enable) |
c95efc1cf15b
(iso-accents-enable): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
5060
diff
changeset
|
204 (define-key key-translation-map "'" 'iso-accents-accent-key)) |
c95efc1cf15b
(iso-accents-enable): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
5060
diff
changeset
|
205 (if (memq ?` iso-accents-enable) |
c95efc1cf15b
(iso-accents-enable): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
5060
diff
changeset
|
206 (define-key key-translation-map "`" 'iso-accents-accent-key)) |
c95efc1cf15b
(iso-accents-enable): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
5060
diff
changeset
|
207 (if (memq ?^ iso-accents-enable) |
c95efc1cf15b
(iso-accents-enable): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
5060
diff
changeset
|
208 (define-key key-translation-map "^" 'iso-accents-accent-key)) |
c95efc1cf15b
(iso-accents-enable): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
5060
diff
changeset
|
209 (if (memq ?\" iso-accents-enable) |
c95efc1cf15b
(iso-accents-enable): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
5060
diff
changeset
|
210 (define-key key-translation-map "\"" 'iso-accents-accent-key)) |
c95efc1cf15b
(iso-accents-enable): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
5060
diff
changeset
|
211 (if (memq ?~ iso-accents-enable) |
c95efc1cf15b
(iso-accents-enable): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
5060
diff
changeset
|
212 (define-key key-translation-map "~" 'iso-accents-accent-key)) |
c95efc1cf15b
(iso-accents-enable): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
5060
diff
changeset
|
213 (if (memq ?/ iso-accents-enable) |
c95efc1cf15b
(iso-accents-enable): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
5060
diff
changeset
|
214 (define-key key-translation-map "/" 'iso-accents-accent-key)) |
4733
4d378f483cf4
Set up keymap at load time.
Richard M. Stallman <rms@gnu.org>
parents:
4721
diff
changeset
|
215 |
4720 | 216 ;; It is a matter of taste if you want the minor mode indicated |
217 ;; in the mode line... | |
4733
4d378f483cf4
Set up keymap at load time.
Richard M. Stallman <rms@gnu.org>
parents:
4721
diff
changeset
|
218 ;; 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
|
219 ;; (or (assq 'iso-accents-mode minor-mode-map-alist) |
4720 | 220 ;; (setq minor-mode-alist |
221 ;; (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
|
222 ;; '((iso-accents-mode " ISO-Acc"))))) |
4720 | 223 |
224 ;;;###autoload | |
4721
d34c02ddea9f
Fix lots of doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
4720
diff
changeset
|
225 (defun iso-accents-mode (&optional arg) |
4924
fb527936ca61
(iso-accents-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
4922
diff
changeset
|
226 "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
|
227 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
|
228 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
|
229 \(`, ', \", ^, / 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
|
230 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
|
231 |
5101
c95efc1cf15b
(iso-accents-enable): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
5060
diff
changeset
|
232 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
|
233 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
|
234 don't need from that list. |
c95efc1cf15b
(iso-accents-enable): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
5060
diff
changeset
|
235 |
4921
e96cc77d9a7c
Support ~ and /. Support 'Y, 'y, "y.
Richard M. Stallman <rms@gnu.org>
parents:
4877
diff
changeset
|
236 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
|
237 ~d gives an Icelandic eth (d with dash). |
bbf3a30a4d39
(iso-accents-list): Add Icelandic thorn.
Karl Heuer <kwzh@gnu.org>
parents:
9740
diff
changeset
|
238 ~t gives an Icelandic thorn. |
5060
0f70551a445a
(iso-accents-list): Add "s.
Richard M. Stallman <rms@gnu.org>
parents:
5059
diff
changeset
|
239 \"s gives German sharp s. |
0f70551a445a
(iso-accents-list): Add "s.
Richard M. Stallman <rms@gnu.org>
parents:
5059
diff
changeset
|
240 /a gives a with ring. |
0f70551a445a
(iso-accents-list): Add "s.
Richard M. Stallman <rms@gnu.org>
parents:
5059
diff
changeset
|
241 /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
|
242 ~< and ~> give guillemets. |
11642
ffbb4fa31092
(iso-accents-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11523
diff
changeset
|
243 ~! gives an inverted exclamation mark. |
ffbb4fa31092
(iso-accents-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
11523
diff
changeset
|
244 ~? gives an inverted question mark. |
4921
e96cc77d9a7c
Support ~ and /. Support 'Y, 'y, "y.
Richard M. Stallman <rms@gnu.org>
parents:
4877
diff
changeset
|
245 |
5101
c95efc1cf15b
(iso-accents-enable): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
5060
diff
changeset
|
246 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
|
247 and a negative argument disables it." |
4720 | 248 |
249 (interactive "P") | |
250 | |
4721
d34c02ddea9f
Fix lots of doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
4720
diff
changeset
|
251 (if (if arg |
d34c02ddea9f
Fix lots of doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
4720
diff
changeset
|
252 ;; Negative arg means switch it off. |
d34c02ddea9f
Fix lots of doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
4720
diff
changeset
|
253 (<= (prefix-numeric-value arg) 0) |
d34c02ddea9f
Fix lots of doc strings.
Richard M. Stallman <rms@gnu.org>
parents:
4720
diff
changeset
|
254 ;; 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
|
255 iso-accents-mode) |
ba689bf126fb
(iso-accents-mode): Variable renamed from iso-accents-minor-mode.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
256 (setq iso-accents-mode nil) |
4720 | 257 |
258 ;; 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
|
259 (setq iso-accents-mode t))) |
4720 | 260 |
261 ;;; iso-acc.el ends here |