comparison lisp/international/encoded-kb.el @ 88525:3629e02a95c1

(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.
author Kenichi Handa <handa@m17n.org>
date Thu, 16 May 2002 01:17:14 +0000
parents 410ca4f1df02
children ab210513bef9
comparison
equal deleted inserted replaced
88524:87327fa1517b 88525:3629e02a95c1
164 164
165 ((= last-command-char ?\217) 165 ((= last-command-char ?\217)
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"
173 last-command-char)))) 173 last-command-char))))
174 174
235 (dotimes (i 9) (aset vec i nil)) 235 (dotimes (i 9) (aset vec i nil))
236 (setq str (format "%s%c" str (read-char-exclusive)))) 236 (setq str (format "%s%c" str (read-char-exclusive))))
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)
248 (define-key encoded-kbd-mode-map 275 (define-key encoded-kbd-mode-map
249 (vector i) 'encoded-kbd-self-insert-sjis) 276 (vector i) 'encoded-kbd-self-insert-sjis)
344 (set-input-mode 371 (set-input-mode
345 (nth 0 saved-input-mode) (nth 1 saved-input-mode) 372 (nth 0 saved-input-mode) (nth 1 saved-input-mode)
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"
352 (keyboard-coding-system)))) 390 (keyboard-coding-system))))
353 (encoded-kbd-setup-keymap coding)))) 391 (encoded-kbd-setup-keymap coding))))