aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa2002-05-16 01:17:14 +0000
committerKenichi Handa2002-05-16 01:17:14 +0000
commite9e2818f4fb8af97a0d8e2951584fdb7c71747ff (patch)
treef070d1671dfee4a6e783c7b379fcabaa6a77aa40
parentae0b443e4855b5da7c652a1d3291d93ac6385733 (diff)
downloademacs-e9e2818f4fb8af97a0d8e2951584fdb7c71747ff.tar.gz
emacs-e9e2818f4fb8af97a0d8e2951584fdb7c71747ff.zip
(encoded-kbd-handle-8bit): Call
encoded-kbd-self-insert-iso2022-8bit with argument 1. (encoded-kbd-self-insert-charset): New function. (encoded-kbd-setup-keymap): Handle a coding-system of type charset. (encoded-kbd-mode): Likewise.
-rw-r--r--lisp/international/encoded-kb.el40
1 files changed, 39 insertions, 1 deletions
diff --git a/lisp/international/encoded-kb.el b/lisp/international/encoded-kb.el
index 4e17d62691c..11cd3a6e3cd 100644
--- a/lisp/international/encoded-kb.el
+++ b/lisp/international/encoded-kb.el
@@ -166,7 +166,7 @@ The following key sequence may cause multilingual text insertion."
166 (aset encoded-kbd-iso2022-invocations 2 3)) 166 (aset encoded-kbd-iso2022-invocations 2 3))
167 167
168 ((>= last-command-char ?\240) 168 ((>= last-command-char ?\240)
169 (encoded-kbd-self-insert-iso2022-8bit)) 169 (encoded-kbd-self-insert-iso2022-8bit 1))
170 170
171 (t 171 (t
172 (error "Can't handle the character code %d" 172 (error "Can't handle the character code %d"
@@ -237,11 +237,38 @@ The following key sequence may cause multilingual text insertion."
237 (setq unread-command-events 237 (setq unread-command-events
238 (append result unread-command-events)))) 238 (append result unread-command-events))))
239 239
240(defun encoded-kbd-self-insert-charset (arg)
241 (interactive "p")
242 (let* ((charset-list
243 (coding-system-get (keyboard-coding-system) :charset-list))
244 (charset (car charset-list))
245 ;; For the moment, we can assume that the length of CHARSET-LIST
246 ;; is 1, and the dimension of CHARSET is 1.
247 (c (decode-char charset last-command-char)))
248 (unless c
249 (error "Can't decode the code point %d by %s"
250 last-command-char charset))
251 ;; As simply setting unread-command-events may result in
252 ;; infinite-loop for characters 160..255, this is a temporary
253 ;; workaround until we found a better solution.
254 (let ((last-command-char c))
255 (self-insert-command arg))))
256
240(defun encoded-kbd-setup-keymap (coding) 257(defun encoded-kbd-setup-keymap (coding)
241 ;; At first, reset the keymap. 258 ;; At first, reset the keymap.
242 (setcdr encoded-kbd-mode-map nil) 259 (setcdr encoded-kbd-mode-map nil)
243 ;; Then setup the keymap according to the keyboard coding system. 260 ;; Then setup the keymap according to the keyboard coding system.
244 (cond 261 (cond
262 ((eq encoded-kbd-coding 'charset)
263 (let* ((charset (car (coding-system-get coding :charset-list)))
264 (code-space (get-charset-property charset :code-space))
265 (from (max (aref code-space 0) 128))
266 (to (aref code-space 1)))
267 (while (<= from to)
268 (define-key encoded-kbd-mode-map
269 (vector from) 'encoded-kbd-self-insert-charset)
270 (setq from (1+ from)))))
271
245 ((eq encoded-kbd-coding 'sjis) 272 ((eq encoded-kbd-coding 'sjis)
246 (let ((i 128)) 273 (let ((i 128))
247 (while (< i 256) 274 (while (< i 256)
@@ -346,6 +373,17 @@ as a multilingual text encoded in a coding system set by
346 'use-8th-bit (nth 3 saved-input-mode)) 373 'use-8th-bit (nth 3 saved-input-mode))
347 (setq encoded-kbd-coding 'ccl)) 374 (setq encoded-kbd-coding 'ccl))
348 375
376 ((and (eq (coding-system-type coding) 'charset)
377 (let* ((charset-list (coding-system-get coding
378 :charset-list))
379 (charset (car charset-list)))
380 (and (= (length charset-list) 1)
381 (= (charset-dimension charset) 1))))
382 (set-input-mode
383 (nth 0 saved-input-mode) (nth 1 saved-input-mode)
384 'use-8th-bit (nth 3 saved-input-mode))
385 (setq encoded-kbd-coding 'charset))
386
349 (t 387 (t
350 (setq encoded-kbd-mode nil) 388 (setq encoded-kbd-mode nil)
351 (error "Coding-system `%s' is not supported in Encoded-kbd mode" 389 (error "Coding-system `%s' is not supported in Encoded-kbd mode"