]> code.delx.au - gnu-emacs/blobdiff - lisp/international/encoded-kb.el
(byte-compile-inline-expand):
[gnu-emacs] / lisp / international / encoded-kb.el
index d12f2600b16ea4042c382ac4f557f24be1fe1fcd..e23d9c4bd758426e862447ba414239377cee0baf 100644 (file)
       (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.")
 
 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 @@ The following key sequence may cause multilingual text insertion."
             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."
@@ -212,7 +222,7 @@ The following key sequence may cause multilingual text insertion."
         (if (or (< last-command-char ?\xA0) (>= last-command-char ?\xE0))
             (decode-sjis-char (+ (ash last-command-char 8)
                                  (read-char-exclusive)))
-          (make-char 'latin-jisx0201 last-command-char))))
+          (make-char 'katakana-jisx0201 last-command-char))))
     (self-insert-command 1)))
 
 (defun encoded-kbd-self-insert-big5 ()
@@ -230,10 +240,13 @@ The following key sequence may cause multilingual text insertion."
   "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))