Mercurial > emacs
annotate lisp/international/encoded-kb.el @ 88061:9a83d6184f1f
*** empty log message ***
author | Martin Rudalics <rudalics@gmx.at> |
---|---|
date | Tue, 29 Jan 2008 17:40:19 +0000 |
parents | 107ccd98fa12 |
children | 606f2d163a64 |
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 |
79709 | 3 ;; Copyright (C) 1997, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 |
74544 | 4 ;; Free Software Foundation, Inc. |
74605
6ee41fdd69ff
Update AIST copyright years.
Kenichi Handa <handa@m17n.org>
parents:
74544
diff
changeset
|
5 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, |
79709 | 6 ;; 2005, 2006, 2007, 2008 |
62274 | 7 ;; National Institute of Advanced Industrial Science and Technology (AIST) |
8 ;; Registration Number H14PRO021 | |
17052 | 9 |
10 ;; This file is part of GNU Emacs. | |
11 | |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
13 ;; it under the terms of the GNU General Public License as published by | |
78310
2daf9c28b3a4
Restore comma mistakenly removed in last change.
Glenn Morris <rgm@gnu.org>
parents:
78301
diff
changeset
|
14 ;; the Free Software Foundation; either version 3, or (at your option) |
17052 | 15 ;; any later version. |
16 | |
17 ;; GNU Emacs is distributed in the hope that it will be useful, | |
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 ;; GNU General Public License for more details. | |
21 | |
22 ;; You should have received a copy of the GNU General Public License | |
17071 | 23 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
64085 | 24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
25 ;; Boston, MA 02110-1301, USA. | |
17052 | 26 |
38414
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
37238
diff
changeset
|
27 ;;; Commentary: |
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
37238
diff
changeset
|
28 |
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
37238
diff
changeset
|
29 ;;; Code: |
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
37238
diff
changeset
|
30 |
56597
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
31 ;; Usually this map is empty (even if Encoded-kbd mode is on), but if |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
32 ;; the keyboard coding system is iso-2022-based, it defines dummy key |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
33 ;; bindings for ESC $ ..., etc. so that those bindings in |
85110
7960438eca87
(encoded-kbd-setup-display):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83648
diff
changeset
|
34 ;; input-decode-map take effect. |
27816
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
35 (defconst encoded-kbd-mode-map (make-sparse-keymap) |
17052 | 36 "Keymap for Encoded-kbd minor mode.") |
37 | |
38 ;; Subsidiary keymaps for handling ISO2022 escape sequences. | |
39 | |
40 (defvar encoded-kbd-iso2022-esc-map | |
41 (let ((map (make-sparse-keymap))) | |
42 (define-key map "$" 'encoded-kbd-iso2022-esc-dollar-prefix) | |
43 (define-key map "(" 'encoded-kbd-iso2022-designation-prefix) | |
44 (define-key map ")" 'encoded-kbd-iso2022-designation-prefix) | |
45 (define-key map "," 'encoded-kbd-iso2022-designation-prefix) | |
46 (define-key map "-" 'encoded-kbd-iso2022-designation-prefix) | |
47 map) | |
48 "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
|
49 (fset 'encoded-kbd-iso2022-esc-prefix encoded-kbd-iso2022-esc-map) |
17052 | 50 |
51 (defvar encoded-kbd-iso2022-esc-dollar-map | |
52 (let ((map (make-sparse-keymap))) | |
53 (define-key map "(" 'encoded-kbd-iso2022-designation-prefix) | |
54 (define-key map ")" 'encoded-kbd-iso2022-designation-prefix) | |
55 (define-key map "," 'encoded-kbd-iso2022-designation-prefix) | |
56 (define-key map "-" 'encoded-kbd-iso2022-designation-prefix) | |
57 (define-key map "@" 'encoded-kbd-iso2022-designation) | |
58 (define-key map "A" 'encoded-kbd-iso2022-designation) | |
59 (define-key map "B" 'encoded-kbd-iso2022-designation) | |
60 map) | |
17080
d80a8a46437e
Many changes to cope with the above change.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
61 "Keymap for handling ESC $ sequence in Encoded-kbd mode.") |
17052 | 62 (fset 'encoded-kbd-iso2022-esc-dollar-prefix |
63 encoded-kbd-iso2022-esc-dollar-map) | |
64 | |
65 (defvar encoded-kbd-iso2022-designation-map | |
66 (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
|
67 (l charset-list) |
00ff62c583fe
(encoded-kbd-iso2022-designation-map): Pay attention to that
Kenichi Handa <handa@m17n.org>
parents:
27816
diff
changeset
|
68 final-char) |
17080
d80a8a46437e
Many changes to cope with the above change.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
69 (while l |
29267
00ff62c583fe
(encoded-kbd-iso2022-designation-map): Pay attention to that
Kenichi Handa <handa@m17n.org>
parents:
27816
diff
changeset
|
70 (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
|
71 (if (> final-char 0) |
29267
00ff62c583fe
(encoded-kbd-iso2022-designation-map): Pay attention to that
Kenichi Handa <handa@m17n.org>
parents:
27816
diff
changeset
|
72 (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
|
73 'encoded-kbd-iso2022-designation)) |
17080
d80a8a46437e
Many changes to cope with the above change.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
74 (setq l (cdr l))) |
17052 | 75 map) |
76 "Keymap for handling ISO2022 designation sequence in Encoded-kbd mode.") | |
77 (fset 'encoded-kbd-iso2022-designation-prefix | |
78 encoded-kbd-iso2022-designation-map) | |
79 | |
27816
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
80 ;; 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
|
81 ;; 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
|
82 ;; 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
|
83 ;; registers 0 thru 3. |
17052 | 84 |
85 (defvar encoded-kbd-iso2022-designations nil) | |
86 (put 'encoded-kbd-iso2022-designations 'permanent-local t) | |
87 | |
27816
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
88 ;; 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
|
89 ;; 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
|
90 ;; 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
|
91 ;; 2, and a single shifted graphic register number. |
17052 | 92 |
93 (defvar encoded-kbd-iso2022-invocations nil) | |
94 (put 'encoded-kbd-iso2022-invocations 'permanent-local t) | |
95 | |
56597
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
96 (defsubst encoded-kbd-last-key () |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
97 (let ((keys (this-single-command-keys))) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
98 (aref keys (1- (length keys))))) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
99 |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
100 (defun encoded-kbd-iso2022-designation (ignore) |
23196 | 101 "Do ISO2022 designation according to the current key in Encoded-kbd mode. |
17052 | 102 The following key sequence may cause multilingual text insertion." |
56597
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
103 (let ((key-seq (this-single-command-keys)) |
19434
31d9ded94ba4
(encoded-kbd-mode): Doc-string modified. Make this a
Kenichi Handa <handa@m17n.org>
parents:
19421
diff
changeset
|
104 (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
|
105 (aref encoded-kbd-iso2022-invocations 0))) |
17052 | 106 intermediate-char final-char |
107 reg dimension chars charset) | |
17080
d80a8a46437e
Many changes to cope with the above change.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
108 (if (= (length key-seq) 4) |
d80a8a46437e
Many changes to cope with the above change.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
109 ;; ESC $ <intermediate-char> <final-char> |
d80a8a46437e
Many changes to cope with the above change.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
110 (setq intermediate-char (aref key-seq 2) |
17052 | 111 dimension 2 |
112 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
|
113 final-char (aref key-seq 3) |
17052 | 114 reg (mod intermediate-char 4)) |
115 (if (= (aref key-seq 1) ?$) | |
17080
d80a8a46437e
Many changes to cope with the above change.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
116 ;; ESC $ <final-char> |
17052 | 117 (setq dimension 2 |
118 chars 94 | |
17080
d80a8a46437e
Many changes to cope with the above change.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
119 final-char (aref key-seq 2) |
17052 | 120 reg 0) |
17080
d80a8a46437e
Many changes to cope with the above change.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
121 ;; ESC <intermediate-char> <final-char> |
d80a8a46437e
Many changes to cope with the above change.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
122 (setq intermediate-char (aref key-seq 1) |
17052 | 123 dimension 1 |
124 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
|
125 final-char (aref key-seq 2) |
17052 | 126 reg (mod intermediate-char 4)))) |
56597
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
127 (aset encoded-kbd-iso2022-designations reg |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
128 (iso-charset dimension chars final-char))) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
129 "") |
17052 | 130 |
56597
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
131 (defun encoded-kbd-iso2022-single-shift (ignore) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
132 (let ((char (encoded-kbd-last-key))) |
59711
fa3ef0f9b02e
(encoded-kbd-iso2022-single-shift):
Kenichi Handa <handa@m17n.org>
parents:
56598
diff
changeset
|
133 (aset encoded-kbd-iso2022-invocations 2 (if (= char ?\216) 2 3))) |
56597
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
134 "") |
17052 | 135 |
56597
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
136 (defun encoded-kbd-self-insert-iso2022-7bit (ignore) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
137 (let ((char (encoded-kbd-last-key)) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
138 (charset (aref encoded-kbd-iso2022-designations |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
139 (or (aref encoded-kbd-iso2022-invocations 2) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
140 (aref encoded-kbd-iso2022-invocations 0))))) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
141 (aset encoded-kbd-iso2022-invocations 2 nil) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
142 (vector (if (= (charset-dimension charset) 1) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
143 (make-char charset char) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
144 (make-char charset char (read-char-exclusive)))))) |
17052 | 145 |
56597
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
146 (defun encoded-kbd-self-insert-iso2022-8bit (ignore) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
147 (let ((char (encoded-kbd-last-key)) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
148 (charset (aref encoded-kbd-iso2022-designations |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
149 (or (aref encoded-kbd-iso2022-invocations 2) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
150 (aref encoded-kbd-iso2022-invocations 1))))) |
17052 | 151 (aset encoded-kbd-iso2022-invocations 2 nil) |
56597
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
152 (vector (if (= (charset-dimension charset) 1) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
153 (make-char charset char) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
154 (make-char charset char (read-char-exclusive)))))) |
17052 | 155 |
56597
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
156 (defun encoded-kbd-self-insert-sjis (ignore) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
157 (let ((char (encoded-kbd-last-key))) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
158 (vector |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
159 (if (or (< char ?\xA0) (>= char ?\xE0)) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
160 (decode-sjis-char (+ (ash char 8) (read-char-exclusive))) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
161 (make-char 'katakana-jisx0201 char))))) |
17052 | 162 |
56597
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
163 (defun encoded-kbd-self-insert-big5 (ignore) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
164 (let ((char (encoded-kbd-last-key))) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
165 (vector |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
166 (decode-big5-char (+ (ash char 8) (read-char-exclusive)))))) |
17052 | 167 |
56597
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
168 (defun encoded-kbd-self-insert-ccl (ignore) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
169 (let ((str (char-to-string (encoded-kbd-last-key))) |
36954
798d1ac75e95
(encoded-kbd-self-insert-ccl): Call ccl-execute-on-string directly so
Kenichi Handa <handa@m17n.org>
parents:
29268
diff
changeset
|
170 (ccl (car (aref (coding-system-spec (keyboard-coding-system)) 4))) |
37095
416e07ad047e
(encoded-kbd-self-insert-ccl):
Kenichi Handa <handa@m17n.org>
parents:
36954
diff
changeset
|
171 (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
|
172 result) |
798d1ac75e95
(encoded-kbd-self-insert-ccl): Call ccl-execute-on-string directly so
Kenichi Handa <handa@m17n.org>
parents:
29268
diff
changeset
|
173 (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
|
174 (dotimes (i 9) (aset vec i nil)) |
416e07ad047e
(encoded-kbd-self-insert-ccl):
Kenichi Handa <handa@m17n.org>
parents:
36954
diff
changeset
|
175 (setq str (format "%s%c" str (read-char-exclusive)))) |
56597
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
176 (vector (aref result 0)))) |
27816
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
177 |
83325
9e41c80c6389
Work around nondeterministic binding of terminal-local variables. (Fixes national character input on ttys.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83321
diff
changeset
|
178 (defun encoded-kbd-setup-keymap (keymap coding) |
27816
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
179 ;; At first, reset the keymap. |
56597
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
180 (define-key encoded-kbd-mode-map "\e" nil) |
27816
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
181 ;; 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
|
182 (cond |
56597
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
183 ((eq (coding-system-type coding) 1) ; SJIS |
27816
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
184 (let ((i 128)) |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
185 (while (< i 256) |
83325
9e41c80c6389
Work around nondeterministic binding of terminal-local variables. (Fixes national character input on ttys.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83321
diff
changeset
|
186 (define-key keymap |
27816
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
187 (vector i) 'encoded-kbd-self-insert-sjis) |
56597
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
188 (setq i (1+ i)))) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
189 8) |
27816
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
190 |
56597
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
191 ((eq (coding-system-type coding) 3) ; Big5 |
27816
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
192 (let ((i 161)) |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
193 (while (< i 255) |
83325
9e41c80c6389
Work around nondeterministic binding of terminal-local variables. (Fixes national character input on ttys.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83321
diff
changeset
|
194 (define-key keymap |
27816
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
195 (vector i) 'encoded-kbd-self-insert-big5) |
56597
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
196 (setq i (1+ i)))) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
197 8) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47817
diff
changeset
|
198 |
56597
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
199 ((eq (coding-system-type coding) 2) ; ISO-2022 |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
200 (let ((flags (coding-system-flags coding)) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
201 use-designation) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
202 (if (aref flags 8) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
203 nil ; Don't support locking-shift. |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
204 (setq encoded-kbd-iso2022-designations (make-vector 4 nil) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
205 encoded-kbd-iso2022-invocations (make-vector 3 nil)) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
206 (dotimes (i 4) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
207 (if (aref flags i) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
208 (if (charsetp (aref flags i)) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
209 (aset encoded-kbd-iso2022-designations |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
210 i (aref flags i)) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
211 (setq use-designation t) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
212 (if (charsetp (car-safe (aref flags i))) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
213 (aset encoded-kbd-iso2022-designations |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
214 i (car (aref flags i))))))) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
215 (aset encoded-kbd-iso2022-invocations 0 0) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
216 (if (aref encoded-kbd-iso2022-designations 1) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
217 (aset encoded-kbd-iso2022-invocations 1 1)) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
218 (when use-designation |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
219 (define-key encoded-kbd-mode-map "\e" 'encoded-kbd-iso2022-esc-prefix) |
83325
9e41c80c6389
Work around nondeterministic binding of terminal-local variables. (Fixes national character input on ttys.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83321
diff
changeset
|
220 (define-key keymap "\e" 'encoded-kbd-iso2022-esc-prefix)) |
56597
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
221 (when (or (aref flags 2) (aref flags 3)) |
83325
9e41c80c6389
Work around nondeterministic binding of terminal-local variables. (Fixes national character input on ttys.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83321
diff
changeset
|
222 (define-key keymap |
56597
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
223 [?\216] 'encoded-kbd-iso2022-single-shift) |
83325
9e41c80c6389
Work around nondeterministic binding of terminal-local variables. (Fixes national character input on ttys.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83321
diff
changeset
|
224 (define-key keymap |
56597
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
225 [?\217] 'encoded-kbd-iso2022-single-shift)) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
226 (or (eq (aref flags 0) 'ascii) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
227 (dotimes (i 96) |
83325
9e41c80c6389
Work around nondeterministic binding of terminal-local variables. (Fixes national character input on ttys.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83321
diff
changeset
|
228 (define-key keymap |
56597
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
229 (vector (+ 32 i)) 'encoded-kbd-self-insert-iso2022-7bit))) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
230 (if (aref flags 7) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
231 t |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
232 (dotimes (i 96) |
83325
9e41c80c6389
Work around nondeterministic binding of terminal-local variables. (Fixes national character input on ttys.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83321
diff
changeset
|
233 (define-key keymap |
56597
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
234 (vector (+ 160 i)) 'encoded-kbd-self-insert-iso2022-8bit)) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
235 8)))) |
27816
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
236 |
56597
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
237 ((eq (coding-system-type coding) 4) ; CCL-base |
27816
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
238 (let ((valid-codes (or (coding-system-get coding 'valid-codes) |
36954
798d1ac75e95
(encoded-kbd-self-insert-ccl): Call ccl-execute-on-string directly so
Kenichi Handa <handa@m17n.org>
parents:
29268
diff
changeset
|
239 '((128 . 255)))) |
56597
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
240 elt from to valid) |
27816
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
241 (while valid-codes |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
242 (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
|
243 (if (consp elt) |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
244 (setq from (car elt) to (cdr elt)) |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
245 (setq from (setq to elt))) |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
246 (while (<= from to) |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
247 (if (>= from 128) |
83325
9e41c80c6389
Work around nondeterministic binding of terminal-local variables. (Fixes national character input on ttys.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83321
diff
changeset
|
248 (define-key keymap |
27816
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
249 (vector from) 'encoded-kbd-self-insert-ccl)) |
56597
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
250 (setq from (1+ from)))) |
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
251 8)) |
27816
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
252 |
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
253 (t |
56597
399c8a1fbe0b
The following changes are to
Kenichi Handa <handa@m17n.org>
parents:
52401
diff
changeset
|
254 nil))) |
27816
321027008721
Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents:
25042
diff
changeset
|
255 |
17080
d80a8a46437e
Many changes to cope with the above change.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
256 ;;;###autoload |
83321
f6ed7ae6fa8d
Replace encoded-kbd-mode with display-specific encoded-kbd-setup-display. (Doesn't work yet.)
Karoly Lorentey <lorentey@elte.hu>
parents:
62274
diff
changeset
|
257 (defun encoded-kbd-setup-display (display) |
85110
7960438eca87
(encoded-kbd-setup-display):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83648
diff
changeset
|
258 "Set up a `input-decode-map' for `keyboard-coding-system' on DISPLAY. |
17052 | 259 |
83321
f6ed7ae6fa8d
Replace encoded-kbd-mode with display-specific encoded-kbd-setup-display. (Doesn't work yet.)
Karoly Lorentey <lorentey@elte.hu>
parents:
62274
diff
changeset
|
260 DISPLAY may be a display id, a frame, or nil for the selected frame's display." |
f6ed7ae6fa8d
Replace encoded-kbd-mode with display-specific encoded-kbd-setup-display. (Doesn't work yet.)
Karoly Lorentey <lorentey@elte.hu>
parents:
62274
diff
changeset
|
261 (let ((frame (if (framep display) display (car (frames-on-display-list display))))) |
f6ed7ae6fa8d
Replace encoded-kbd-mode with display-specific encoded-kbd-setup-display. (Doesn't work yet.)
Karoly Lorentey <lorentey@elte.hu>
parents:
62274
diff
changeset
|
262 (when frame |
f6ed7ae6fa8d
Replace encoded-kbd-mode with display-specific encoded-kbd-setup-display. (Doesn't work yet.)
Karoly Lorentey <lorentey@elte.hu>
parents:
62274
diff
changeset
|
263 (with-selected-frame frame |
85110
7960438eca87
(encoded-kbd-setup-display):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83648
diff
changeset
|
264 ;; Remove any previous encoded-kb keymap from input-decode-map. |
85414
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
265 (let ((m input-decode-map) |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
266 (child nil)) |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
267 (while (keymapp m) |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
268 (if (not (equal (keymap-prompt m) "encoded-kb")) |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
269 (progn |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
270 (setq child m) |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
271 (setq m (keymap-parent m))) |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
272 ;; We've found an encoded-kb map, but maybe the prompt we get |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
273 ;; is really inherited from the encoded-kb map. |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
274 (let (mp) |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
275 (while (and (keymapp (setq mp (keymap-parent m))) |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
276 (equal (keymap-prompt mp) "encoded-kb")) |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
277 (setq child m) |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
278 (setq m mp)) |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
279 ;; (assert (equal (keymap-prompt m) "encoded-kb")) |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
280 ;; (assert (eq mp (keymap-parent m))) |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
281 ;; (assert (not (and (keymapp mp) |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
282 ;; (equal (keymap-prompt mp) "encoded-kb")))) |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
283 ;; (assert (eq m (if child |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
284 ;; (keymap-parent child) input-decode-map))) |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
285 ;; We can finally do the actual removal. |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
286 (if child |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
287 (set-keymap-parent child mp) |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
288 (setq input-decode-map mp)) |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
289 (setq m mp)))))) |
17052 | 290 |
85414
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
291 (if (keyboard-coding-system) |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
292 ;; We are turning on Encoded-kbd mode. |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
293 (let ((coding (keyboard-coding-system)) |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
294 (keymap (make-sparse-keymap "encoded-kb")) |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
295 (cim (current-input-mode)) |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
296 result) |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
297 ;; Place `keymap' as the immediate parent of input-decode-map |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
298 ;; rather than on top, so that later `define-key' on |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
299 ;; input-decode-map don't end up accidentally changing our |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
300 ;; part of the keymap, which would lead to bugs when/if we later |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
301 ;; on remove that part. |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
302 (set-keymap-parent keymap (keymap-parent input-decode-map)) |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
303 (set-keymap-parent input-decode-map keymap) |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
304 (unless (terminal-parameter nil 'encoded-kbd-saved-input-meta-mode) |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
305 (set-terminal-parameter nil 'encoded-kbd-saved-input-mode |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
306 (nth 2 cim))) |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
307 (setq result (and coding (encoded-kbd-setup-keymap keymap coding))) |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
308 (if result |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
309 (when (and (eq result 8) |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
310 (memq (nth 2 cim) '(t nil))) |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
311 (set-input-meta-mode 'use-8th-bit)) |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
312 (set-terminal-parameter |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
313 nil 'encoded-kbd-saved-input-meta-mode nil) |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
314 (error "Unsupported coding system in Encoded-kbd mode: %S" |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
315 coding))) |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
316 ;; We are turning off Encoded-kbd mode. |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
317 (let ((old (terminal-parameter nil 'encoded-kbd-saved-input-meta-mode))) |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
318 (when (and old (not (equal (nth 2 (current-input-mode)) old))) |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
319 (set-input-meta-mode old)) |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
320 (set-terminal-parameter |
f79d3fec6de7
(encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85110
diff
changeset
|
321 nil 'encoded-kbd-saved-input-meta-mode nil)))))) |
17052 | 322 |
47817
8dcee128f3b5
Add `provide' call.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
44451
diff
changeset
|
323 (provide 'encoded-kb) |
8dcee128f3b5
Add `provide' call.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
44451
diff
changeset
|
324 |
85110
7960438eca87
(encoded-kbd-setup-display):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83648
diff
changeset
|
325 ;; arch-tag: 76f0f9b3-65e7-45c3-b692-59509a87ad44 |
17052 | 326 ;;; encoded-kb.el ends here |