changeset 19434:31d9ded94ba4

(encoded-kbd-mode): Doc-string modified. Make this a non-interactive function. (encoded-kbd-iso2022-designation): Do not enter recursive edit twice. (encoded-kbd-iso2022-non-ascii-map): Bind 8-bit keys to encoded-kbd-handle-8bit.
author Kenichi Handa <handa@m17n.org>
date Tue, 19 Aug 1997 10:58:40 +0000
parents 8020b553a1db
children 608acf74b95b
files lisp/international/encoded-kb.el
diffstat 1 files changed, 21 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/international/encoded-kb.el	Tue Aug 19 10:58:40 1997 +0000
+++ b/lisp/international/encoded-kb.el	Tue Aug 19 10:58:40 1997 +0000
@@ -90,6 +90,10 @@
       (define-key map (char-to-string i) 'encoded-kbd-self-insert-iso2022-7bit)
       (setq i (1+ i)))
     (define-key map "\e" 'encoded-kbd-iso2022-esc-prefix)
+    (setq i 160)
+    (while (< i 256)
+      (define-key map (vector i) 'encoded-kbd-handle-8bit)
+      (setq i (1+ i)))
     map)
   "Keymap for handling non-ASCII character set in Encoded-kbd mode.")
 
@@ -118,6 +122,8 @@
 The following key sequence may cause multilingual text insertion."
   (interactive)
   (let ((key-seq (this-command-keys))
+	(prev-g0-charset (aref encoded-kbd-iso2022-designations
+			       (aref encoded-kbd-iso2022-invocations 0)))
 	intermediate-char final-char
 	reg dimension chars charset)
     (if (= (length key-seq) 4)
@@ -145,14 +151,18 @@
 	     dimension chars final-char))
 
     (if (memq (aref encoded-kbd-iso2022-designations
-		 (aref encoded-kbd-iso2022-invocations 0))
+		    (aref encoded-kbd-iso2022-invocations 0))
 	      '(ascii latin-jisx0201))
 	;; Graphic plane 0 (0x20..0x7f) is for ASCII.  We don't have
 	;; to handle characters in this range specially.
-	(throw 'exit nil)
+	(if (not (memq prev-g0-charset '(ascii latin-jisx0201)))
+	    ;; We must exit recusive edit now.
+	    (throw 'exit nil))
       ;; Graphic plane 0 is for non-ASCII.
-      (let ((overriding-local-map encoded-kbd-iso2022-non-ascii-map))
-	(recursive-edit)))))
+      (if (memq prev-g0-charset '(ascii latin-jisx0201))
+	  ;; We must handle kyes specially.
+	  (let ((overriding-local-map encoded-kbd-iso2022-non-ascii-map))
+	    (recursive-edit))))))
 
 (defun encoded-kbd-handle-8bit ()
   "Handle an 8-bit character enterned in Encoded-kbd mode."
@@ -230,10 +240,13 @@
   "Toggle Encoded-kbd minor mode.
 With arg, turn Encoded-kbd mode on if and only if arg is positive.
 
-When in Encoded-kbd mode, a text sent from keyboard
-is accepted as a multilingual text encoded in a coding system
-set by the command `set-keyboard-coding-system'."
-  (interactive "P")
+You should not turn this mode on manually, instead use the command
+`set-keyboard-coding-system' which turns on or off this mode
+automatically.
+
+In Encoded-kbd mode, a text sent from keyboard is accepted
+as a multilingual text encoded in a coding system set by
+`set-keyboard-coding-system'."
   (if encoded-kbd-mode
       ;; We must at first reset input-mode to the original.
       (apply 'set-input-mode saved-input-mode))