[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/international/encoded-kb.el [emacs-u
From: |
Kenichi Handa |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/international/encoded-kb.el [emacs-unicode-2] |
Date: |
Fri, 15 Oct 2004 03:33:32 -0400 |
Index: emacs/lisp/international/encoded-kb.el
diff -c emacs/lisp/international/encoded-kb.el:1.28.6.6
emacs/lisp/international/encoded-kb.el:1.28.6.7
*** emacs/lisp/international/encoded-kb.el:1.28.6.6 Mon Oct 4 02:54:57 2004
--- emacs/lisp/international/encoded-kb.el Fri Oct 15 07:26:15 2004
***************
*** 177,190 ****
(setq str (format "%s%c" str (read-char-exclusive))))
(vector (aref result 0))))
(defun encoded-kbd-self-insert-charset (ignore)
! (let* ((charset-list
! (coding-system-get (keyboard-coding-system) :charset-list))
! (charset (car charset-list))
! ;; For the moment, we can assume that the length of CHARSET-LIST
! ;; is 1, and the dimension of CHARSET is 1.
! (char (encoded-kbd-last-key)))
! (vector (or (decode-char charset char) char))))
(defun encoded-kbd-self-insert-utf-8 (arg)
(interactive "p")
--- 177,222 ----
(setq str (format "%s%c" str (read-char-exclusive))))
(vector (aref result 0))))
+
+ ;; Decode list of codes in CODE-LIST by CHARSET and return the decoded
+ ;; characters. If CODE-LIST is too short for the dimension of
+ ;; CHARSET, read new codes and append them to the tail of CODE-LIST.
+ ;; Return nil if CODE-LIST can't be decoded.
+
+ (defun encoded-kbd-decode-code-list (charset code-list)
+ (let ((dimension (charset-dimension charset))
+ code)
+ (while (> dimension (length code-list))
+ (nconc code-list (list (read-char-exclusive))))
+ (setq code (car code-list))
+ (if (= dimension 1)
+ (decode-char charset code)
+ (setq code-list (cdr code-list)
+ code (logior (lsh code 8) (car code-list)))
+ (if (= dimension 2)
+ (decode-char charset code)
+ (setq code-list (cdr code-list)
+ code (logior (lsh code 8) (car code-list)))
+ (if (= dimension 3)
+ (decode-char charset code)
+ ;; As Emacs can't handle full 32-bit integer, we must give a
+ ;; cons of higher and lower 16-bit codes to decode-char.
+ (setq code (cons (lsh code -8)
+ (logior (lsh (car code-list) 8) (cadr code-list))))
+ (decode-char charset code))))))
+
(defun encoded-kbd-self-insert-charset (ignore)
! (let ((charset-list
! (coding-system-get (keyboard-coding-system) :charset-list))
! (code-list (list (encoded-kbd-last-key)))
! tail char)
! (while (and charset-list (not char))
! (setq char (encoded-kbd-decode-code-list (car charset-list) code-list)
! charset-list (cdr charset-list)))
! (if char
! (vector char)
! (setq unread-command-events (cdr code-list))
! (vector (car code-list)))))
(defun encoded-kbd-self-insert-utf-8 (arg)
(interactive "p")
***************
*** 217,230 ****
8)
((eq (coding-system-type coding) 'charset)
! (let* ((charset (car (coding-system-get coding :charset-list)))
! (code-space (get-charset-property charset :code-space))
! (from (max (aref code-space 0) 128))
! (to (aref code-space 1)))
! (while (<= from to)
! (define-key key-translation-map
! (vector from) 'encoded-kbd-self-insert-charset)
! (setq from (1+ from))))
8)
((eq (coding-system-type coding) 'iso-2022)
--- 249,267 ----
8)
((eq (coding-system-type coding) 'charset)
! (dolist (elt (mapcar
! #'(lambda (x)
! (let ((dim (charset-dimension x))
! (code-space (get-charset-property x :code-space)))
! (cons (aref code-space (* (1- dim) 2))
! (aref code-space (1+ (* (1- dim) 2))))))
! (coding-system-get coding :charset-list)))
! (let ((from (max (car elt) 128))
! (to (cdr elt)))
! (while (<= from to)
! (define-key key-translation-map
! (vector from) 'encoded-kbd-self-insert-charset)
! (setq from (1+ from)))))
8)
((eq (coding-system-type coding) 'iso-2022)