changeset 22780:54069d469c31

(isearch-toggle-specified-input-method): Adjusted for the change in isearch.el. (isearch-toggle-input-method): Likewise. (isearch-minibuffer-local-map): New variable. (isearch-minibuffer-non-self-insert): New function. (isearch-minibuffer-self-insert): New function. (isearch-process-search-multibyte-characters): Read multibyte characters from minibuffer with the keymap isearch-minibuffer-local-map.
author Kenichi Handa <handa@m17n.org>
date Sun, 19 Jul 1998 05:17:35 +0000
parents 9c3f4ae0d7ed
children d7ebc53b6b16
files lisp/international/isearch-x.el
diffstat 1 files changed, 47 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/international/isearch-x.el	Sun Jul 19 05:17:35 1998 +0000
+++ b/lisp/international/isearch-x.el	Sun Jul 19 05:17:35 1998 +0000
@@ -33,6 +33,9 @@
   (interactive)
   (let ((overriding-terminal-local-map nil))
     (toggle-input-method t))
+  (setq isearch-input-method-function input-method-function
+	isearch-input-method-local-p t)
+  (setq input-method-function nil)
   (isearch-update))
 
 ;;;###autoload
@@ -41,21 +44,58 @@
   (interactive)
   (let ((overriding-terminal-local-map nil))
     (toggle-input-method))
+  (setq isearch-input-method-function input-method-function
+	isearch-input-method-local-p t)
+  (setq input-method-function nil)
   (isearch-update))
 
+(defvar isearch-minibuffer-local-map
+  (let ((map (make-keymap)))
+    (define-key map [t] 'isearch-minibuffer-non-self-insert)
+    (let ((i ?\ ))
+      (while (< i 256)
+	(define-key map (vector i) 'isearch-minibuffer-self-insert)
+	(setq i (1+ i))))
+    (let ((l (generic-character-list))
+	  (table (nth 1 map)))
+      (while l
+	(set-char-table-default table (car l) 'isearch-minibuffer-self-insert)
+	(setq l (cdr l))))
+    (define-key map "\C-m" 'exit-minibuffer)
+    (define-key map [return] 'exit-minibuffer)
+    map)
+  "Keymap of minibuffer to input multibyte characters while isearching.")
+
+(defun isearch-minibuffer-non-self-insert ()
+  (interactive)
+  (setq unread-command-events (cons last-command-event unread-command-events))
+  (exit-minibuffer))
+
+(defun isearch-minibuffer-self-insert ()
+  (interactive)
+  (setq unread-command-events (cons last-command-event unread-command-events))
+  (let ((continue t)
+	event)
+    (while continue
+      (setq event (car unread-command-events))
+      (if (eq (lookup-key isearch-mode-map (vector event))
+	      'isearch-printing-char)
+	  (progn
+	    (insert event)
+	    (setq unread-command-events (cdr unread-command-events)))
+	(setq continue nil))))
+  (or unread-command-events
+      (exit-minibuffer)))
+
 ;;;###autoload
 (defun isearch-process-search-multibyte-characters (last-char)
   (let ((overriding-terminal-local-map nil)
-	;; Let input method exit when a chunk is inserted.
-	(input-method-after-insert-chunk-hook '(inactivate-input-method))
-	(input-method-inactivate-hook '(exit-minibuffer))
 	;; Let input method work rather tersely.
 	(input-method-verbose-flag nil)
-	;; A key not handled by the current input method should
-	;; terminate the input method.
-	(input-method-exit-on-invalid-key t)
+	(minibuffer-local-map isearch-minibuffer-local-map)
 	str)
-    (setq unread-command-events (cons last-char unread-command-events))
+    (setq unread-input-method-events
+	  (cons last-char unread-input-method-events))
     (setq str (read-multilingual-string
 	       (concat (isearch-message-prefix) isearch-message)
 	       nil