annotate lisp/international/encoded-kb.el @ 94560:9154a25c84c6

(minibuffer-with-setup-hook): Allow `fun' expressions rather than only value.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 02 May 2008 17:22:04 +0000
parents 606f2d163a64
children 889bc336b89b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2
79709
b6fdfff4ae81 Add 2008 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 78310
diff changeset
3 ;; Copyright (C) 1997, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
74544
43cc94d955c2 Update copyright years.
Glenn Morris <rgm@gnu.org>
parents: 64085
diff changeset
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
b6fdfff4ae81 Add 2008 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 78310
diff changeset
6 ;; 2005, 2006, 2007, 2008
62274
c36561fe0657 Fix copyrights.
Kenichi Handa <handa@m17n.org>
parents: 61280
diff changeset
7 ;; National Institute of Advanced Industrial Science and Technology (AIST)
c36561fe0657 Fix copyrights.
Kenichi Handa <handa@m17n.org>
parents: 61280
diff changeset
8 ;; Registration Number H14PRO021
89483
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 88653
diff changeset
9 ;; Copyright (C) 2003
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 88653
diff changeset
10 ;; National Institute of Advanced Industrial Science and Technology (AIST)
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 88653
diff changeset
11 ;; Registration Number H13PRO009
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
12
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
13 ;; This file is part of GNU Emacs.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
14
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
15 ;; GNU Emacs is free software; you can redistribute it and/or modify
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
16 ;; 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
17 ;; the Free Software Foundation; either version 3, or (at your option)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
18 ;; any later version.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
19
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
20 ;; GNU Emacs is distributed in the hope that it will be useful,
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
21 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
22 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
23 ;; GNU General Public License for more details.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
24
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
25 ;; You should have received a copy of the GNU General Public License
17071
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
26 ;; along with GNU Emacs; see the file COPYING. If not, write to the
64085
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 62274
diff changeset
27 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 62274
diff changeset
28 ;; Boston, MA 02110-1301, USA.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
29
38414
67b464da13ec Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 37238
diff changeset
30 ;;; Commentary:
67b464da13ec Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 37238
diff changeset
31
67b464da13ec Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 37238
diff changeset
32 ;;; Code:
67b464da13ec Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 37238
diff changeset
33
56597
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
34 ;; 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
35 ;; 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
36 ;; 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
37 ;; input-decode-map take effect.
27816
321027008721 Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents: 25042
diff changeset
38 (defconst encoded-kbd-mode-map (make-sparse-keymap)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
39 "Keymap for Encoded-kbd minor mode.")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
40
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
41 ;; Subsidiary keymaps for handling ISO2022 escape sequences.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
42
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
43 (defvar encoded-kbd-iso2022-esc-map
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
44 (let ((map (make-sparse-keymap)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
45 (define-key map "$" 'encoded-kbd-iso2022-esc-dollar-prefix)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
46 (define-key map "(" 'encoded-kbd-iso2022-designation-prefix)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
47 (define-key map ")" 'encoded-kbd-iso2022-designation-prefix)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
48 (define-key map "," 'encoded-kbd-iso2022-designation-prefix)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
49 (define-key map "-" 'encoded-kbd-iso2022-designation-prefix)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
50 map)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
51 "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
52 (fset 'encoded-kbd-iso2022-esc-prefix encoded-kbd-iso2022-esc-map)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
53
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
54 (defvar encoded-kbd-iso2022-esc-dollar-map
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
55 (let ((map (make-sparse-keymap)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
56 (define-key map "(" 'encoded-kbd-iso2022-designation-prefix)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
57 (define-key map ")" 'encoded-kbd-iso2022-designation-prefix)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
58 (define-key map "," 'encoded-kbd-iso2022-designation-prefix)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
59 (define-key map "-" 'encoded-kbd-iso2022-designation-prefix)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
60 (define-key map "@" 'encoded-kbd-iso2022-designation)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
61 (define-key map "A" 'encoded-kbd-iso2022-designation)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
62 (define-key map "B" 'encoded-kbd-iso2022-designation)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
63 map)
17080
d80a8a46437e Many changes to cope with the above change.
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
64 "Keymap for handling ESC $ sequence in Encoded-kbd mode.")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
65 (fset 'encoded-kbd-iso2022-esc-dollar-prefix
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
66 encoded-kbd-iso2022-esc-dollar-map)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
67
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
68 (defvar encoded-kbd-iso2022-designation-map
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
69 (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
70 (l charset-list)
00ff62c583fe (encoded-kbd-iso2022-designation-map): Pay attention to that
Kenichi Handa <handa@m17n.org>
parents: 27816
diff changeset
71 final-char)
17080
d80a8a46437e Many changes to cope with the above change.
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
72 (while l
29267
00ff62c583fe (encoded-kbd-iso2022-designation-map): Pay attention to that
Kenichi Handa <handa@m17n.org>
parents: 27816
diff changeset
73 (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
74 (if (> final-char 0)
29267
00ff62c583fe (encoded-kbd-iso2022-designation-map): Pay attention to that
Kenichi Handa <handa@m17n.org>
parents: 27816
diff changeset
75 (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
76 'encoded-kbd-iso2022-designation))
17080
d80a8a46437e Many changes to cope with the above change.
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
77 (setq l (cdr l)))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
78 map)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
79 "Keymap for handling ISO2022 designation sequence in Encoded-kbd mode.")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
80 (fset 'encoded-kbd-iso2022-designation-prefix
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
81 encoded-kbd-iso2022-designation-map)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
82
27816
321027008721 Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents: 25042
diff changeset
83 ;; 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
84 ;; 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
85 ;; 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
86 ;; registers 0 thru 3.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
87
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
88 (defvar encoded-kbd-iso2022-designations nil)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
89 (put 'encoded-kbd-iso2022-designations 'permanent-local t)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
90
27816
321027008721 Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents: 25042
diff changeset
91 ;; 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
92 ;; 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
93 ;; 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
94 ;; 2, and a single shifted graphic register number.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
95
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
96 (defvar encoded-kbd-iso2022-invocations nil)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
97 (put 'encoded-kbd-iso2022-invocations 'permanent-local t)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
98
56597
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
99 (defsubst encoded-kbd-last-key ()
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
100 (let ((keys (this-single-command-keys)))
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
101 (aref keys (1- (length keys)))))
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
102
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
103 (defun encoded-kbd-iso2022-designation (ignore)
23196
30beacf88b75 Doc fixes.
Karl Heuer <kwzh@gnu.org>
parents: 22521
diff changeset
104 "Do ISO2022 designation according to the current key in Encoded-kbd mode.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
105 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
106 (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
107 (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
108 (aref encoded-kbd-iso2022-invocations 0)))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
109 intermediate-char final-char
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
110 reg dimension chars charset)
17080
d80a8a46437e Many changes to cope with the above change.
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
111 (if (= (length key-seq) 4)
d80a8a46437e Many changes to cope with the above change.
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
112 ;; ESC $ <intermediate-char> <final-char>
d80a8a46437e Many changes to cope with the above change.
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
113 (setq intermediate-char (aref key-seq 2)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
114 dimension 2
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
115 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
116 final-char (aref key-seq 3)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
117 reg (mod intermediate-char 4))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
118 (if (= (aref key-seq 1) ?$)
17080
d80a8a46437e Many changes to cope with the above change.
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
119 ;; ESC $ <final-char>
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
120 (setq dimension 2
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
121 chars 94
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 2)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
123 reg 0)
17080
d80a8a46437e Many changes to cope with the above change.
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
124 ;; ESC <intermediate-char> <final-char>
d80a8a46437e Many changes to cope with the above change.
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
125 (setq intermediate-char (aref key-seq 1)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
126 dimension 1
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
127 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
128 final-char (aref key-seq 2)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
129 reg (mod intermediate-char 4))))
56597
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
130 (aset encoded-kbd-iso2022-designations reg
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
131 (iso-charset dimension chars final-char)))
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
132 "")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
133
56597
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
134 (defun encoded-kbd-iso2022-single-shift (ignore)
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
135 (let ((char (encoded-kbd-last-key)))
59711
fa3ef0f9b02e (encoded-kbd-iso2022-single-shift):
Kenichi Handa <handa@m17n.org>
parents: 56598
diff changeset
136 (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
137 "")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
138
56597
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
139 (defun encoded-kbd-self-insert-iso2022-7bit (ignore)
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
140 (let ((char (encoded-kbd-last-key))
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
141 (charset (aref encoded-kbd-iso2022-designations
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
142 (or (aref encoded-kbd-iso2022-invocations 2)
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
143 (aref encoded-kbd-iso2022-invocations 0)))))
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
144 (aset encoded-kbd-iso2022-invocations 2 nil)
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
145 (vector (if (= (charset-dimension charset) 1)
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
146 (make-char charset char)
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
147 (make-char charset char (read-char-exclusive))))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
148
56597
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
149 (defun encoded-kbd-self-insert-iso2022-8bit (ignore)
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
150 (let ((char (encoded-kbd-last-key))
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
151 (charset (aref encoded-kbd-iso2022-designations
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
152 (or (aref encoded-kbd-iso2022-invocations 2)
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
153 (aref encoded-kbd-iso2022-invocations 1)))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
154 (aset encoded-kbd-iso2022-invocations 2 nil)
56597
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
155 (vector (if (= (charset-dimension charset) 1)
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
156 (make-char charset char)
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
157 (make-char charset char (read-char-exclusive))))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
158
56597
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
159 (defun encoded-kbd-self-insert-sjis (ignore)
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
160 (let ((char (encoded-kbd-last-key)))
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
161 (vector
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
162 (if (or (< char ?\xA0) (>= char ?\xE0))
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
163 (decode-sjis-char (+ (ash char 8) (read-char-exclusive)))
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
164 (make-char 'katakana-jisx0201 char)))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
165
56597
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
166 (defun encoded-kbd-self-insert-big5 (ignore)
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
167 (let ((char (encoded-kbd-last-key)))
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
168 (vector
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
169 (decode-big5-char (+ (ash char 8) (read-char-exclusive))))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
170
56597
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
171 (defun encoded-kbd-self-insert-ccl (ignore)
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
172 (let ((str (char-to-string (encoded-kbd-last-key)))
88487
78fb6b11f118 *** empty log message ***
Dave Love <fx@gnu.org>
parents: 41715
diff changeset
173 (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
174 (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
175 result)
798d1ac75e95 (encoded-kbd-self-insert-ccl): Call ccl-execute-on-string directly so
Kenichi Handa <handa@m17n.org>
parents: 29268
diff changeset
176 (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
177 (dotimes (i 9) (aset vec i nil))
416e07ad047e (encoded-kbd-self-insert-ccl):
Kenichi Handa <handa@m17n.org>
parents: 36954
diff changeset
178 (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
179 (vector (aref result 0))))
27816
321027008721 Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents: 25042
diff changeset
180
90025
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
181
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
182 ;; Decode list of codes in CODE-LIST by CHARSET and return the decoded
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
183 ;; characters. If CODE-LIST is too short for the dimension of
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
184 ;; CHARSET, read new codes and append them to the tail of CODE-LIST.
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
185 ;; Return nil if CODE-LIST can't be decoded.
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
186
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
187 (defun encoded-kbd-decode-code-list (charset code-list)
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
188 (let ((dimension (charset-dimension charset))
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
189 code)
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
190 (while (> dimension (length code-list))
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
191 (nconc code-list (list (read-char-exclusive))))
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
192 (setq code (car code-list))
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
193 (if (= dimension 1)
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
194 (decode-char charset code)
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
195 (setq code-list (cdr code-list)
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
196 code (logior (lsh code 8) (car code-list)))
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
197 (if (= dimension 2)
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
198 (decode-char charset code)
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
199 (setq code-list (cdr code-list)
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
200 code (logior (lsh code 8) (car code-list)))
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
201 (if (= dimension 3)
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
202 (decode-char charset code)
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
203 ;; As Emacs can't handle full 32-bit integer, we must give a
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
204 ;; cons of higher and lower 16-bit codes to decode-char.
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
205 (setq code (cons (lsh code -8)
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
206 (logior (lsh (car code-list) 8) (cadr code-list))))
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
207 (decode-char charset code))))))
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
208
89965
5e9097d1ad99 Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-31
Miles Bader <miles@gnu.org>
parents: 89961
diff changeset
209 (defun encoded-kbd-self-insert-charset (ignore)
90025
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
210 (let ((charset-list
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
211 (coding-system-get (keyboard-coding-system) :charset-list))
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
212 (code-list (list (encoded-kbd-last-key)))
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
213 tail char)
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
214 (while (and charset-list (not char))
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
215 (setq char (encoded-kbd-decode-code-list (car charset-list) code-list)
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
216 charset-list (cdr charset-list)))
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
217 (if char
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
218 (vector char)
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
219 (setq unread-command-events (cdr code-list))
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
220 (vector (car code-list)))))
88525
3629e02a95c1 (encoded-kbd-handle-8bit): Call
Kenichi Handa <handa@m17n.org>
parents: 88493
diff changeset
221
89704
f786eb22f54c (encoded-kbd-self-insert-utf-8): New function.
Kenichi Handa <handa@m17n.org>
parents: 89483
diff changeset
222 (defun encoded-kbd-self-insert-utf-8 (arg)
f786eb22f54c (encoded-kbd-self-insert-utf-8): New function.
Kenichi Handa <handa@m17n.org>
parents: 89483
diff changeset
223 (interactive "p")
89965
5e9097d1ad99 Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-31
Miles Bader <miles@gnu.org>
parents: 89961
diff changeset
224 (let ((char (encoded-kbd-last-key))
5e9097d1ad99 Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-31
Miles Bader <miles@gnu.org>
parents: 89961
diff changeset
225 len)
5e9097d1ad99 Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-31
Miles Bader <miles@gnu.org>
parents: 89961
diff changeset
226 (cond ((< char #xE0)
5e9097d1ad99 Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-31
Miles Bader <miles@gnu.org>
parents: 89961
diff changeset
227 (setq len 1 char (logand char #x1F)))
5e9097d1ad99 Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-31
Miles Bader <miles@gnu.org>
parents: 89961
diff changeset
228 ((< char #xF0)
5e9097d1ad99 Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-31
Miles Bader <miles@gnu.org>
parents: 89961
diff changeset
229 (setq len 2 char (logand char #x0F)))
5e9097d1ad99 Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-31
Miles Bader <miles@gnu.org>
parents: 89961
diff changeset
230 ((< char #xF8)
5e9097d1ad99 Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-31
Miles Bader <miles@gnu.org>
parents: 89961
diff changeset
231 (setq len 3 char (logand char #x07)))
89704
f786eb22f54c (encoded-kbd-self-insert-utf-8): New function.
Kenichi Handa <handa@m17n.org>
parents: 89483
diff changeset
232 (t
89965
5e9097d1ad99 Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-31
Miles Bader <miles@gnu.org>
parents: 89961
diff changeset
233 (setq len 4 char 0)))
89704
f786eb22f54c (encoded-kbd-self-insert-utf-8): New function.
Kenichi Handa <handa@m17n.org>
parents: 89483
diff changeset
234 (while (> len 0)
89965
5e9097d1ad99 Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-31
Miles Bader <miles@gnu.org>
parents: 89961
diff changeset
235 (setq char (logior (lsh char 6) (logand (read-char-exclusive) #x3F))
89704
f786eb22f54c (encoded-kbd-self-insert-utf-8): New function.
Kenichi Handa <handa@m17n.org>
parents: 89483
diff changeset
236 len (1- len)))
89965
5e9097d1ad99 Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-31
Miles Bader <miles@gnu.org>
parents: 89961
diff changeset
237 (vector char)))
89704
f786eb22f54c (encoded-kbd-self-insert-utf-8): New function.
Kenichi Handa <handa@m17n.org>
parents: 89483
diff changeset
238
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
239 (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
240 ;; At first, reset the keymap.
56597
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
241 (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
242 ;; 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
243 (cond
89965
5e9097d1ad99 Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-31
Miles Bader <miles@gnu.org>
parents: 89961
diff changeset
244 ((eq (coding-system-type coding) 'shift-jis)
27816
321027008721 Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents: 25042
diff changeset
245 (let ((i 128))
321027008721 Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents: 25042
diff changeset
246 (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
247 (define-key keymap
27816
321027008721 Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents: 25042
diff changeset
248 (vector i) 'encoded-kbd-self-insert-sjis)
56597
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
249 (setq i (1+ i))))
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
250 8)
27816
321027008721 Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents: 25042
diff changeset
251
89965
5e9097d1ad99 Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-31
Miles Bader <miles@gnu.org>
parents: 89961
diff changeset
252 ((eq (coding-system-type coding) 'charset)
90025
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
253 (dolist (elt (mapcar
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
254 #'(lambda (x)
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
255 (let ((dim (charset-dimension x))
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
256 (code-space (get-charset-property x :code-space)))
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
257 (cons (aref code-space (* (1- dim) 2))
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
258 (aref code-space (1+ (* (1- dim) 2))))))
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
259 (coding-system-get coding :charset-list)))
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
260 (let ((from (max (car elt) 128))
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
261 (to (cdr elt)))
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
262 (while (<= from to)
91041
bdb3fe0ba9fa Merge from emacs--devo--0
Miles Bader <miles@gnu.org>
parents: 90996 85110
diff changeset
263 (define-key keymap
90025
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
264 (vector from) 'encoded-kbd-self-insert-charset)
b826d8196afd (encoded-kbd-decode-code-list): New
Kenichi Handa <handa@m17n.org>
parents: 90001
diff changeset
265 (setq from (1+ from)))))
56597
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
266 8)
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47817
diff changeset
267
89965
5e9097d1ad99 Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-31
Miles Bader <miles@gnu.org>
parents: 89961
diff changeset
268 ((eq (coding-system-type coding) 'iso-2022)
5e9097d1ad99 Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-31
Miles Bader <miles@gnu.org>
parents: 89961
diff changeset
269 (let ((flags (coding-system-get coding :flags))
5e9097d1ad99 Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-31
Miles Bader <miles@gnu.org>
parents: 89961
diff changeset
270 (designation (coding-system-get coding :designation)))
5e9097d1ad99 Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-31
Miles Bader <miles@gnu.org>
parents: 89961
diff changeset
271 (if (memq 'locking-shift flags)
56597
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
272 nil ; Don't support locking-shift.
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
273 (setq encoded-kbd-iso2022-designations (make-vector 4 nil)
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
274 encoded-kbd-iso2022-invocations (make-vector 3 nil))
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
275 (dotimes (i 4)
89965
5e9097d1ad99 Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-31
Miles Bader <miles@gnu.org>
parents: 89961
diff changeset
276 (if (aref designation i)
5e9097d1ad99 Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-31
Miles Bader <miles@gnu.org>
parents: 89961
diff changeset
277 (if (charsetp (aref designation i))
56597
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
278 (aset encoded-kbd-iso2022-designations
89965
5e9097d1ad99 Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-31
Miles Bader <miles@gnu.org>
parents: 89961
diff changeset
279 i (aref designation i))
5e9097d1ad99 Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-31
Miles Bader <miles@gnu.org>
parents: 89961
diff changeset
280 (if (charsetp (car-safe (aref designation i)))
56597
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
281 (aset encoded-kbd-iso2022-designations
89965
5e9097d1ad99 Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-31
Miles Bader <miles@gnu.org>
parents: 89961
diff changeset
282 i (car (aref designation i)))))))
56597
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
283 (aset encoded-kbd-iso2022-invocations 0 0)
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
284 (if (aref encoded-kbd-iso2022-designations 1)
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
285 (aset encoded-kbd-iso2022-invocations 1 1))
89965
5e9097d1ad99 Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-31
Miles Bader <miles@gnu.org>
parents: 89961
diff changeset
286 (when (memq 'designation flags)
56597
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
287 (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
288 (define-key keymap "\e" 'encoded-kbd-iso2022-esc-prefix))
89965
5e9097d1ad99 Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-31
Miles Bader <miles@gnu.org>
parents: 89961
diff changeset
289 (when (or (aref designation 2) (aref designation 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
290 (define-key keymap
56597
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
291 [?\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
292 (define-key keymap
56597
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
293 [?\217] 'encoded-kbd-iso2022-single-shift))
89965
5e9097d1ad99 Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-31
Miles Bader <miles@gnu.org>
parents: 89961
diff changeset
294 (or (eq (aref designation 0) 'ascii)
56597
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
295 (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
296 (define-key keymap
56597
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
297 (vector (+ 32 i)) 'encoded-kbd-self-insert-iso2022-7bit)))
89965
5e9097d1ad99 Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-31
Miles Bader <miles@gnu.org>
parents: 89961
diff changeset
298 (if (memq '7-bit flags)
56597
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
299 t
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
300 (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
301 (define-key keymap
56597
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
302 (vector (+ 160 i)) 'encoded-kbd-self-insert-iso2022-8bit))
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
303 8))))
27816
321027008721 Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents: 25042
diff changeset
304
56597
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
305 ((eq (coding-system-type coding) 4) ; CCL-base
88653
ab210513bef9 (encoded-kbd-setup-keymap) <ccl>:
Dave Love <fx@gnu.org>
parents: 88525
diff changeset
306 (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
307 '((128 . 255))))
56597
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
308 elt from to valid)
27816
321027008721 Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents: 25042
diff changeset
309 (while valid-codes
321027008721 Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents: 25042
diff changeset
310 (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
311 (if (consp elt)
321027008721 Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents: 25042
diff changeset
312 (setq from (car elt) to (cdr elt))
321027008721 Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents: 25042
diff changeset
313 (setq from (setq to elt)))
321027008721 Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents: 25042
diff changeset
314 (while (<= from to)
321027008721 Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents: 25042
diff changeset
315 (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
316 (define-key keymap
27816
321027008721 Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents: 25042
diff changeset
317 (vector from) 'encoded-kbd-self-insert-ccl))
56597
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
318 (setq from (1+ from))))
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
319 8))
27816
321027008721 Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents: 25042
diff changeset
320
89965
5e9097d1ad99 Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-31
Miles Bader <miles@gnu.org>
parents: 89961
diff changeset
321 ((eq (coding-system-type coding) 'utf-8)
89704
f786eb22f54c (encoded-kbd-self-insert-utf-8): New function.
Kenichi Handa <handa@m17n.org>
parents: 89483
diff changeset
322 (let ((i #xC0))
f786eb22f54c (encoded-kbd-self-insert-utf-8): New function.
Kenichi Handa <handa@m17n.org>
parents: 89483
diff changeset
323 (while (< i 256)
91041
bdb3fe0ba9fa Merge from emacs--devo--0
Miles Bader <miles@gnu.org>
parents: 90996 85110
diff changeset
324 (define-key keymap
89704
f786eb22f54c (encoded-kbd-self-insert-utf-8): New function.
Kenichi Handa <handa@m17n.org>
parents: 89483
diff changeset
325 (vector i) 'encoded-kbd-self-insert-utf-8)
90001
1e6118d38ca9 (encoded-kbd-setup-keymap): Fix
Kenichi Handa <handa@m17n.org>
parents: 89965
diff changeset
326 (setq i (1+ i))))
1e6118d38ca9 (encoded-kbd-setup-keymap): Fix
Kenichi Handa <handa@m17n.org>
parents: 89965
diff changeset
327 8)
89704
f786eb22f54c (encoded-kbd-self-insert-utf-8): New function.
Kenichi Handa <handa@m17n.org>
parents: 89483
diff changeset
328
27816
321027008721 Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents: 25042
diff changeset
329 (t
56597
399c8a1fbe0b The following changes are to
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
330 nil)))
27816
321027008721 Be sure to update minor-mode-alist
Kenichi Handa <handa@m17n.org>
parents: 25042
diff changeset
331
17080
d80a8a46437e Many changes to cope with the above change.
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
332 ;;;###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
333 (defun encoded-kbd-setup-display (display)
85110
7960438eca87 (encoded-kbd-setup-display):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83648
diff changeset
334 "Set up a `input-decode-map' for `keyboard-coding-system' on DISPLAY.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
335
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
336 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
337 (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
338 (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
339 (with-selected-frame frame
85110
7960438eca87 (encoded-kbd-setup-display):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83648
diff changeset
340 ;; 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
341 (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
342 (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
343 (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
344 (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
345 (progn
f79d3fec6de7 (encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85110
diff changeset
346 (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
347 (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
348 ;; 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
349 ;; 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
350 (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
351 (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
352 (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
353 (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
354 (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
355 ;; (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
356 ;; (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
357 ;; (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
358 ;; (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
359 ;; (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
360 ;; (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
361 ;; 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
362 (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
363 (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
364 (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
365 (setq m mp))))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
366
85414
f79d3fec6de7 (encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85110
diff changeset
367 (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
368 ;; 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
369 (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
370 (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
371 (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
372 result)
f79d3fec6de7 (encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85110
diff changeset
373 ;; 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
374 ;; 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
375 ;; 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
376 ;; 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
377 ;; 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
378 (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
379 (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
380 (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
381 (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
382 (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
383 (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
384 (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
385 (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
386 (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
387 (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
388 (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
389 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
390 (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
391 coding)))
f79d3fec6de7 (encoded-kbd-setup-display): Be careful not to remove keymaps that just
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85110
diff changeset
392 ;; 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
393 (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
394 (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
395 (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
396 (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
397 nil 'encoded-kbd-saved-input-meta-mode nil))))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
398
47817
8dcee128f3b5 Add `provide' call.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 44451
diff changeset
399 (provide 'encoded-kb)
8dcee128f3b5 Add `provide' call.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 44451
diff changeset
400
85110
7960438eca87 (encoded-kbd-setup-display):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83648
diff changeset
401 ;; arch-tag: 76f0f9b3-65e7-45c3-b692-59509a87ad44
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
402 ;;; encoded-kb.el ends here