Mercurial > emacs
annotate lisp/international/encoded-kb.el @ 89091:d520353b835a
(emacs-mule, iso-2022-7bit)
(iso-2022-7bit-ss2, iso-2022-7bit-lock, iso-2022-8bit-ss2)
(compound-text, ctext-no-compositions): Remove :charset-list.
author | Dave Love <fx@gnu.org> |
---|---|
date | Sun, 08 Sep 2002 19:47:56 +0000 |
parents | ab210513bef9 |
children | 2f877ed80fa6 |
rev | line source |
---|---|
38414
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
37238
diff
changeset
|
1 ;;; encoded-kb.el --- handler to input multibyte characters encoded somehow |
17052 | 2 |
3 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN. | |
18377
8b4a66c66dd6
Change copyright notice.
Richard M. Stallman <rms@gnu.org>
parents:
17985
diff
changeset
|
4 ;; Licensed to the Free Software Foundation. |
88488 | 5 ;; Copyright (C) 2002 Free Software Foundation, Inc. |
17052 | 6 |
7 ;; This file is part of GNU Emacs. | |
8 | |
9 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
10 ;; it under the terms of the GNU General Public License as published by | |
11 ;; the Free Software Foundation; either version 2, or (at your option) | |
12 ;; any later version. | |
13 | |
14 ;; GNU Emacs is distributed in the hope that it will be useful, | |
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 ;; GNU General Public License for more details. | |
18 | |
19 ;; You should have received a copy of the GNU General Public License | |
17071 | 20 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
22 ;; Boston, MA 02111-1307, USA. | |
17052 | 23 |
38414
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
37238
diff
changeset
|
24 ;;; Commentary: |
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
37238
diff
changeset
|
25 |
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
37238
diff
changeset
|
26 ;;; Code: |
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
37238
diff
changeset
|
27 |
27816
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
28 (defconst encoded-kbd-mode-map (make-sparse-keymap) |
17052 | 29 "Keymap for Encoded-kbd minor mode.") |
30 | |
31 ;; Subsidiary keymaps for handling ISO2022 escape sequences. | |
32 | |
33 (defvar encoded-kbd-iso2022-esc-map | |
34 (let ((map (make-sparse-keymap))) | |
35 (define-key map "$" 'encoded-kbd-iso2022-esc-dollar-prefix) | |
36 (define-key map "(" 'encoded-kbd-iso2022-designation-prefix) | |
37 (define-key map ")" 'encoded-kbd-iso2022-designation-prefix) | |
38 (define-key map "," 'encoded-kbd-iso2022-designation-prefix) | |
39 (define-key map "-" 'encoded-kbd-iso2022-designation-prefix) | |
40 map) | |
41 "Keymap for handling ESC code in Encoded-kbd mode.") | |
17080
d80a8a46437e
Many changes to cope with the above change.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
42 (fset 'encoded-kbd-iso2022-esc-prefix encoded-kbd-iso2022-esc-map) |
17052 | 43 |
44 (defvar encoded-kbd-iso2022-esc-dollar-map | |
45 (let ((map (make-sparse-keymap))) | |
46 (define-key map "(" 'encoded-kbd-iso2022-designation-prefix) | |
47 (define-key map ")" 'encoded-kbd-iso2022-designation-prefix) | |
48 (define-key map "," 'encoded-kbd-iso2022-designation-prefix) | |
49 (define-key map "-" 'encoded-kbd-iso2022-designation-prefix) | |
50 (define-key map "@" 'encoded-kbd-iso2022-designation) | |
51 (define-key map "A" 'encoded-kbd-iso2022-designation) | |
52 (define-key map "B" 'encoded-kbd-iso2022-designation) | |
53 map) | |
17080
d80a8a46437e
Many changes to cope with the above change.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
54 "Keymap for handling ESC $ sequence in Encoded-kbd mode.") |
17052 | 55 (fset 'encoded-kbd-iso2022-esc-dollar-prefix |
56 encoded-kbd-iso2022-esc-dollar-map) | |
57 | |
58 (defvar encoded-kbd-iso2022-designation-map | |
59 (let ((map (make-sparse-keymap)) | |
29267
00ff62c583fe
(encoded-kbd-iso2022-designation-map): Pay attention to that
Kenichi Handa <handa@m17n.org>
parents:
27816
diff
changeset
|
60 (l charset-list) |
00ff62c583fe
(encoded-kbd-iso2022-designation-map): Pay attention to that
Kenichi Handa <handa@m17n.org>
parents:
27816
diff
changeset
|
61 final-char) |
17080
d80a8a46437e
Many changes to cope with the above change.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
62 (while l |
29267
00ff62c583fe
(encoded-kbd-iso2022-designation-map): Pay attention to that
Kenichi Handa <handa@m17n.org>
parents:
27816
diff
changeset
|
63 (setq final-char (charset-iso-final-char (car l))) |
29268
4165d44fcd68
(encoded-kbd-iso2022-designation-map): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
29267
diff
changeset
|
64 (if (> final-char 0) |
29267
00ff62c583fe
(encoded-kbd-iso2022-designation-map): Pay attention to that
Kenichi Handa <handa@m17n.org>
parents:
27816
diff
changeset
|
65 (define-key map (char-to-string final-char) |
00ff62c583fe
(encoded-kbd-iso2022-designation-map): Pay attention to that
Kenichi Handa <handa@m17n.org>
parents:
27816
diff
changeset
|
66 'encoded-kbd-iso2022-designation)) |
17080
d80a8a46437e
Many changes to cope with the above change.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
67 (setq l (cdr l))) |
17052 | 68 map) |
69 "Keymap for handling ISO2022 designation sequence in Encoded-kbd mode.") | |
70 (fset 'encoded-kbd-iso2022-designation-prefix | |
71 encoded-kbd-iso2022-designation-map) | |
72 | |
73 (defvar encoded-kbd-iso2022-non-ascii-map | |
74 (let ((map (make-keymap)) | |
75 (i 32)) | |
76 (while (< i 128) | |
77 (define-key map (char-to-string i) 'encoded-kbd-self-insert-iso2022-7bit) | |
78 (setq i (1+ i))) | |
17080
d80a8a46437e
Many changes to cope with the above change.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
79 (define-key map "\e" 'encoded-kbd-iso2022-esc-prefix) |
19434
31d9ded94ba4
(encoded-kbd-mode): Doc-string modified. Make this a
Kenichi Handa <handa@m17n.org>
parents:
19421
diff
changeset
|
80 (setq i 160) |
31d9ded94ba4
(encoded-kbd-mode): Doc-string modified. Make this a
Kenichi Handa <handa@m17n.org>
parents:
19421
diff
changeset
|
81 (while (< i 256) |
31d9ded94ba4
(encoded-kbd-mode): Doc-string modified. Make this a
Kenichi Handa <handa@m17n.org>
parents:
19421
diff
changeset
|
82 (define-key map (vector i) 'encoded-kbd-handle-8bit) |
31d9ded94ba4
(encoded-kbd-mode): Doc-string modified. Make this a
Kenichi Handa <handa@m17n.org>
parents:
19421
diff
changeset
|
83 (setq i (1+ i))) |
17052 | 84 map) |
85 "Keymap for handling non-ASCII character set in Encoded-kbd mode.") | |
86 | |
87 ;; One of the symbols `sjis', `iso2022-7', `iso2022-8', or `big5' to | |
88 ;; denote what kind of coding-system we are now handling in | |
89 ;; Encoded-kbd mode. | |
90 (defvar encoded-kbd-coding nil) | |
91 | |
27816
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
92 ;; Keep information of designation state of ISO2022 encoding. When |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
93 ;; Encoded-kbd mode is on, this is set to a vector of length 4, the |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
94 ;; elements are character sets currently designated to graphic |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
95 ;; registers 0 thru 3. |
17052 | 96 |
97 (defvar encoded-kbd-iso2022-designations nil) | |
98 (put 'encoded-kbd-iso2022-designations 'permanent-local t) | |
99 | |
27816
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
100 ;; Keep information of invocation state of ISO2022 encoding. When |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
101 ;; Encoded-kbd mode is on, this is set to a vector of length 3, |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
102 ;; graphic register numbers currently invoked to graphic plane 1 and |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
103 ;; 2, and a single shifted graphic register number. |
17052 | 104 |
105 (defvar encoded-kbd-iso2022-invocations nil) | |
106 (put 'encoded-kbd-iso2022-invocations 'permanent-local t) | |
107 | |
108 (defun encoded-kbd-iso2022-designation () | |
23196 | 109 "Do ISO2022 designation according to the current key in Encoded-kbd mode. |
17052 | 110 The following key sequence may cause multilingual text insertion." |
111 (interactive) | |
112 (let ((key-seq (this-command-keys)) | |
19434
31d9ded94ba4
(encoded-kbd-mode): Doc-string modified. Make this a
Kenichi Handa <handa@m17n.org>
parents:
19421
diff
changeset
|
113 (prev-g0-charset (aref encoded-kbd-iso2022-designations |
31d9ded94ba4
(encoded-kbd-mode): Doc-string modified. Make this a
Kenichi Handa <handa@m17n.org>
parents:
19421
diff
changeset
|
114 (aref encoded-kbd-iso2022-invocations 0))) |
17052 | 115 intermediate-char final-char |
116 reg dimension chars charset) | |
17080
d80a8a46437e
Many changes to cope with the above change.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
117 (if (= (length key-seq) 4) |
d80a8a46437e
Many changes to cope with the above change.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
118 ;; ESC $ <intermediate-char> <final-char> |
d80a8a46437e
Many changes to cope with the above change.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
119 (setq intermediate-char (aref key-seq 2) |
17052 | 120 dimension 2 |
121 chars (if (< intermediate-char ?,) 94 96) | |
17080
d80a8a46437e
Many changes to cope with the above change.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
122 final-char (aref key-seq 3) |
17052 | 123 reg (mod intermediate-char 4)) |
124 (if (= (aref key-seq 1) ?$) | |
17080
d80a8a46437e
Many changes to cope with the above change.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
125 ;; ESC $ <final-char> |
17052 | 126 (setq dimension 2 |
127 chars 94 | |
17080
d80a8a46437e
Many changes to cope with the above change.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
128 final-char (aref key-seq 2) |
17052 | 129 reg 0) |
17080
d80a8a46437e
Many changes to cope with the above change.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
130 ;; ESC <intermediate-char> <final-char> |
d80a8a46437e
Many changes to cope with the above change.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
131 (setq intermediate-char (aref key-seq 1) |
17052 | 132 dimension 1 |
133 chars (if (< intermediate-char ?,) 94 96) | |
17080
d80a8a46437e
Many changes to cope with the above change.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
134 final-char (aref key-seq 2) |
17052 | 135 reg (mod intermediate-char 4)))) |
136 (if (setq charset (iso-charset dimension chars final-char)) | |
137 (aset encoded-kbd-iso2022-designations reg charset) | |
138 (error "Character set of DIMENSION %s, CHARS %s, FINAL-CHAR `%c' is not supported" | |
139 dimension chars final-char)) | |
140 | |
17080
d80a8a46437e
Many changes to cope with the above change.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
141 (if (memq (aref encoded-kbd-iso2022-designations |
19434
31d9ded94ba4
(encoded-kbd-mode): Doc-string modified. Make this a
Kenichi Handa <handa@m17n.org>
parents:
19421
diff
changeset
|
142 (aref encoded-kbd-iso2022-invocations 0)) |
17080
d80a8a46437e
Many changes to cope with the above change.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
143 '(ascii latin-jisx0201)) |
17052 | 144 ;; Graphic plane 0 (0x20..0x7f) is for ASCII. We don't have |
145 ;; to handle characters in this range specially. | |
19434
31d9ded94ba4
(encoded-kbd-mode): Doc-string modified. Make this a
Kenichi Handa <handa@m17n.org>
parents:
19421
diff
changeset
|
146 (if (not (memq prev-g0-charset '(ascii latin-jisx0201))) |
23196 | 147 ;; We must exit recursive edit now. |
19434
31d9ded94ba4
(encoded-kbd-mode): Doc-string modified. Make this a
Kenichi Handa <handa@m17n.org>
parents:
19421
diff
changeset
|
148 (throw 'exit nil)) |
17052 | 149 ;; Graphic plane 0 is for non-ASCII. |
19434
31d9ded94ba4
(encoded-kbd-mode): Doc-string modified. Make this a
Kenichi Handa <handa@m17n.org>
parents:
19421
diff
changeset
|
150 (if (memq prev-g0-charset '(ascii latin-jisx0201)) |
23196 | 151 ;; We must handle keys specially. |
19434
31d9ded94ba4
(encoded-kbd-mode): Doc-string modified. Make this a
Kenichi Handa <handa@m17n.org>
parents:
19421
diff
changeset
|
152 (let ((overriding-local-map encoded-kbd-iso2022-non-ascii-map)) |
31d9ded94ba4
(encoded-kbd-mode): Doc-string modified. Make this a
Kenichi Handa <handa@m17n.org>
parents:
19421
diff
changeset
|
153 (recursive-edit)))))) |
17052 | 154 |
155 (defun encoded-kbd-handle-8bit () | |
23196 | 156 "Handle an 8-bit character entered in Encoded-kbd mode." |
17052 | 157 (interactive) |
158 (cond ((eq encoded-kbd-coding 'iso2022-7) | |
159 (error "Can't handle the character code %d" last-command-char)) | |
160 | |
161 ((eq encoded-kbd-coding 'iso2022-8) | |
162 (cond ((= last-command-char ?\216) | |
163 (aset encoded-kbd-iso2022-invocations 2 2)) | |
164 | |
165 ((= last-command-char ?\217) | |
166 (aset encoded-kbd-iso2022-invocations 2 3)) | |
167 | |
24393
fcaabeb8aece
(encoded-kbd-handle-8bit): Allow inputting ?\240.
Kenichi Handa <handa@m17n.org>
parents:
23196
diff
changeset
|
168 ((>= last-command-char ?\240) |
88525
3629e02a95c1
(encoded-kbd-handle-8bit): Call
Kenichi Handa <handa@m17n.org>
parents:
88493
diff
changeset
|
169 (encoded-kbd-self-insert-iso2022-8bit 1)) |
17052 | 170 |
171 (t | |
172 (error "Can't handle the character code %d" | |
173 last-command-char)))) | |
174 | |
175 ((eq encoded-kbd-coding 'sjis) | |
176 (encoded-kbd-self-insert-sjis)) | |
177 | |
178 (t | |
179 (encoded-kbd-self-insert-big5)))) | |
180 | |
181 (defun encoded-kbd-self-insert-iso2022-7bit () | |
182 (interactive) | |
183 (let* ((charset (aref encoded-kbd-iso2022-designations | |
184 (or (aref encoded-kbd-iso2022-invocations 2) | |
185 (aref encoded-kbd-iso2022-invocations 0)))) | |
25042
bf96605e00ee
(encoded-kbd-self-insert-iso2022-7bit): Don't insert the character
Kenichi Handa <handa@m17n.org>
parents:
24393
diff
changeset
|
186 (char (if (= (charset-dimension charset) 1) |
bf96605e00ee
(encoded-kbd-self-insert-iso2022-7bit): Don't insert the character
Kenichi Handa <handa@m17n.org>
parents:
24393
diff
changeset
|
187 (make-char charset last-command-char) |
bf96605e00ee
(encoded-kbd-self-insert-iso2022-7bit): Don't insert the character
Kenichi Handa <handa@m17n.org>
parents:
24393
diff
changeset
|
188 (make-char charset last-command-char (read-char-exclusive))))) |
17052 | 189 (aset encoded-kbd-iso2022-invocations 2 nil) |
25042
bf96605e00ee
(encoded-kbd-self-insert-iso2022-7bit): Don't insert the character
Kenichi Handa <handa@m17n.org>
parents:
24393
diff
changeset
|
190 (setq unread-command-events (cons char unread-command-events)))) |
17052 | 191 |
88493
410ca4f1df02
(encoded-kbd-self-insert-iso2022-8bit): New arg ARG. Directly
Kenichi Handa <handa@m17n.org>
parents:
88488
diff
changeset
|
192 (defun encoded-kbd-self-insert-iso2022-8bit (arg) |
410ca4f1df02
(encoded-kbd-self-insert-iso2022-8bit): New arg ARG. Directly
Kenichi Handa <handa@m17n.org>
parents:
88488
diff
changeset
|
193 (interactive "p") |
27816
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
194 (cond |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
195 ((= last-command-char ?\216) ; SS2 (Single Shift 2) |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
196 (aset encoded-kbd-iso2022-invocations 2 2)) |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
197 ((= last-command-char ?\217) ; SS3 (Single Shift 3) |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
198 (aset encoded-kbd-iso2022-invocations 2 3)) |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
199 (t |
88493
410ca4f1df02
(encoded-kbd-self-insert-iso2022-8bit): New arg ARG. Directly
Kenichi Handa <handa@m17n.org>
parents:
88488
diff
changeset
|
200 (let* ((charset (aref encoded-kbd-iso2022-designations |
410ca4f1df02
(encoded-kbd-self-insert-iso2022-8bit): New arg ARG. Directly
Kenichi Handa <handa@m17n.org>
parents:
88488
diff
changeset
|
201 (or (aref encoded-kbd-iso2022-invocations 2) |
410ca4f1df02
(encoded-kbd-self-insert-iso2022-8bit): New arg ARG. Directly
Kenichi Handa <handa@m17n.org>
parents:
88488
diff
changeset
|
202 (aref encoded-kbd-iso2022-invocations 1)))) |
410ca4f1df02
(encoded-kbd-self-insert-iso2022-8bit): New arg ARG. Directly
Kenichi Handa <handa@m17n.org>
parents:
88488
diff
changeset
|
203 (char (if (= (charset-dimension charset) 1) |
410ca4f1df02
(encoded-kbd-self-insert-iso2022-8bit): New arg ARG. Directly
Kenichi Handa <handa@m17n.org>
parents:
88488
diff
changeset
|
204 (make-char charset last-command-char) |
27816
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
205 (make-char charset last-command-char |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
206 (read-char-exclusive))))) |
88493
410ca4f1df02
(encoded-kbd-self-insert-iso2022-8bit): New arg ARG. Directly
Kenichi Handa <handa@m17n.org>
parents:
88488
diff
changeset
|
207 (aset encoded-kbd-iso2022-invocations 2 nil) |
410ca4f1df02
(encoded-kbd-self-insert-iso2022-8bit): New arg ARG. Directly
Kenichi Handa <handa@m17n.org>
parents:
88488
diff
changeset
|
208 ;; As simply setting unread-command-events may result in |
410ca4f1df02
(encoded-kbd-self-insert-iso2022-8bit): New arg ARG. Directly
Kenichi Handa <handa@m17n.org>
parents:
88488
diff
changeset
|
209 ;; infinite-loop for characters 160..255, this is a temporary |
410ca4f1df02
(encoded-kbd-self-insert-iso2022-8bit): New arg ARG. Directly
Kenichi Handa <handa@m17n.org>
parents:
88488
diff
changeset
|
210 ;; workaround until we found a better solution. |
410ca4f1df02
(encoded-kbd-self-insert-iso2022-8bit): New arg ARG. Directly
Kenichi Handa <handa@m17n.org>
parents:
88488
diff
changeset
|
211 (let ((last-command-char char)) |
410ca4f1df02
(encoded-kbd-self-insert-iso2022-8bit): New arg ARG. Directly
Kenichi Handa <handa@m17n.org>
parents:
88488
diff
changeset
|
212 (self-insert-command arg)))))) |
17052 | 213 |
214 (defun encoded-kbd-self-insert-sjis () | |
215 (interactive) | |
25042
bf96605e00ee
(encoded-kbd-self-insert-iso2022-7bit): Don't insert the character
Kenichi Handa <handa@m17n.org>
parents:
24393
diff
changeset
|
216 (let ((char (if (or (< last-command-char ?\xA0) (>= last-command-char ?\xE0)) |
bf96605e00ee
(encoded-kbd-self-insert-iso2022-7bit): Don't insert the character
Kenichi Handa <handa@m17n.org>
parents:
24393
diff
changeset
|
217 (decode-sjis-char (+ (ash last-command-char 8) |
bf96605e00ee
(encoded-kbd-self-insert-iso2022-7bit): Don't insert the character
Kenichi Handa <handa@m17n.org>
parents:
24393
diff
changeset
|
218 (read-char-exclusive))) |
bf96605e00ee
(encoded-kbd-self-insert-iso2022-7bit): Don't insert the character
Kenichi Handa <handa@m17n.org>
parents:
24393
diff
changeset
|
219 (make-char 'katakana-jisx0201 last-command-char)))) |
bf96605e00ee
(encoded-kbd-self-insert-iso2022-7bit): Don't insert the character
Kenichi Handa <handa@m17n.org>
parents:
24393
diff
changeset
|
220 (setq unread-command-events (cons char unread-command-events)))) |
17052 | 221 |
222 (defun encoded-kbd-self-insert-big5 () | |
223 (interactive) | |
25042
bf96605e00ee
(encoded-kbd-self-insert-iso2022-7bit): Don't insert the character
Kenichi Handa <handa@m17n.org>
parents:
24393
diff
changeset
|
224 (let ((char (decode-big5-char (+ (ash last-command-char 8) |
bf96605e00ee
(encoded-kbd-self-insert-iso2022-7bit): Don't insert the character
Kenichi Handa <handa@m17n.org>
parents:
24393
diff
changeset
|
225 (read-char-exclusive))))) |
bf96605e00ee
(encoded-kbd-self-insert-iso2022-7bit): Don't insert the character
Kenichi Handa <handa@m17n.org>
parents:
24393
diff
changeset
|
226 (setq unread-command-events (cons char unread-command-events)))) |
17052 | 227 |
27816
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
228 (defun encoded-kbd-self-insert-ccl () |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
229 (interactive) |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
230 (let ((str (char-to-string last-command-char)) |
88487 | 231 (ccl (coding-system-get (keyboard-coding-system) :ccl-decoder)) |
37095
416e07ad047e
(encoded-kbd-self-insert-ccl):
Kenichi Handa <handa@m17n.org>
parents:
36954
diff
changeset
|
232 (vec [nil nil nil nil nil nil nil nil nil]) |
36954
798d1ac75e95
(encoded-kbd-self-insert-ccl): Call ccl-execute-on-string directly so
Kenichi Handa <handa@m17n.org>
parents:
29268
diff
changeset
|
233 result) |
798d1ac75e95
(encoded-kbd-self-insert-ccl): Call ccl-execute-on-string directly so
Kenichi Handa <handa@m17n.org>
parents:
29268
diff
changeset
|
234 (while (= (length (setq result (ccl-execute-on-string ccl vec str t))) 0) |
37095
416e07ad047e
(encoded-kbd-self-insert-ccl):
Kenichi Handa <handa@m17n.org>
parents:
36954
diff
changeset
|
235 (dotimes (i 9) (aset vec i nil)) |
416e07ad047e
(encoded-kbd-self-insert-ccl):
Kenichi Handa <handa@m17n.org>
parents:
36954
diff
changeset
|
236 (setq str (format "%s%c" str (read-char-exclusive)))) |
27816
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
237 (setq unread-command-events |
37238 | 238 (append result unread-command-events)))) |
27816
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
239 |
88525
3629e02a95c1
(encoded-kbd-handle-8bit): Call
Kenichi Handa <handa@m17n.org>
parents:
88493
diff
changeset
|
240 (defun encoded-kbd-self-insert-charset (arg) |
3629e02a95c1
(encoded-kbd-handle-8bit): Call
Kenichi Handa <handa@m17n.org>
parents:
88493
diff
changeset
|
241 (interactive "p") |
3629e02a95c1
(encoded-kbd-handle-8bit): Call
Kenichi Handa <handa@m17n.org>
parents:
88493
diff
changeset
|
242 (let* ((charset-list |
3629e02a95c1
(encoded-kbd-handle-8bit): Call
Kenichi Handa <handa@m17n.org>
parents:
88493
diff
changeset
|
243 (coding-system-get (keyboard-coding-system) :charset-list)) |
3629e02a95c1
(encoded-kbd-handle-8bit): Call
Kenichi Handa <handa@m17n.org>
parents:
88493
diff
changeset
|
244 (charset (car charset-list)) |
3629e02a95c1
(encoded-kbd-handle-8bit): Call
Kenichi Handa <handa@m17n.org>
parents:
88493
diff
changeset
|
245 ;; For the moment, we can assume that the length of CHARSET-LIST |
3629e02a95c1
(encoded-kbd-handle-8bit): Call
Kenichi Handa <handa@m17n.org>
parents:
88493
diff
changeset
|
246 ;; is 1, and the dimension of CHARSET is 1. |
3629e02a95c1
(encoded-kbd-handle-8bit): Call
Kenichi Handa <handa@m17n.org>
parents:
88493
diff
changeset
|
247 (c (decode-char charset last-command-char))) |
3629e02a95c1
(encoded-kbd-handle-8bit): Call
Kenichi Handa <handa@m17n.org>
parents:
88493
diff
changeset
|
248 (unless c |
3629e02a95c1
(encoded-kbd-handle-8bit): Call
Kenichi Handa <handa@m17n.org>
parents:
88493
diff
changeset
|
249 (error "Can't decode the code point %d by %s" |
3629e02a95c1
(encoded-kbd-handle-8bit): Call
Kenichi Handa <handa@m17n.org>
parents:
88493
diff
changeset
|
250 last-command-char charset)) |
3629e02a95c1
(encoded-kbd-handle-8bit): Call
Kenichi Handa <handa@m17n.org>
parents:
88493
diff
changeset
|
251 ;; As simply setting unread-command-events may result in |
3629e02a95c1
(encoded-kbd-handle-8bit): Call
Kenichi Handa <handa@m17n.org>
parents:
88493
diff
changeset
|
252 ;; infinite-loop for characters 160..255, this is a temporary |
3629e02a95c1
(encoded-kbd-handle-8bit): Call
Kenichi Handa <handa@m17n.org>
parents:
88493
diff
changeset
|
253 ;; workaround until we found a better solution. |
3629e02a95c1
(encoded-kbd-handle-8bit): Call
Kenichi Handa <handa@m17n.org>
parents:
88493
diff
changeset
|
254 (let ((last-command-char c)) |
3629e02a95c1
(encoded-kbd-handle-8bit): Call
Kenichi Handa <handa@m17n.org>
parents:
88493
diff
changeset
|
255 (self-insert-command arg)))) |
3629e02a95c1
(encoded-kbd-handle-8bit): Call
Kenichi Handa <handa@m17n.org>
parents:
88493
diff
changeset
|
256 |
27816
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
257 (defun encoded-kbd-setup-keymap (coding) |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
258 ;; At first, reset the keymap. |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
259 (setcdr encoded-kbd-mode-map nil) |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
260 ;; Then setup the keymap according to the keyboard coding system. |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
261 (cond |
88525
3629e02a95c1
(encoded-kbd-handle-8bit): Call
Kenichi Handa <handa@m17n.org>
parents:
88493
diff
changeset
|
262 ((eq encoded-kbd-coding 'charset) |
3629e02a95c1
(encoded-kbd-handle-8bit): Call
Kenichi Handa <handa@m17n.org>
parents:
88493
diff
changeset
|
263 (let* ((charset (car (coding-system-get coding :charset-list))) |
3629e02a95c1
(encoded-kbd-handle-8bit): Call
Kenichi Handa <handa@m17n.org>
parents:
88493
diff
changeset
|
264 (code-space (get-charset-property charset :code-space)) |
3629e02a95c1
(encoded-kbd-handle-8bit): Call
Kenichi Handa <handa@m17n.org>
parents:
88493
diff
changeset
|
265 (from (max (aref code-space 0) 128)) |
3629e02a95c1
(encoded-kbd-handle-8bit): Call
Kenichi Handa <handa@m17n.org>
parents:
88493
diff
changeset
|
266 (to (aref code-space 1))) |
3629e02a95c1
(encoded-kbd-handle-8bit): Call
Kenichi Handa <handa@m17n.org>
parents:
88493
diff
changeset
|
267 (while (<= from to) |
3629e02a95c1
(encoded-kbd-handle-8bit): Call
Kenichi Handa <handa@m17n.org>
parents:
88493
diff
changeset
|
268 (define-key encoded-kbd-mode-map |
3629e02a95c1
(encoded-kbd-handle-8bit): Call
Kenichi Handa <handa@m17n.org>
parents:
88493
diff
changeset
|
269 (vector from) 'encoded-kbd-self-insert-charset) |
3629e02a95c1
(encoded-kbd-handle-8bit): Call
Kenichi Handa <handa@m17n.org>
parents:
88493
diff
changeset
|
270 (setq from (1+ from))))) |
3629e02a95c1
(encoded-kbd-handle-8bit): Call
Kenichi Handa <handa@m17n.org>
parents:
88493
diff
changeset
|
271 |
27816
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
272 ((eq encoded-kbd-coding 'sjis) |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
273 (let ((i 128)) |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
274 (while (< i 256) |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
275 (define-key encoded-kbd-mode-map |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
276 (vector i) 'encoded-kbd-self-insert-sjis) |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
277 (setq i (1+ i))))) |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
278 |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
279 ((eq encoded-kbd-coding 'big5) |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
280 (let ((i 161)) |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
281 (while (< i 255) |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
282 (define-key encoded-kbd-mode-map |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
283 (vector i) 'encoded-kbd-self-insert-big5) |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
284 (setq i (1+ i))))) |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
285 |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
286 ((eq encoded-kbd-coding 'iso2022-7) |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
287 (define-key encoded-kbd-mode-map "\e" 'encoded-kbd-iso2022-esc-prefix)) |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
288 |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
289 ((eq encoded-kbd-coding 'iso2022-8) |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
290 (define-key encoded-kbd-mode-map |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
291 (vector ?\216) 'encoded-kbd-self-insert-iso2022-8bit) |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
292 (define-key encoded-kbd-mode-map |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
293 (vector ?\217) 'encoded-kbd-self-insert-iso2022-8bit) |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
294 (let ((i 160)) |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
295 (while (< i 256) |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
296 (define-key encoded-kbd-mode-map |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
297 (vector i) 'encoded-kbd-self-insert-iso2022-8bit) |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
298 (setq i (1+ i))))) |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
299 |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
300 ((eq encoded-kbd-coding 'ccl) |
88653 | 301 (let ((valid-codes (or (coding-system-get coding :valid) |
36954
798d1ac75e95
(encoded-kbd-self-insert-ccl): Call ccl-execute-on-string directly so
Kenichi Handa <handa@m17n.org>
parents:
29268
diff
changeset
|
302 '((128 . 255)))) |
27816
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
303 elt from to) |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
304 (while valid-codes |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
305 (setq elt (car valid-codes) valid-codes (cdr valid-codes)) |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
306 (if (consp elt) |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
307 (setq from (car elt) to (cdr elt)) |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
308 (setq from (setq to elt))) |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
309 (while (<= from to) |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
310 (if (>= from 128) |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
311 (define-key encoded-kbd-mode-map |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
312 (vector from) 'encoded-kbd-self-insert-ccl)) |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
313 (setq from (1+ from)))))) |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
314 |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
315 (t |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
316 (error "Invalid value in encoded-kbd-coding: %s" encoded-kbd-coding)))) |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
317 |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
318 |
19268
ecb55608fa91
(saved-input-mode): New variable.
Kenichi Handa <handa@m17n.org>
parents:
18697
diff
changeset
|
319 ;; Input mode at the time Encoded-kbd mode is turned on is saved here. |
ecb55608fa91
(saved-input-mode): New variable.
Kenichi Handa <handa@m17n.org>
parents:
18697
diff
changeset
|
320 (defvar saved-input-mode nil) |
ecb55608fa91
(saved-input-mode): New variable.
Kenichi Handa <handa@m17n.org>
parents:
18697
diff
changeset
|
321 |
41715
3fb1c54eb631
(encoded-kbd-mode): Use define-minor-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41344
diff
changeset
|
322 (put 'encoded-kbd-mode 'permanent-local t) |
17080
d80a8a46437e
Many changes to cope with the above change.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
323 ;;;###autoload |
41715
3fb1c54eb631
(encoded-kbd-mode): Use define-minor-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41344
diff
changeset
|
324 (define-minor-mode encoded-kbd-mode |
17052 | 325 "Toggle Encoded-kbd minor mode. |
19268
ecb55608fa91
(saved-input-mode): New variable.
Kenichi Handa <handa@m17n.org>
parents:
18697
diff
changeset
|
326 With arg, turn Encoded-kbd mode on if and only if arg is positive. |
17052 | 327 |
19434
31d9ded94ba4
(encoded-kbd-mode): Doc-string modified. Make this a
Kenichi Handa <handa@m17n.org>
parents:
19421
diff
changeset
|
328 You should not turn this mode on manually, instead use the command |
21700
e225fec97357
(encoded-kbd-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
19434
diff
changeset
|
329 \\[set-keyboard-coding-system] which turns on or off this mode |
19434
31d9ded94ba4
(encoded-kbd-mode): Doc-string modified. Make this a
Kenichi Handa <handa@m17n.org>
parents:
19421
diff
changeset
|
330 automatically. |
31d9ded94ba4
(encoded-kbd-mode): Doc-string modified. Make this a
Kenichi Handa <handa@m17n.org>
parents:
19421
diff
changeset
|
331 |
31d9ded94ba4
(encoded-kbd-mode): Doc-string modified. Make this a
Kenichi Handa <handa@m17n.org>
parents:
19421
diff
changeset
|
332 In Encoded-kbd mode, a text sent from keyboard is accepted |
31d9ded94ba4
(encoded-kbd-mode): Doc-string modified. Make this a
Kenichi Handa <handa@m17n.org>
parents:
19421
diff
changeset
|
333 as a multilingual text encoded in a coding system set by |
21700
e225fec97357
(encoded-kbd-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
19434
diff
changeset
|
334 \\[set-keyboard-coding-system]." |
41715
3fb1c54eb631
(encoded-kbd-mode): Use define-minor-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41344
diff
changeset
|
335 :global t |
3fb1c54eb631
(encoded-kbd-mode): Use define-minor-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41344
diff
changeset
|
336 ;; We must at first reset input-mode to the original. |
3fb1c54eb631
(encoded-kbd-mode): Use define-minor-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41344
diff
changeset
|
337 (if saved-input-mode (apply 'set-input-mode saved-input-mode)) |
17052 | 338 (if encoded-kbd-mode |
19268
ecb55608fa91
(saved-input-mode): New variable.
Kenichi Handa <handa@m17n.org>
parents:
18697
diff
changeset
|
339 (let ((coding (keyboard-coding-system))) |
ecb55608fa91
(saved-input-mode): New variable.
Kenichi Handa <handa@m17n.org>
parents:
18697
diff
changeset
|
340 (setq saved-input-mode (current-input-mode)) |
17052 | 341 (cond ((null coding) |
88488 | 342 (setq encoded-kbd-mode nil) |
19268
ecb55608fa91
(saved-input-mode): New variable.
Kenichi Handa <handa@m17n.org>
parents:
18697
diff
changeset
|
343 (error "No coding system for keyboard input is set")) |
17052 | 344 |
88493
410ca4f1df02
(encoded-kbd-self-insert-iso2022-8bit): New arg ARG. Directly
Kenichi Handa <handa@m17n.org>
parents:
88488
diff
changeset
|
345 ((eq (coding-system-type coding) 'shift-jis) |
19268
ecb55608fa91
(saved-input-mode): New variable.
Kenichi Handa <handa@m17n.org>
parents:
18697
diff
changeset
|
346 (set-input-mode |
ecb55608fa91
(saved-input-mode): New variable.
Kenichi Handa <handa@m17n.org>
parents:
18697
diff
changeset
|
347 (nth 0 saved-input-mode) (nth 1 saved-input-mode) |
88488 | 348 'use-8th-bit (nth 3 saved-input-mode)) |
17052 | 349 (setq encoded-kbd-coding 'sjis)) |
350 | |
88487 | 351 ((eq (coding-system-type coding) 'iso-2022) |
352 (if (memq '7-bit (coding-system-get coding :flags)) | |
17052 | 353 (setq encoded-kbd-coding 'iso2022-7) |
19268
ecb55608fa91
(saved-input-mode): New variable.
Kenichi Handa <handa@m17n.org>
parents:
18697
diff
changeset
|
354 (set-input-mode |
ecb55608fa91
(saved-input-mode): New variable.
Kenichi Handa <handa@m17n.org>
parents:
18697
diff
changeset
|
355 (nth 0 saved-input-mode) (nth 1 saved-input-mode) |
88488 | 356 'use-8th-bit (nth 3 saved-input-mode)) |
17052 | 357 (setq encoded-kbd-coding 'iso2022-8)) |
88487 | 358 (setq encoded-kbd-iso2022-designations |
359 (coding-system-get coding :designation)) | |
17080
d80a8a46437e
Many changes to cope with the above change.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
360 (setq encoded-kbd-iso2022-invocations (make-vector 3 nil)) |
d80a8a46437e
Many changes to cope with the above change.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
361 (aset encoded-kbd-iso2022-invocations 0 0) |
17052 | 362 (aset encoded-kbd-iso2022-invocations 1 1)) |
363 | |
88487 | 364 ((eq (coding-system-type coding) 'big5) |
19268
ecb55608fa91
(saved-input-mode): New variable.
Kenichi Handa <handa@m17n.org>
parents:
18697
diff
changeset
|
365 (set-input-mode |
ecb55608fa91
(saved-input-mode): New variable.
Kenichi Handa <handa@m17n.org>
parents:
18697
diff
changeset
|
366 (nth 0 saved-input-mode) (nth 1 saved-input-mode) |
88488 | 367 'use-8th-bit (nth 3 saved-input-mode)) |
17052 | 368 (setq encoded-kbd-coding 'big5)) |
369 | |
88487 | 370 ((eq (coding-system-type coding) 'ccl) |
27816
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
371 (set-input-mode |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
372 (nth 0 saved-input-mode) (nth 1 saved-input-mode) |
88488 | 373 'use-8th-bit (nth 3 saved-input-mode)) |
27816
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
374 (setq encoded-kbd-coding 'ccl)) |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
375 |
88525
3629e02a95c1
(encoded-kbd-handle-8bit): Call
Kenichi Handa <handa@m17n.org>
parents:
88493
diff
changeset
|
376 ((and (eq (coding-system-type coding) 'charset) |
3629e02a95c1
(encoded-kbd-handle-8bit): Call
Kenichi Handa <handa@m17n.org>
parents:
88493
diff
changeset
|
377 (let* ((charset-list (coding-system-get coding |
3629e02a95c1
(encoded-kbd-handle-8bit): Call
Kenichi Handa <handa@m17n.org>
parents:
88493
diff
changeset
|
378 :charset-list)) |
3629e02a95c1
(encoded-kbd-handle-8bit): Call
Kenichi Handa <handa@m17n.org>
parents:
88493
diff
changeset
|
379 (charset (car charset-list))) |
3629e02a95c1
(encoded-kbd-handle-8bit): Call
Kenichi Handa <handa@m17n.org>
parents:
88493
diff
changeset
|
380 (and (= (length charset-list) 1) |
3629e02a95c1
(encoded-kbd-handle-8bit): Call
Kenichi Handa <handa@m17n.org>
parents:
88493
diff
changeset
|
381 (= (charset-dimension charset) 1)))) |
3629e02a95c1
(encoded-kbd-handle-8bit): Call
Kenichi Handa <handa@m17n.org>
parents:
88493
diff
changeset
|
382 (set-input-mode |
3629e02a95c1
(encoded-kbd-handle-8bit): Call
Kenichi Handa <handa@m17n.org>
parents:
88493
diff
changeset
|
383 (nth 0 saved-input-mode) (nth 1 saved-input-mode) |
3629e02a95c1
(encoded-kbd-handle-8bit): Call
Kenichi Handa <handa@m17n.org>
parents:
88493
diff
changeset
|
384 'use-8th-bit (nth 3 saved-input-mode)) |
3629e02a95c1
(encoded-kbd-handle-8bit): Call
Kenichi Handa <handa@m17n.org>
parents:
88493
diff
changeset
|
385 (setq encoded-kbd-coding 'charset)) |
3629e02a95c1
(encoded-kbd-handle-8bit): Call
Kenichi Handa <handa@m17n.org>
parents:
88493
diff
changeset
|
386 |
17052 | 387 (t |
388 (setq encoded-kbd-mode nil) | |
389 (error "Coding-system `%s' is not supported in Encoded-kbd mode" | |
390 (keyboard-coding-system)))) | |
41715
3fb1c54eb631
(encoded-kbd-mode): Use define-minor-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41344
diff
changeset
|
391 (encoded-kbd-setup-keymap coding)))) |
17052 | 392 |
393 ;;; encoded-kb.el ends here |