aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa1997-08-18 10:51:45 +0000
committerKenichi Handa1997-08-18 10:51:45 +0000
commit20110571b5b0cc01db64cb835cb268329bd1ed2d (patch)
tree13adc08319bc3c3d994f20dfa8f2c2448c8db02f
parent1bcb155cb1eec09f08dad8aab5b48f5a721d3389 (diff)
downloademacs-20110571b5b0cc01db64cb835cb268329bd1ed2d.tar.gz
emacs-20110571b5b0cc01db64cb835cb268329bd1ed2d.zip
(quail-inactivate): Turn Quail mode off
by itself. (quail-translation-keymap): Don't bind thee key "C-\". (quail-conversion-keymap): Likewise. (quail-define-package): Indentation fixed. (quail-setup-overlays): New arg conversion-mode. Pay attention to input-method-highlight-flag. (quail-mode-line-format): Deleted. (quail-generate-mode-line-format): Deleted. (quail-mode): Don't handle input-method-inactivate-hook and input-method-activate-hook here. Delete code setting quail-mode-line-format. (quail-saved-current-map): Name changed from quail-saved-overriding-local-map. (quail-toggle-mode-temporarily): Completely re-written. (quail-execute-non-quail-command): Use quail-toggle-mode-temporarily. (quail-conv-overlay-modification-hook): Deleted. (quail-suppress-conversion): Deleted. (quail-start-translation): Completely re-written. (quail-start-translation-in-conversion-mode): Likewise. (quail-delete-region): Check if quail-overlay is active. (quail-get-current-str): Don't call throw. Set overriding-terminal-local-map correctly. (quail-update-translation): Run hooks in input-method-after-insert-chunk-hook. (quail-self-insert-command): Catch 'quail-tag here. (quail-conversion-delete-char): Don't call throw. Set overriding-terminal-local-map to nil. (quail-conversion-backward-delete-char): Likewise. (quail-no-conversion): Likewise. (quail-help-insert-keymap-description): Bind overriding-terminal-local-map instead of overriding-local-map.
-rw-r--r--lisp/international/quail.el256
1 files changed, 93 insertions, 163 deletions
diff --git a/lisp/international/quail.el b/lisp/international/quail.el
index 022b251caf8..3f9dc3514c7 100644
--- a/lisp/international/quail.el
+++ b/lisp/international/quail.el
@@ -234,7 +234,8 @@ LEIM is available from the same ftp directory as Emacs."))
234(defun quail-inactivate () 234(defun quail-inactivate ()
235 "Turn off Quail input method." 235 "Turn off Quail input method."
236 (interactive) 236 (interactive)
237 (throw 'quail-tag t)) 237 (setq overriding-terminal-local-map nil)
238 (quail-mode -1))
238 239
239(or (assq 'quail-mode minor-mode-alist) 240(or (assq 'quail-mode minor-mode-alist)
240 (setq minor-mode-alist 241 (setq minor-mode-alist
@@ -271,7 +272,6 @@ LEIM is available from the same ftp directory as Emacs."))
271 (define-key map (char-to-string i) 'quail-self-insert-command) 272 (define-key map (char-to-string i) 'quail-self-insert-command)
272 (setq i (1+ i))) 273 (setq i (1+ i)))
273 (define-key map "\177" 'quail-delete-last-char) 274 (define-key map "\177" 'quail-delete-last-char)
274 (define-key map "\C-\\" 'quail-inactivate)
275 (define-key map "\C-f" 'quail-next-translation) 275 (define-key map "\C-f" 'quail-next-translation)
276 (define-key map "\C-b" 'quail-prev-translation) 276 (define-key map "\C-b" 'quail-prev-translation)
277 (define-key map "\C-n" 'quail-next-translation-block) 277 (define-key map "\C-n" 'quail-next-translation-block)
@@ -305,7 +305,6 @@ This map is activated while translation region is active.")
305 (define-key map "\C-e" 'quail-conversion-end-of-region) 305 (define-key map "\C-e" 'quail-conversion-end-of-region)
306 (define-key map "\C-d" 'quail-conversion-delete-char) 306 (define-key map "\C-d" 'quail-conversion-delete-char)
307 (define-key map "\C-h" 'quail-conversion-help) 307 (define-key map "\C-h" 'quail-conversion-help)
308 (define-key map "\C-\\" 'quail-inactivate)
309 (define-key map "\e" '(keymap (t . quail-execute-non-quail-command))) 308 (define-key map "\e" '(keymap (t . quail-execute-non-quail-command)))
310 (define-key map "\177" 'quail-conversion-backward-delete-char) 309 (define-key map "\177" 'quail-conversion-backward-delete-char)
311 (define-key map [delete] 'quail-conversion-backward-delete-char) 310 (define-key map [delete] 'quail-conversion-backward-delete-char)
@@ -395,20 +394,19 @@ vs. corresponding command to be called."
395 (let (translation-keymap conversion-keymap) 394 (let (translation-keymap conversion-keymap)
396 (if deterministic (setq forget-last-selection t)) 395 (if deterministic (setq forget-last-selection t))
397 (if translation-keys 396 (if translation-keys
398 (progn 397 (progn
399 (setq translation-keymap (copy-keymap quail-translation-keymap)) 398 (setq translation-keymap (copy-keymap quail-translation-keymap))
400 (while translation-keys 399 (while translation-keys
401 (define-key translation-keymap 400 (define-key translation-keymap
402 (car (car translation-keys)) (cdr (car translation-keys))) 401 (car (car translation-keys)) (cdr (car translation-keys)))
403 (setq translation-keys (cdr translation-keys)))) 402 (setq translation-keys (cdr translation-keys))))
404 (setq translation-keymap quail-translation-keymap)) 403 (setq translation-keymap quail-translation-keymap))
405 (if conversion-keys 404 (when conversion-keys
406 (progn 405 (setq conversion-keymap (copy-keymap quail-conversion-keymap))
407 (setq conversion-keymap (copy-keymap quail-conversion-keymap)) 406 (while conversion-keys
408 (while conversion-keys 407 (define-key conversion-keymap
409 (define-key conversion-keymap 408 (car (car conversion-keys)) (cdr (car conversion-keys)))
410 (car (car conversion-keys)) (cdr (car conversion-keys))) 409 (setq conversion-keys (cdr conversion-keys))))
411 (setq conversion-keys (cdr conversion-keys)))))
412 (quail-add-package 410 (quail-add-package
413 (list name title (list nil) guidance (or docstring "") 411 (list name title (list nil) guidance (or docstring "")
414 translation-keymap 412 translation-keymap
@@ -428,24 +426,24 @@ vs. corresponding command to be called."
428;; Quail minor mode handlers. 426;; Quail minor mode handlers.
429 427
430;; Setup overlays used in Quail mode. 428;; Setup overlays used in Quail mode.
431(defun quail-setup-overlays () 429(defun quail-setup-overlays (conversion-mode)
432 (let ((pos (point))) 430 (let ((pos (point)))
433 (if (overlayp quail-overlay) 431 (if (overlayp quail-overlay)
434 (move-overlay quail-overlay pos pos) 432 (move-overlay quail-overlay pos pos)
435 (setq quail-overlay (make-overlay pos pos nil nil t)) 433 (setq quail-overlay (make-overlay pos pos nil nil t))
436 (overlay-put quail-overlay 'face 'underline) 434 (if input-method-highlight-flag
435 (overlay-put quail-overlay 'face 'underline))
437 (let ((l (quail-overlay-plist))) 436 (let ((l (quail-overlay-plist)))
438 (while l 437 (while l
439 (overlay-put quail-overlay (car l) (car (cdr l))) 438 (overlay-put quail-overlay (car l) (car (cdr l)))
440 (setq l (cdr (cdr l)))))) 439 (setq l (cdr (cdr l))))))
441 (if (overlayp quail-conv-overlay) 440 (if conversion-mode
442 (move-overlay quail-conv-overlay pos pos) 441 (if (overlayp quail-conv-overlay)
443 (setq quail-conv-overlay (make-overlay pos pos nil nil t)) 442 (if (not (overlay-start quail-conv-overlay))
444 (if input-method-highlight-flag 443 (move-overlay quail-conv-overlay pos pos))
445 (overlay-put quail-conv-overlay 'face 'underline)) 444 (setq quail-conv-overlay (make-overlay pos pos nil nil t))
446 ;;(overlay-put quail-conv-overlay 'modification-hooks 445 (if input-method-highlight-flag
447 ;;'(quail-conv-overlay-modification-hook)) 446 (overlay-put quail-conv-overlay 'face 'underline))))))
448 )))
449 447
450;; Delete overlays used in Quail mode. 448;; Delete overlays used in Quail mode.
451(defun quail-delete-overlays () 449(defun quail-delete-overlays ()
@@ -454,30 +452,6 @@ vs. corresponding command to be called."
454 (if (overlayp quail-conv-overlay) 452 (if (overlayp quail-conv-overlay)
455 (delete-overlay quail-conv-overlay))) 453 (delete-overlay quail-conv-overlay)))
456 454
457;; While translating and converting, we enter and exit the recursive
458;; edit frequently, which results in frequent and annoying change of
459;; mode line. To avoid it, we use a modified mode-line-format.
460(defvar quail-mode-line-format nil)
461
462;; Return a modified mode-line-format which doesn't show the recursive
463;; editing level. But, we only pay attention to the top level
464;; elements of the current mode-line-format.
465(defun quail-generate-mode-line-format ()
466 (if (listp mode-line-format)
467 (let ((new (copy-sequence mode-line-format))
468 l elt idx)
469 (setq l new)
470 (while l
471 (setq elt (car l))
472 (if (and (stringp elt)
473 (or (setq idx (string-match "%\\[" elt))
474 (setq idx (string-match "%\\]" elt))))
475 (setcar l (concat (substring elt 0 idx)
476 (substring elt (+ idx 2)))))
477 (setq l (cdr l)))
478 new)
479 mode-line-format))
480
481(defun quail-mode (&optional arg) 455(defun quail-mode (&optional arg)
482 "Toggle Quail minor mode. 456 "Toggle Quail minor mode.
483With arg, turn Quail mode on if and only if arg is positive. 457With arg, turn Quail mode on if and only if arg is positive.
@@ -493,9 +467,7 @@ The command \\[describe-input-method] describes the current Quail package."
493 (quail-hide-guidance-buf) 467 (quail-hide-guidance-buf)
494 (quail-delete-overlays) 468 (quail-delete-overlays)
495 (setq describe-current-input-method-function nil) 469 (setq describe-current-input-method-function nil)
496 (setq current-input-method nil) 470 (run-hooks 'quail-mode-exit-hook))
497 (run-hooks 'quail-mode-exit-hook)
498 (run-hooks 'input-method-inactivate-hook))
499 ;; Let's turn on Quail mode. 471 ;; Let's turn on Quail mode.
500 ;; At first, be sure that quail-mode is at the first element of 472 ;; At first, be sure that quail-mode is at the first element of
501 ;; minor-mode-map-alist. 473 ;; minor-mode-map-alist.
@@ -516,17 +488,15 @@ The command \\[describe-input-method] describes the current Quail package."
516 (setq quail-mode nil) 488 (setq quail-mode nil)
517 (error "No Quail package loaded")) 489 (error "No Quail package loaded"))
518 (quail-select-package name))) 490 (quail-select-package name)))
519 (setq inactivate-current-input-method-function 'quail-mode) 491 (setq inactivate-current-input-method-function 'quail-inactivate)
520 (setq describe-current-input-method-function 'quail-help) 492 (setq describe-current-input-method-function 'quail-help)
521 (setq quail-mode-line-format (quail-generate-mode-line-format))
522 (quail-delete-overlays) 493 (quail-delete-overlays)
523 (quail-show-guidance-buf) 494 (quail-show-guidance-buf)
524 ;; If we are in minibuffer, turn off Quail mode before exiting. 495 ;; If we are in minibuffer, turn off Quail mode before exiting.
525 (if (eq (selected-window) (minibuffer-window)) 496 (if (eq (selected-window) (minibuffer-window))
526 (add-hook 'minibuffer-exit-hook 'quail-exit-from-minibuffer)) 497 (add-hook 'minibuffer-exit-hook 'quail-exit-from-minibuffer))
527 (make-local-hook 'post-command-hook) 498 (make-local-hook 'post-command-hook)
528 (run-hooks 'quail-mode-hook) 499 (run-hooks 'quail-mode-hook))
529 (run-hooks 'input-method-activate-hook))
530 (force-mode-line-update)) 500 (force-mode-line-update))
531 501
532(defun quail-exit-from-minibuffer () 502(defun quail-exit-from-minibuffer ()
@@ -534,47 +504,50 @@ The command \\[describe-input-method] describes the current Quail package."
534 (if (<= (minibuffer-depth) 1) 504 (if (<= (minibuffer-depth) 1)
535 (remove-hook 'minibuffer-exit-hook 'quail-exit-from-minibuffer))) 505 (remove-hook 'minibuffer-exit-hook 'quail-exit-from-minibuffer)))
536 506
537(defvar quail-saved-overriding-local-map nil) 507(defvar quail-saved-current-map nil)
538(defvar quail-saved-current-buffer nil) 508(defvar quail-saved-current-buffer nil)
539 509
540;; Toggle `quail-mode'. This function is added to `post-command-hook' 510;; Toggle Quail mode. This function is added to `post-command-hook'
541;; in Quail mode, to turn Quail mode temporarily off, or back on 511;; in Quail mode, to turn Quail mode temporarily off, or back on after
542;; after one non-Quail command. 512;; one non-Quail command.
543(defun quail-toggle-mode-temporarily () 513(defun quail-toggle-mode-temporarily ()
544 (if quail-mode 514 (if quail-mode
545 ;; We are going to handle following events out of Quail mode. 515 ;; We are going to handle following events out of Quail mode.
546 (setq quail-mode nil 516 (setq quail-saved-current-buffer (current-buffer)
547 quail-saved-overriding-local-map overriding-local-map 517 quail-saved-current-map overriding-terminal-local-map
548 quail-saved-current-buffer (current-buffer) 518 quail-mode nil
549 overriding-local-map nil) 519 overriding-terminal-local-map nil)
550 ;; We have just executed one non-Quail command. We don't need 520 ;; We have just executed one non-Quail command. We don't need
551 ;; this hook any more. 521 ;; this hook any more.
552 (remove-hook 'post-command-hook 'quail-toggle-mode-temporarily t) 522 (remove-hook 'post-command-hook 'quail-toggle-mode-temporarily t)
553 ;; If the command changed the current buffer, we should not go 523 (if (eq (current-buffer) quail-saved-current-buffer)
554 ;; back to Quail mode. 524 ;; We should go back to Quail mode only when the current input
555 (if (not (eq (current-buffer) quail-saved-current-buffer)) 525 ;; method was not turned off by the last command.
556 (throw 'quail-tag nil) 526 (when current-input-method
557 ;; Let's go back to Quail mode. 527 (setq quail-mode t
558 (setq quail-mode t) 528 overriding-terminal-local-map quail-saved-current-map)
559 (setq overriding-local-map quail-saved-overriding-local-map) 529 (if input-method-exit-on-invalid-key
560 ;; If whole text in conversion area was deleted, exit from the 530 (inactivate-input-method)))
561 ;; recursive edit. 531 ;; The last command changed the current buffer, we should not go
562 (let ((start (overlay-start quail-conv-overlay))) 532 ;; back to Quail mode in this new buffer, but should turn on
563 (if (and start (= start (overlay-end quail-conv-overlay))) 533 ;; Quail mode in the original buffer.
564 (throw 'quail-tag nil))) 534 (save-excursion
565 ))) 535 (set-buffer quail-saved-current-buffer)
536 (setq quail-mode t)
537 (quail-delete-overlays)))))
566 538
567(defun quail-execute-non-quail-command () 539(defun quail-execute-non-quail-command ()
568 "Execute one non-Quail command in Quail mode. 540 "Execute one non-Quail command out of Quail mode.
569The current translation and conversion are terminated." 541The current translation and conversion are terminated."
570 (interactive) 542 (interactive)
571 (setq unread-command-events (cons last-input-event unread-command-events)) 543 (setq unread-command-events (cons last-input-event unread-command-events))
572 (quail-delete-overlays) 544 (quail-delete-overlays)
545 (setq overriding-terminal-local-map nil)
573 (if (buffer-live-p quail-guidance-buf) 546 (if (buffer-live-p quail-guidance-buf)
574 (save-excursion 547 (save-excursion
575 (set-buffer quail-guidance-buf) 548 (set-buffer quail-guidance-buf)
576 (erase-buffer))) 549 (erase-buffer)))
577 (throw 'quail-tag nil)) 550 (add-hook 'post-command-hook 'quail-toggle-mode-temporarily nil t))
578 551
579;; Keyboard layout translation handlers. 552;; Keyboard layout translation handlers.
580 553
@@ -893,25 +866,6 @@ The returned value is a Quail map specific to KEY."
893 )) 866 ))
894 map)) 867 map))
895 868
896(defun quail-conv-overlay-modification-hook (overlay after &rest ignore)
897 (if (and after
898 (= (overlay-start overlay) (overlay-end overlay)))
899 ;; Whole text in conversion area was deleted. Let's exit from
900 ;; the recursive edit.
901 (throw 'exit nil)))
902
903(defvar quail-suppress-conversion nil
904 "If non-nil, suppress conversion facility of the current Quail package.
905We distinguish between \"translation\" and \"conversion\" aspects
906of an input method. Translation is the first step, done by Quail itself;
907conversion is the second step which changes the translated text into
908bettertext. For instance, the Quail package for Japanese (`quail-jp')
909translates Roman text (transliteration of Japanese in Latin alphabets)
910to Hiragana text, and then converts the Hiragana into Kanji-and-Kana
911mixed text or Katakana text.
912
913If this variable is non-nil, translation still occurs, but not conversion.")
914
915;; If set to non-nil, exit conversion mode before starting new translation. 869;; If set to non-nil, exit conversion mode before starting new translation.
916(defvar quail-exit-conversion-mode nil) 870(defvar quail-exit-conversion-mode nil)
917 871
@@ -927,45 +881,16 @@ If this variable is non-nil, translation still occurs, but not conversion.")
927 ;; Check the possibility of translating the last key. 881 ;; Check the possibility of translating the last key.
928 (if (assq last-command-event (cdr (quail-map))) 882 (if (assq last-command-event (cdr (quail-map)))
929 ;; Ok, we can start translation. 883 ;; Ok, we can start translation.
930 (let ((mode-line-format quail-mode-line-format)) 884 (if (quail-conversion-keymap)
931 (quail-setup-overlays) 885 ;; We must start translation in conversion mode.
932 (if (catch 'quail-tag 886 (setq quail-exit-conversion-mode nil
933 (if (and (not quail-suppress-conversion) 887 overriding-terminal-local-map (quail-conversion-keymap))
934 (quail-conversion-keymap)) 888 (quail-setup-overlays nil)
935 ;; We must start translation in conversion mode. 889 (setq quail-current-key "")
936 (let ((overriding-terminal-local-map (quail-conversion-keymap))) 890 (setq overriding-terminal-local-map (quail-translation-keymap)))
937 (setq quail-exit-conversion-mode nil) 891 ;; Since the last event doesn't start any translation, handle it
938 (catch 'exit 892 ;; out of Quail mode. We come back to Quail mode later by setting
939 (while t 893 ;; function `quail-toggle-mode-temporarily' in
940 (let* ((key (read-key-sequence nil))
941 (definition (lookup-key overriding-terminal-local-map key t)))
942 (setq last-command-event (aref key 0))
943 (setq prefix-arg nil)
944 (if definition (call-interactively definition)))))
945 (if (and auto-fill-function
946 (> (current-column) (current-fill-column)))
947 (run-hooks 'auto-fill-function)))
948 (let ((overriding-terminal-local-map (quail-translation-keymap)))
949 (setq quail-current-key "")
950 (catch 'exit
951 (while t
952 (let* ((key (read-key-sequence nil))
953 (definition (lookup-key overriding-terminal-local-map key t)))
954 (setq last-command-event (aref key 0))
955 (setq prefix-arg nil)
956 (if definition (call-interactively definition)))))))
957 (if (prog1 (< (overlay-start quail-conv-overlay)
958 (overlay-end quail-conv-overlay))
959 (delete-overlay quail-conv-overlay))
960 (run-hooks 'input-method-after-insert-chunk-hook))
961 nil)
962 ;; Someone has thrown a tag with value t, which means
963 ;; we should turn Quail mode off.
964 (quail-mode -1))
965 (message ""))
966 ;; Since the typed character doesn't start any translation, handle
967 ;; it out of Quail mode. We come back to Quail mode later because
968 ;; function `quail-toggle-mode-temporarily' is in
969 ;; `post-command-hook'. 894 ;; `post-command-hook'.
970 (add-hook 'post-command-hook 'quail-toggle-mode-temporarily nil t))) 895 (add-hook 'post-command-hook 'quail-toggle-mode-temporarily nil t)))
971 896
@@ -981,28 +906,25 @@ If this variable is non-nil, translation still occurs, but not conversion.")
981 (interactive "*") 906 (interactive "*")
982 (setq unread-command-events 907 (setq unread-command-events
983 (cons last-command-event unread-command-events)) 908 (cons last-command-event unread-command-events))
984 (if (or quail-exit-conversion-mode
985 (not (quail-point-in-conversion-region)))
986 (progn
987 ;; We must start translation with new conversion region.
988 (setq quail-exit-conversion-mode nil)
989 (throw 'exit nil)))
990 ;; Check the possibility of translating the last key. 909 ;; Check the possibility of translating the last key.
991 (if (assq last-command-event (cdr (quail-map))) 910 (if (assq last-command-event (cdr (quail-map)))
992 ;; Ok, we can start translation. 911 ;; Ok, we can start translation.
993 (let ((overriding-local-map (quail-translation-keymap))) 912 (progn
913 (quail-setup-overlays t)
994 (setq quail-current-key "") 914 (setq quail-current-key "")
995 (move-overlay quail-overlay (point) (point)) 915 (setq overriding-terminal-local-map (quail-translation-keymap))
996 (recursive-edit)) 916 (move-overlay quail-overlay (point) (point)))
997 ;; Since the typed character doesn't start any translation, handle 917 ;; Since the last event doesn't start any translation, handle it
998 ;; it out of Quail mode. We come back to Quail mode later because 918 ;; out of Quail mode. We come back to Quail mode later by setting
999 ;; function `quail-toggle-mode-temporarily' is in 919 ;; function `quail-toggle-mode-temporarily' in
1000 ;; `post-command-hook'. 920 ;; `post-command-hook'.
1001 (add-hook 'post-command-hook 'quail-toggle-mode-temporarily nil t))) 921 (add-hook 'post-command-hook 'quail-toggle-mode-temporarily nil t)))
1002 922
1003(defsubst quail-delete-region () 923(defsubst quail-delete-region ()
1004 "Delete the text in the current translation region of Quail." 924 "Delete the text in the current translation region of Quail."
1005 (delete-region (overlay-start quail-overlay) (overlay-end quail-overlay))) 925 (if (overlay-start quail-overlay)
926 (delete-region (overlay-start quail-overlay)
927 (overlay-end quail-overlay))))
1006 928
1007(defun quail-terminate-translation () 929(defun quail-terminate-translation ()
1008 "Terminate the translation of the current key." 930 "Terminate the translation of the current key."
@@ -1029,7 +951,10 @@ If this variable is non-nil, translation still occurs, but not conversion.")
1029 (save-excursion 951 (save-excursion
1030 (set-buffer quail-guidance-buf) 952 (set-buffer quail-guidance-buf)
1031 (erase-buffer))) 953 (erase-buffer)))
1032 (throw 'exit nil)) 954 (setq overriding-terminal-local-map
955 (if (and (overlayp quail-conv-overlay)
956 (overlay-start quail-conv-overlay))
957 (quail-conversion-keymap))))
1033 958
1034(defun quail-select-current () 959(defun quail-select-current ()
1035 "Select the current text shown in Quail translation region." 960 "Select the current text shown in Quail translation region."
@@ -1060,15 +985,17 @@ If this variable is non-nil, translation still occurs, but not conversion.")
1060 (substring quail-current-key 0 len)))) 985 (substring quail-current-key 0 len))))
1061 (insert (or quail-current-str quail-current-key))))) 986 (insert (or quail-current-str quail-current-key)))))
1062 (quail-update-guidance) 987 (quail-update-guidance)
1063 (if control-flag 988 (when control-flag
1064 (quail-terminate-translation))) 989 (quail-terminate-translation)
990 (run-hooks 'input-method-after-insert-chunk-hook)))
1065 991
1066(defun quail-self-insert-command () 992(defun quail-self-insert-command ()
1067 "Add the typed character to the key for translation." 993 "Add the typed character to the key for translation."
1068 (interactive "*") 994 (interactive "*")
1069 (setq quail-current-key 995 (setq quail-current-key
1070 (concat quail-current-key (char-to-string last-command-event))) 996 (concat quail-current-key (char-to-string last-command-event)))
1071 (quail-update-translation (quail-translate-key))) 997 (catch 'quail-tag
998 (quail-update-translation (quail-translate-key))))
1072 999
1073;; Return the actual definition part of Quail map MAP. 1000;; Return the actual definition part of Quail map MAP.
1074(defun quail-map-definition (map) 1001(defun quail-map-definition (map)
@@ -1307,18 +1234,20 @@ sequence counting from the head."
1307 (if (>= (point) (overlay-end quail-conv-overlay)) 1234 (if (>= (point) (overlay-end quail-conv-overlay))
1308 (error "End of conversion region")) 1235 (error "End of conversion region"))
1309 (delete-char 1) 1236 (delete-char 1)
1310 (if (= (overlay-start quail-conv-overlay) 1237 (when (= (overlay-start quail-conv-overlay)
1311 (overlay-end quail-conv-overlay)) 1238 (overlay-end quail-conv-overlay))
1312 (throw 'quail-tag nil))) 1239 (quail-delete-overlays)
1240 (setq overriding-terminal-local-map nil)))
1313 1241
1314(defun quail-conversion-backward-delete-char () 1242(defun quail-conversion-backward-delete-char ()
1315 (interactive) 1243 (interactive)
1316 (if (<= (point) (overlay-start quail-conv-overlay)) 1244 (if (<= (point) (overlay-start quail-conv-overlay))
1317 (error "Beginning of conversion region")) 1245 (error "Beginning of conversion region"))
1318 (delete-char -1) 1246 (delete-char -1)
1319 (if (= (overlay-start quail-conv-overlay) 1247 (when (= (overlay-start quail-conv-overlay)
1320 (overlay-end quail-conv-overlay)) 1248 (overlay-end quail-conv-overlay))
1321 (throw 'quail-tag nil))) 1249 (quail-delete-overlays)
1250 (setq overriding-terminal-local-map nil)))
1322 1251
1323(defun quail-do-conversion (func &rest args) 1252(defun quail-do-conversion (func &rest args)
1324 "Call FUNC to convert text in the current conversion region of Quail. 1253 "Call FUNC to convert text in the current conversion region of Quail.
@@ -1329,7 +1258,8 @@ Remaining args are for FUNC."
1329(defun quail-no-conversion () 1258(defun quail-no-conversion ()
1330 "Do no conversion of the current conversion region of Quail." 1259 "Do no conversion of the current conversion region of Quail."
1331 (interactive) 1260 (interactive)
1332 (throw 'exit nil)) 1261 (quail-delete-overlays)
1262 (setq overriding-terminal-local-map nil))
1333 1263
1334;; Guidance, Completion, and Help buffer handlers. 1264;; Guidance, Completion, and Help buffer handlers.
1335 1265
@@ -1651,7 +1581,7 @@ key binding
1651 (insert header)) 1581 (insert header))
1652 (save-excursion 1582 (save-excursion
1653 (save-window-excursion 1583 (save-window-excursion
1654 (let ((overriding-local-map keymap)) 1584 (let ((overriding-terminal-local-map keymap))
1655 (describe-bindings)) 1585 (describe-bindings))
1656 (set-buffer "*Help*") 1586 (set-buffer "*Help*")
1657 (goto-char (point-min)) 1587 (goto-char (point-min))