changeset 19878:a69ae37e6932

(quail-update-translation): Fix previous change. (quail-simple-translation-keymap, quail-conversion-keymap): Make the default binding with define-key. Handle meta-prefix-char the way isearch does. (quail-translation-keymap): Likewise. (quail-execute-non-quail-command): Handle the key sequence as the same way as universal-argument-other-key. (quail-make-guidance-frame): Don't dedicate the guidance buffer window. (quail-show-guidance-buf): Likewise. (quail-hide-guidance-buf): Delete code to turn off window dedication.
author Richard M. Stallman <rms@gnu.org>
date Thu, 11 Sep 1997 23:15:08 +0000
parents 3b008d891adb
children 87952270ceeb
files lisp/international/quail.el
diffstat 1 files changed, 38 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/international/quail.el	Thu Sep 11 22:13:15 1997 +0000
+++ b/lisp/international/quail.el	Thu Sep 11 23:15:08 1997 +0000
@@ -271,10 +271,7 @@
 
 (defvar quail-translation-keymap
   (let ((map (make-keymap))
-	(i 0))
-    (while (< i ?\ )
-      (define-key map (char-to-string i) 'quail-execute-non-quail-command)
-      (setq i (1+ i)))
+	(i 32))
     (while (< i 127)
       (define-key map (char-to-string i) 'quail-self-insert-command)
       (setq i (1+ i)))
@@ -296,8 +293,14 @@
     (define-key map [tab] 'quail-completion)
     (define-key map [delete] 'quail-delete-last-char)
     (define-key map [backspace] 'quail-delete-last-char)
+    (let ((meta-map (make-sparse-keymap)))
+      (define-key map (char-to-string meta-prefix-char) meta-map)
+      (define-key map [escape] meta-map))
+    (define-key map (vector meta-prefix-char t)
+      'quail-execute-non-quail-command)
     ;; At last, define default key binding.
-    (append map '((t . quail-execute-non-quail-command))))
+    (define-key map [t] 'quail-execute-non-quail-command)
+    map)
   "Keymap used processing translation in complex Quail modes.
 Only a few especially complex input methods use this map;
 most use `quail-simple-translation-keymap' instead.
@@ -315,8 +318,15 @@
     (define-key map "\177" 'quail-delete-last-char)
 ;;; This interferes with handling of escape sequences on non-X terminals.
 ;;;    (define-key map "\e" '(keymap (t . quail-execute-non-quail-command)))
+    (let ((meta-map (make-sparse-keymap)))
+      (define-key map (char-to-string meta-prefix-char) meta-map)
+      (define-key map [escape] meta-map))
+    (define-key map (vector meta-prefix-char t)
+      'quail-execute-non-quail-command)
     ;; At last, define default key binding.
-    (append map '((t . quail-execute-non-quail-command))))
+    (define-key map (vector meta-prefix-char t)
+      'quail-execute-non-quail-command)
+    map)
   "Keymap used while processing translation in simple Quail modes.
 A few especially complex input methods use `quail--translation-keymap' instead.
 This map is activated while translation region is active.")
@@ -346,8 +356,14 @@
     (define-key map "\177" 'quail-conversion-backward-delete-char)
     (define-key map [delete] 'quail-conversion-backward-delete-char)
     (define-key map [backspace] 'quail-conversion-backward-delete-char)
+    (let ((meta-map (make-sparse-keymap)))
+      (define-key map (char-to-string meta-prefix-char) meta-map)
+      (define-key map [escape] meta-map))
+    (define-key map (vector meta-prefix-char t)
+      'quail-execute-non-quail-command)
     ;; At last, define default key binding.
-    (append map '((t . quail-execute-non-quail-command))))
+    (define-key map [t] 'quail-execute-non-quail-command)
+    map)
   "Keymap used for processing conversion in Quail mode.
 This map is activated while convesion region is active but translation
 region is not active.")
@@ -597,7 +613,10 @@
   "Execute one non-Quail command out of Quail mode.
 The current translation and conversion are terminated."
   (interactive)
-  (setq unread-command-events (cons last-input-event unread-command-events))
+  (let* ((key (this-command-keys))
+	 (keylist (listify-key-sequence key)))
+    (setq unread-command-events (append keylist unread-command-events)))
+  (reset-this-command-lengths)
   (quail-terminate-translation)
   (quail-delete-overlays)
   (setq overriding-terminal-local-map nil)
@@ -1079,12 +1098,13 @@
 	      ;; Otherwise, in case the user is using a single-byte
 	      ;; extended-ASCII character set,
 	      ;; try inserting the translated character.
-	      (let ((char (sref (or quail-current-str
-				    (substring quail-current-key 0 len))
-				0)))
+	      (let ((char (or quail-current-str
+			      (substring quail-current-key 0 len))))
+		(if (stringp char)
+		    (setq char (sref char 0)))
 		(if (= (length (split-char char)) 2)
-		    (insert-char (logand char 127))
-		  (error "Cannot insert three-byte character in single-byte mode")))))
+		    (insert-char (logand char 255) 1)
+		  (error "Three-byte characters require enabling multibyte characters")))))
 	(insert (or quail-current-str quail-current-key)))))
   (quail-update-guidance)
   (if control-flag
@@ -1384,7 +1404,8 @@
 				      (cons (cons 'top newtop) fparam))))
 	   (win (frame-first-window frame)))
       (set-window-buffer win buf)
-      (set-window-dedicated-p win t))))
+      ;;(set-window-dedicated-p win t)
+      )))
 
 ;; Setup Quail completion buffer.
 (defun quail-setup-completion-buf ()
@@ -1448,7 +1469,8 @@
 		    ;; which is what we wanted.
 		    (setq win (split-window win (- height 2)))))
 	      (set-window-buffer win quail-guidance-buf)
-	      (set-window-dedicated-p win t)))
+	      ;;(set-window-dedicated-p win t)
+	      ))
 	(set-window-buffer win quail-guidance-buf))
       (setq quail-guidance-win win)))
 
@@ -1473,7 +1495,7 @@
 		  ;; We are using a separate frame for guidance buffer.
 		  ;;(set-window-dedicated-p win nil)
 		  (delete-frame (window-frame win)))
-	      (set-window-dedicated-p win nil)
+	      ;;(set-window-dedicated-p win nil)
 	      (delete-window win)))))))
 
 (defun quail-update-guidance ()