annotate lisp/iso/iso-acc.el @ 94:1040fe1366ac xemacs-20-0f2

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