annotate lisp/iso/iso-acc.el @ 153:25f70ba0133c r20-3b3

Import from CVS: tag r20-3b3
author cvs
date Mon, 13 Aug 2007 09:38:25 +0200
parents 318232e2a3f0
children 15872534500d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1 ;;; iso-acc.el --- minor mode providing electric accent keys
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
2
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
3 ;; Copyright (C) 1993, 1994, 1996 Free Software Foundation, Inc.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
4
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
5 ;; Author: Johan Vromans
94
1040fe1366ac Import from CVS: tag xemacs-20-0f2
cvs
parents: 88
diff changeset
6 ;; Maintainer: Alexandre Oliva <oliva@dcc.unicamp.br>
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
7 ;; Keywords: i18n
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
8 ;; $Revision: 1.5 $
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
9 ;; $Date: 1997/05/29 23:49:45 $
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
10
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
11 ;; This file is part of GNU Emacs.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
12
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
13 ;; GNU Emacs is free software; you can redistribute it and/or modify
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
14 ;; it under the terms of the GNU General Public License as published by
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
15 ;; the Free Software Foundation; either version 2, or (at your option)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
16 ;; any later version.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
17
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
18 ;; GNU Emacs is distributed in the hope that it will be useful,
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
21 ;; GNU General Public License for more details.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
22
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
23 ;; You should have received a copy of the GNU General Public License
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
25 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
26 ;; Boston, MA 02111-1307, USA.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
27
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
28 ;;; Commentary:
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
29
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
30 ;; Function `iso-accents-mode' activates a minor mode in which
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
31 ;; typewriter "dead keys" are emulated. The purpose of this emulation
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
32 ;; is to provide a simple means for inserting accented characters
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
33 ;; according to the ISO-8859-1 and other character sets.
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
34 ;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
35 ;; In `iso-accents-mode', pseudo accent characters are used to
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
36 ;; introduce accented keys. The pseudo-accent characters are:
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
37 ;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
38 ;; ' (minute) -> grave accent
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
39 ;; ` (backtick) -> acute accent
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
40 ;; " (second) -> diaeresis
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
41 ;; ^ (caret) -> circumflex
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
42 ;; ~ (tilde) -> tilde over the character
94
1040fe1366ac Import from CVS: tag xemacs-20-0f2
cvs
parents: 88
diff changeset
43 ;; / (slash) -> slash through the character
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
44 ;; Also: /A is A-with-ring and /E is AE ligature.
94
1040fe1366ac Import from CVS: tag xemacs-20-0f2
cvs
parents: 88
diff changeset
45 ;; . (dot) -> dot over the character
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
46 ;; , (cedilla) -> cedilla under the character (some languages only)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
47 ;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
48 ;; The action taken depends on the key that follows the pseudo accent.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
49 ;; In general:
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
50 ;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
51 ;; pseudo-accent + appropriate letter -> accented letter
94
1040fe1366ac Import from CVS: tag xemacs-20-0f2
cvs
parents: 88
diff changeset
52 ;; pseudo-accent + space -> pseudo-accent (except comma)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
53 ;; pseudo-accent + pseudo-accent -> accent (if available)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
54 ;; pseudo-accent + other -> pseudo-accent + other
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
55 ;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
56 ;; If the pseudo-accent is followed by anything else than a
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
57 ;; self-insert-command, the dead-key code is terminated, the
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
58 ;; pseudo-accent inserted 'as is' and the bell is rung to signal this.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
59 ;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
60 ;; Function `iso-accents-mode' can be used to enable the iso accents
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
61 ;; minor mode, or disable it.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
62
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
63 ;; If you want only some of these characters to serve as accents,
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
64 ;; add a language to `iso-languages' which specifies the accent characters
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
65 ;; that you want, then select the language with `iso-accents-customize'.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
66
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
67 ;;; Code:
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
68
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
69 (provide 'iso-acc)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
70
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
71 ;; multiple Emacs versions compatibility section
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
72
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
73 (if (fboundp 'make-char)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
74 (defalias 'iso-make-char 'make-char)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
75 (defun iso-make-char (charset) 128))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
76
144
318232e2a3f0 Import from CVS: tag r20-2b6
cvs
parents: 94
diff changeset
77 (if (fboundp 'read-event)
318232e2a3f0 Import from CVS: tag r20-2b6
cvs
parents: 94
diff changeset
78 (defalias 'iso-read-event 'read-event)
318232e2a3f0 Import from CVS: tag r20-2b6
cvs
parents: 94
diff changeset
79 (defun iso-read-event ()
318232e2a3f0 Import from CVS: tag r20-2b6
cvs
parents: 94
diff changeset
80 (event-key (next-command-event))))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
81
94
1040fe1366ac Import from CVS: tag xemacs-20-0f2
cvs
parents: 88
diff changeset
82 (if (fboundp 'character-to-event)
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
83 (progn
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
84 (defun iso-char-list-to-event (l)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
85 "returns an event containing the given list of characters"
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
86 (character-to-event l))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
87 (defun iso-char-to-event (ch)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
88 "returns an event containing the given character"
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
89 (iso-char-list-to-event (list ch))))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
90 (defalias 'iso-char-to-event 'identity)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
91 (defalias 'iso-char-list-to-event 'identity))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
92
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
93 (if (fboundp 'this-single-command-keys) ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
94 (if (string-match "Lucid" (version))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
95 (defun this-single-command-keys ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
96 (setq this-command (not (this-command-keys)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
97 (this-command-keys))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
98 (defun this-single-command-keys () (this-command-keys))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
99
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
100 (defvar iso-accents-insert-offset
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
101 (if (boundp 'nonascii-insert-offset)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
102 nonascii-insert-offset
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
103 0)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
104 "*Offset added by ISO Accents mode to character codes 0200 and above.")
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
105
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
106 ;; end of compatibility section
94
1040fe1366ac Import from CVS: tag xemacs-20-0f2
cvs
parents: 88
diff changeset
107
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
108 (defvar iso-languages
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
109 '(("catalan"
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
110 ;; Note this includes some extra characters used in Spanish,
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
111 ;; on the idea that someone who uses Catalan is likely to use Spanish
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
112 ;; as well.
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
113 (?' (?A . ?\301) (?E . ?\311) (?I . ?\315) (?O . ?\323) (?U . ?\332)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
114 (?a . ?\341) (?e . ?\351) (?i . ?\355) (?o . ?\363) (?u . ?\372)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
115 (?\ . ?'))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
116 (?` (?A . ?\300) (?E . ?\310) (?O . ?\322)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
117 (?a . ?\340) (?e . ?\350) (?o . ?\362) (?\ . ?`))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
118 (?\" (?I . ?\317) (?U . ?\334) (?i . ?\357) (?u . ?\374) (?\ . ?\"))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
119 (?~ (?C . ?\307) (?N . ?\321) (?c . ?\347) (?n . ?\361)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
120 (?> . ?\273) (?< . ?\253) (?! . ?\241) (?? . ?\277)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
121 (?\ . ?~)))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
122
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
123 ("esperanto"
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
124 (?^ (?H . ?\246) (?J . ?\254) (?h . ?\266) (?j . ?\274) (?C . ?\306)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
125 (?G . ?\330) (?S . ?\336) (?c . ?\346) (?g . ?\370) (?s . ?\376)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
126 (?^ . ?^) (?\ . ?^))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
127 (?~ (?U . ?\335) (?u . ?\375) (?\ . ?~)))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
128
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
129 ("french"
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
130 (?' (?E . ?\311) (?C . ?\307)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
131 (?e . ?\351) (?c . ?\347)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
132 (?\ . ?') (space . ?'))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
133 (?` (?A . ?\300) (?E . ?\310) (?U . ?\331)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
134 (?a . ?\340) (?e . ?\350) (?u . ?\371)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
135 (?\ . ?`) (space . ?`))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
136 (?^ (?A . ?\302) (?E . ?\312) (?I . ?\316) (?O . ?\324) (?U . ?\333)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
137 (?a . ?\342) (?e . ?\352) (?i . ?\356) (?o . ?\364) (?u . ?\373)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
138 (?\ . ?^) (space . ?^))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
139 (?\" (?E . ?\313) (?I . ?\317)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
140 (?e . ?\353) (?i . ?\357)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
141 (?\ . ?\") (space . ?\"))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
142 (?~ (?< . ?\253) (?> . ?\273)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
143 (?C . ?\307) (?c . ?\347)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
144 (?\ . ?~) (space . ?~))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
145 (?, (?c . ?\347) (?C . ?\307) (?, . ?,)))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
146
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
147 ("german"
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
148 (?\" (?A . ?\304) (?O . ?\326) (?U . ?\334)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
149 (?a . ?\344) (?o . ?\366) (?u . ?\374) (?s . ?\337) (?\ . ?\")))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
150
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
151 ("irish"
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
152 (?' (?A . ?\301) (?E . ?\311) (?I . ?\315) (?O . ?\323) (?U . ?\332)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
153 (?a . ?\341) (?e . ?\351) (?i . ?\355) (?o . ?\363) (?u . ?\372)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
154 (?\ . ?') (space . ?')))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
155
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
156 ("portuguese"
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
157 (?' (?A . ?\301) (?E . ?\311) (?I . ?\315) (?O . ?\323) (?U . ?\332)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
158 (?C . ?\307) (?a . ?\341) (?e . ?\351) (?i . ?\355) (?o . ?\363)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
159 (?u . ?\372) (?c . ?\347) (?\ . ?') (space . ?'))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
160 (?` (?A . ?\300) (?a . ?\340) (?\ . ?`) (space . ?`))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
161 (?^ (?A . ?\302) (?E . ?\312) (?O . ?\324) (?a . ?\342) (?e . ?\352)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
162 (?o . ?\364) (?\ . ?^) (space . ?^))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
163 (?\" (?U . ?\334) (?u . ?\374) (?\ . ?\") (space . ?\"))
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
164 (?~ (?A . ?\303) (?O . ?\325)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
165 (?a . ?\343) (?o . ?\365)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
166 (?\ . ?~) (space . ?~))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
167 (?, (?c . ?\347) (?C . ?\307) (?, . ?,)))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
168
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
169 ("spanish"
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
170 (?' (?A . ?\301) (?E . ?\311) (?I . ?\315) (?O . ?\323) (?U . ?\332)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
171 (?a . ?\341) (?e . ?\351) (?i . ?\355) (?o . ?\363) (?u . ?\372)
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
172 (?\ . ?'))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
173 (?\" (?U . ?\334) (?u . ?\374) (?\ . ?\"))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
174 (?~ (?N . ?\321) (?n . ?\361) (?> . ?\273) (?< . ?\253) (?! . ?\241)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
175 (?? . ?\277) (?\ . ?~)))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
176
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
177 ("latin-1"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
178 (?' (?A . ?\301) (?E . ?\311) (?I . ?\315) (?O . ?\323) (?U . ?\332)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
179 (?Y . ?\335) (?a . ?\341) (?e . ?\351) (?i . ?\355) (?o . ?\363)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
180 (?u . ?\372) (?y . ?\375) (?' . ?\264) (?\ . ?') (space . ?'))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
181 (?` (?A . ?\300) (?E . ?\310) (?I . ?\314) (?O . ?\322) (?U . ?\331)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
182 (?a . ?\340) (?e . ?\350) (?i . ?\354) (?o . ?\362) (?u . ?\371)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
183 (?` . ?`) (?\ . ?`) (space . ?`))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
184 (?^ (?A . ?\302) (?E . ?\312) (?I . ?\316) (?O . ?\324) (?U . ?\333)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
185 (?a . ?\342) (?e . ?\352) (?i . ?\356) (?o . ?\364) (?u . ?\373)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
186 (?^ . ?^) (?\ . ?^) (space . ?^))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
187 (?\" (?A . ?\304) (?E . ?\313) (?I . ?\317) (?O . ?\326) (?U . ?\334)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
188 (?a . ?\344) (?e . ?\353) (?i . ?\357) (?o . ?\366) (?s . ?\337)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
189 (?u . ?\374) (?y . ?\377) (?\" . ?\250) (?\ . ?\") (space . ?\"))
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
190 (?~ (?A . ?\303) (?C . ?\307) (?D . ?\320) (?N . ?\321) (?O . ?\325)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
191 (?T . ?\336) (?a . ?\343) (?c . ?\347) (?d . ?\360) (?n . ?\361)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
192 (?o . ?\365) (?t . ?\376) (?> . ?\273) (?< . ?\253) (?~ . ?\270)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
193 (?! . ?\241) (?? . ?\277)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
194 (?\ . ?~) (space . ?~))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
195 (?/ (?A . ?\305) (?E . ?\306) (?O . ?\330) (?a . ?\345) (?e . ?\346)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
196 (?o . ?\370) (?/ . ?\260) (?\ . ?/) (space . ?/)))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
197
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
198 ("latin-2" latin-iso8859-2
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
199 (?' (?A . ?\301) (?C . ?\306) (?D . ?\320) (?E . ?\311) (?I . ?\315)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
200 (?L . ?\305) (?N . ?\321) (?O . ?\323) (?R . ?\300) (?S . ?\246)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
201 (?U . ?\332) (?Y . ?\335) (?Z . ?\254)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
202 (?a . ?\341) (?c . ?\346) (?d . ?\360) (?e . ?\351) (?i . ?\355)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
203 (?l . ?\345) (?n . ?\361) (?o . ?\363) (?r . ?\340) (?s . ?\266)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
204 (?u . ?\372) (?y . ?\375) (?z . ?\274)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
205 (?' . ?\264) (?\ . ?') (space . ?'))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
206 (?` (?A . ?\241) (?C . ?\307) (?E . ?\312) (?L . ?\243) (?S . ?\252)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
207 (?T . ?\336) (?Z . ?\257)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
208 (?a . ?\261) (?l . ?\263) (?c . ?\347) (?e . ?\352) (?s . ?\272)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
209 (?t . ?\376) (?z . ?\277)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
210 (?` . ?\252)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
211 (?. . ?\377) (?\ . ?`) (space . ?`))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
212 (?^ (?A . ?\302) (?I . ?\316) (?O . ?\324)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
213 (?a . ?\342) (?i . ?\356) (?o . ?\364)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
214 (?^ . ?^) ; no special code?
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
215 (?\ . ?^) (space . ?^))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
216 (?\" (?A . ?\304) (?E . ?\313) (?O . ?\326) (?U . ?\334)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
217 (?a . ?\344) (?e . ?\353) (?o . ?\366) (?s . ?\337) (?u . ?\374)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
218 (?\" . ?\250)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
219 (?\ . ?\") (space . ?\"))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
220 (?~ (?A . ?\303) (?C . ?\310) (?D . ?\317) (?L . ?\245) (?N . ?\322)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
221 (?O . ?\325) (?R . ?\330) (?S . ?\251) (?T . ?\253) (?U . ?\333)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
222 (?Z . ?\256)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
223 (?a . ?\343) (?c . ?\350) (?d . ?\357) (?l . ?\265) (?n . ?\362)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
224 (?o . ?\365) (?r . ?\370) (?s . ?\271) (?t . ?\273) (?u . ?\373)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
225 (?z . ?\276)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
226 (?v . ?\242) ; v accent
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
227 (?~ . ?\242) ; v accent
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
228 (?. . ?\270) ; cedilla accent
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
229 (?\ . ?~) (space . ?~)))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
230
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
231 ("latin-3" latin-iso8859-3
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
232 (?' (?A . ?\301) (?E . ?\311) (?I . ?\315) (?O . ?\323) (?U . ?\332)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
233 (?a . ?\341) (?e . ?\351) (?i . ?\355) (?o . ?\363) (?u . ?\372)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
234 (?' . ?\264) (?\ . ?') (space . ?'))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
235 (?` (?A . ?\300) (?E . ?\310) (?I . ?\314) (?O . ?\322) (?U . ?\331)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
236 (?a . ?\340) (?e . ?\350) (?i . ?\354) (?o . ?\362) (?u . ?\371)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
237 (?` . ?`) (?\ . ?`) (space . ?`))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
238 (?^ (?A . ?\302) (?C . ?\306) (?E . ?\312) (?G . ?\330)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
239 (?H . ?\246) (?I . ?\316) (?J . ?\254) (?O . ?\324)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
240 (?S . ?\336) (?U . ?\333)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
241 (?a . ?\342) (?c . ?\346) (?e . ?\352) (?g . ?\370) (?h . ?\266)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
242 (?i . ?\356) (?j . ?\274) (?o . ?\364) (?s . ?\376) (?u . ?\373)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
243 (?^ . ?^) (?\ . ?^) (space . \^))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
244 (?\" (?A . ?\304) (?E . ?\313) (?I . ?\317) (?O . ?\326) (?U . ?\334)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
245 (?a . ?\344) (?e . ?\353) (?i . ?\357) (?o . ?\366) (?u . ?\374)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
246 (?s . ?\337)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
247 (?\" . ?\250) (?\ . ?\") (space . ?\"))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
248 (?. (?C . ?\305) (?G . ?\325) (?I . ?\251) (?Z . ?\257)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
249 (?c . ?\345) (?g . ?\365) (?z . ?\277))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
250 (?~ (?A . ?\303) (?C . ?\307) (?D . ?\320) (?G . ?\253) (?N . ?\321)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
251 (?O . ?\325) (?S . ?\252) (?U . ?\335)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
252 (?a . ?\343) (?c . ?\347) (?d . ?\360) (?g . ?\273) (?n . ?\361)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
253 (?o . ?\365) (?s . ?\252) (?u . ?\375)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
254 (?h . ?\261) (?$ . ?\245) (?` . ?\242)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
255 (?~ . ?\270) (?\ . ?~) (space . ?~))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
256 (?/ (?C . ?\305) (?G . ?\325) (?H . ?\241) (?I . ?\251) (?Z . ?\257)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
257 (?c . ?\345) (?g . ?\365) (?h . ?\261) (?i . ?\271) (?z . ?\277)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
258 (?r . ?\256) (?. . ?\377) (?# . ?\243) (?$ . ?\244)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
259 (?/ . ?\260) (?\ . ?/) (space . ?/)))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
260 )
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
261 "List of language-specific customizations for the ISO Accents mode.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
262
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
263 Each element of the list is of the form
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
264
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
265 (LANGUAGE [CHARSET]
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
266 (PSEUDO-ACCENT MAPPINGS)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
267 (PSEUDO-ACCENT MAPPINGS)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
268 ...)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
269
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
270 LANGUAGE is a string naming the language.
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
271 CHARSET (which may be omitted) is the symbol name
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
272 of the character set used in this language.
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
273 If CHARSET is omitted, latin-iso8859-1 is the default.
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
274 PSEUDO-ACCENT is a char specifying an accent key.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
275 MAPPINGS are cons cells of the form (CHAR . ISO-CHAR).
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
276
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
277 The net effect is that the key sequence PSEUDO-ACCENT CHAR is mapped
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
278 to ISO-CHAR on input.")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
279
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
280 (defvar iso-language nil
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
281 "Language for which ISO Accents mode is currently customized.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
282 Change it with the `iso-accents-customize' function.")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
283
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
284 (defvar iso-accents-list nil
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
285 "Association list for ISO accent combinations, for the chosen language.")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
286
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
287 (defvar iso-accents-mode nil
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
288 "*Non-nil enables ISO Accents mode.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
289 Setting this variable makes it local to the current buffer.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
290 See the function `iso-accents-mode'.")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
291 (make-variable-buffer-local 'iso-accents-mode)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
292
94
1040fe1366ac Import from CVS: tag xemacs-20-0f2
cvs
parents: 88
diff changeset
293 (defvar iso-accents-enable '(?' ?` ?^ ?\" ?~ ?/ ?, ?.)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
294 "*List of accent keys that become prefixes in ISO Accents mode.
94
1040fe1366ac Import from CVS: tag xemacs-20-0f2
cvs
parents: 88
diff changeset
295 The default is (?' ?` ?^ ?\" ?~ ?/ ?, ?.), which contains all the supported
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
296 accent keys. If you set this variable to a list in which some of those
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
297 characters are missing, the missing ones do not act as accents.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
298
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
299 Note that if you specify a language with `iso-accents-customize',
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
300 that can also turn off certain prefixes (whichever ones are not needed in
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
301 the language you choose).")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
302
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
303 (defun iso-accents-accent-key (prompt)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
304 "Modify the following character by adding an accent to it."
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
305 ;; Pick up the accent character.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
306 (if (and iso-accents-mode
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
307 (memq last-input-char iso-accents-enable))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
308 (iso-accents-compose prompt)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
309 (char-to-string last-input-char)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
310
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
311 (defun iso-accents-compose (prompt)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
312 (let* ((first-char last-input-char)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
313 (list (assq first-char iso-accents-list))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
314 ;; Wait for the second key and look up the combination.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
315 (second-char (if (or prompt
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
316 (not (eq (key-binding "a")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
317 'self-insert-command))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
318 ;; Not at start of a key sequence.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
319 (> (length (this-single-command-keys)) 1)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
320 ;; Called from anything but the command loop.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
321 this-command)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
322 (progn
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
323 (message "%s%c"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
324 (or prompt "Compose with ")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
325 first-char)
144
318232e2a3f0 Import from CVS: tag r20-2b6
cvs
parents: 94
diff changeset
326 (iso-read-event))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
327 (insert first-char)
144
318232e2a3f0 Import from CVS: tag r20-2b6
cvs
parents: 94
diff changeset
328 (prog1 (iso-read-event)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
329 (delete-region (1- (point)) (point)))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
330 (entry (cdr (assq second-char list))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
331 (if entry
94
1040fe1366ac Import from CVS: tag xemacs-20-0f2
cvs
parents: 88
diff changeset
332 ;; Found it: return the mapped char
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
333 (vector
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
334 (iso-char-to-event
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
335 (if (and (boundp 'enable-multibyte-characters)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
336 enable-multibyte-characters
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
337 (>= entry ?\200))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
338 (+ iso-accents-insert-offset entry)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
339 entry)))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
340 ;; Otherwise, advance and schedule the second key for execution.
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
341 (setq unread-command-events (cons (iso-char-list-to-event
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
342 (list second-char))
94
1040fe1366ac Import from CVS: tag xemacs-20-0f2
cvs
parents: 88
diff changeset
343 unread-command-events))
1040fe1366ac Import from CVS: tag xemacs-20-0f2
cvs
parents: 88
diff changeset
344 (vector (iso-char-to-event first-char)))))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
345
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
346 ;; It is a matter of taste if you want the minor mode indicated
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
347 ;; in the mode line...
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
348 ;; If so, uncomment the next four lines.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
349 ;; (or (assq 'iso-accents-mode minor-mode-alist)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
350 ;; (setq minor-mode-alist
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
351 ;; (append minor-mode-alist
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
352 ;; '((iso-accents-mode " ISO-Acc")))))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
353
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
354 ;;;###autoload
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
355 (defun iso-accents-mode (&optional arg)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
356 "Toggle ISO Accents mode, in which accents modify the following letter.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
357 This permits easy insertion of accented characters according to ISO-8859-1.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
358 When Iso-accents mode is enabled, accent character keys
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
359 \(`, ', \", ^, / and ~) do not self-insert; instead, they modify the following
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
360 letter key so that it inserts an ISO accented letter.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
361
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
362 You can customize ISO Accents mode to a particular language
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
363 with the command `iso-accents-customize'.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
364
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
365 Special combinations: ~c gives a c with cedilla,
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
366 ~d gives an Icelandic eth (d with dash).
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
367 ~t gives an Icelandic thorn.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
368 \"s gives German sharp s.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
369 /a gives a with ring.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
370 /e gives an a-e ligature.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
371 ~< and ~> give guillemots.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
372 ~! gives an inverted exclamation mark.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
373 ~? gives an inverted question mark.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
374
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
375 With an argument, a positive argument enables ISO Accents mode,
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
376 and a negative argument disables it."
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
377
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
378 (interactive "P")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
379
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
380 (if (if arg
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
381 ;; Negative arg means switch it off.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
382 (<= (prefix-numeric-value arg) 0)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
383 ;; No arg means toggle.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
384 iso-accents-mode)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
385 (setq iso-accents-mode nil)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
386
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
387 ;; Enable electric accents.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
388 (setq iso-accents-mode t)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
389
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
390 (defun iso-accents-customize (language)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
391 "Customize the ISO accents machinery for a particular language.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
392 It selects the customization based on the specifications in the
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
393 `iso-languages' variable."
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
394 (interactive (list (completing-read "Language: " iso-languages nil t)))
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
395 (let ((table (cdr (assoc language iso-languages)))
94
1040fe1366ac Import from CVS: tag xemacs-20-0f2
cvs
parents: 88
diff changeset
396 tail)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
397 (if (not table)
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
398 (error "Unknown language `%s'" language)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
399 (setq iso-accents-insert-offset (- (iso-make-char
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
400 (if (symbolp (car table))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
401 (car table)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
402 'latin-iso8859-1))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
403 128))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
404 (if (symbolp (car table))
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
405 (setq table (cdr table)))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
406 (setq iso-language language
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
407 iso-accents-list table)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
408 (if key-translation-map
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
409 (substitute-key-definition
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
410 'iso-accents-accent-key nil key-translation-map)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
411 (setq key-translation-map (make-sparse-keymap)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
412 ;; Set up translations for all the characters that are used as
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
413 ;; accent prefixes in this language.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
414 (setq tail iso-accents-list)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
415 (while tail
94
1040fe1366ac Import from CVS: tag xemacs-20-0f2
cvs
parents: 88
diff changeset
416 (define-key key-translation-map (vector (iso-char-to-event
1040fe1366ac Import from CVS: tag xemacs-20-0f2
cvs
parents: 88
diff changeset
417 (car (car tail))))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
418 'iso-accents-accent-key)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
419 (setq tail (cdr tail))))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
420
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
421 (defun iso-accentuate (start end)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
422 "Convert two-character sequences in region into accented characters.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
423 Noninteractively, this operates on text from START to END.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
424 This uses the same conversion that ISO Accents mode uses for type-in."
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
425 (interactive "r")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
426 (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
427 (save-restriction
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
428 (narrow-to-region start end)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
429 (goto-char start)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
430 (forward-char 1)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
431 (let (entry)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
432 (while (< (point) end)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
433 (if (and (memq (preceding-char) iso-accents-enable)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
434 (setq entry (cdr (assq (following-char) (assq (preceding-char) iso-accents-list)))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
435 (progn
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
436 (forward-char -1)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
437 (delete-char 2)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
438 (insert entry)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
439 (setq end (1- end)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
440 (forward-char 1)))))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
441
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
442 (defun iso-accent-rassoc-unit (value alist)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
443 (let (elt acc)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
444 (while (and alist (not elt))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
445 (setq acc (car (car alist))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
446 elt (car (rassq value (cdr (car alist))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
447 alist (cdr alist)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
448 (if elt
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
449 (cons acc elt))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
450
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
451 (defun iso-unaccentuate (start end)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
452 "Convert accented characters in the region into two-character sequences.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
453 Noninteractively, this operates on text from START to END.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
454 This uses the opposite of the conversion done by ISO Accents mode for type-in."
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
455 (interactive "r")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
456 (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
457 (save-restriction
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
458 (narrow-to-region start end)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
459 (goto-char start)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
460 (let (entry)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
461 (while (< (point) end)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
462 (if (and (> (following-char) 127)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
463 (setq entry (iso-accent-rassoc-unit (following-char)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
464 iso-accents-list)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
465 (progn
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
466 (delete-char 1)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
467 (insert (car entry) (cdr entry))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
468 (setq end (1+ end)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
469 (forward-char 1)))))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
470
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
471 (defun iso-deaccentuate (start end)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
472 "Convert accented characters in the region into unaccented characters.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
473 Noninteractively, this operates on text from START to END."
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
474 (interactive "r")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
475 (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
476 (save-restriction
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
477 (narrow-to-region start end)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
478 (goto-char start)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
479 (let (entry)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
480 (while (< (point) end)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
481 (if (and (> (following-char) 127)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
482 (setq entry (iso-accent-rassoc-unit (following-char)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
483 iso-accents-list)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
484 (progn
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
485 (delete-char 1)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
486 (insert (cdr entry)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
487 (forward-char 1)))))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
488
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
489 ;; Set up the default settings.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
490 (iso-accents-customize "latin-1")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
491
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
492 ;; Use Iso-Accents mode in the minibuffer
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
493 ;; if it was in use in the previous buffer.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
494 (defun iso-acc-minibuf-setup ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
495 (setq iso-accents-mode
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
496 (save-excursion
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
497 (set-buffer (window-buffer minibuffer-scroll-window))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
498 iso-accents-mode)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
499
153
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
500 (if (boundp 'minibuffer-setup-hook)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
501 (add-hook 'minibuffer-setup-hook 'iso-acc-minibuf-setup)
25f70ba0133c Import from CVS: tag r20-3b3
cvs
parents: 144
diff changeset
502 (add-hook 'minibuf-setup-hook 'iso-acc-minibuf-setup))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
503
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
504 ;;; iso-acc.el ends here