Commit a50192e7 authored by Kenichi Handa's avatar Kenichi Handa
Browse files

Mostly re-written.

parent f9f1ed46
2000-05-31 Kenichi Handa <>
* isearch.el (isearch-printing-char): If keyboard coding system is
being used, call isearch-process-search-multibyte-characters.
* international/isearch-x.el: Mostly rewritten.
* international/quail.el (quail-start-conversion): Don't include
unhandled events in the returned events, but set them in
unread-command-events. Exit if all inputs are deleted.
2000-05-30 Jason Rumney <>
* w32-fns.el (w32-charset-info-alist): Add each charset separately.
......@@ -50,61 +50,85 @@
(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)
(define-key map "\C-g" 'exit-minibuffer)
(let ((map (copy-keymap minibuffer-local-map)))
(define-key map [with-keyboard-coding] 'isearch-with-keyboard-coding)
(define-key map [with-input-method] 'isearch-with-input-method)
"Keymap of minibuffer to input multibyte characters while isearching.")
"Keymap to use in minibuffer for multibyte character inputting in isearch.")
(defun isearch-minibuffer-non-self-insert ()
;; These two variables are used to refer to the values of
;; `current-input-method' and `input-method-function' of the original
;; buffer in the function isearch-with-input-method which runs in a
;; minibuffer.
(defvar isearch-minibuffer-input-method nil)
(defvar isearch-minibuffer-input-method-function nil)
;; Exit from recursive edit safely. Set in `after-change-functions'
;; by isearch-with-keyboard-coding.
(defun isearch-exit-recursive-edit ()
(setq unread-command-events (cons last-command-event unread-command-events))
(throw 'exit nil))
;; Simulate character decoding by the keyboard coding system in the
;; current buffer (minibuffer). As soon as a character is inserted,
;; it exits from minibuffer.
(defun isearch-with-keyboard-coding ()
(let ((after-change-functions '(isearch-exit-recursive-edit)))
(defun isearch-minibuffer-self-insert ()
;; Simulate the work of the current input method in the current buffer
;; (minibuffer).
(defun isearch-with-input-method ()
(let ((events (cons last-command-event unread-post-input-method-events)))
(catch 'isearch-tag
(while events
(let* ((event (car events))
(cmd (key-binding (vector event))))
(cond ((or (eq cmd 'isearch-printing-char)
(eq cmd 'isearch-minibuffer-self-insert))
(insert event)
(setq events (cdr events)))
((eq cmd 'exit-minibuffer)
(setq events (cdr events))
(throw 'isearch-tag nil))
(throw 'isearch-tag nil))))))
(setq unread-post-input-method-events events)
(let* ((current-input-method isearch-minibuffer-input-method)
(events (funcall isearch-minibuffer-input-method-function nil)))
;; EVENTS is a list of events the input method has generated. It
;; contains a character event and/or the special event
;; `compose-last-chars'. We extract only character events and
;; insert the corresponding characters.
(while events
(if (integerp (car events)) (insert (car events)))
(setq events (cdr events)))
(defun isearch-process-search-multibyte-characters (last-char)
(if (eq this-command 'isearch-printing-char)
(let ((overriding-terminal-local-map nil)
;; Let input method work rather tersely.
(input-method-verbose-flag nil)
(prompt (concat (isearch-message-prefix) isearch-message))
(minibuffer-local-map isearch-minibuffer-local-map)
(setq unread-command-events
(cons last-char unread-command-events))
(setq str (read-multilingual-string
(concat (isearch-message-prefix) isearch-message)
(if isearch-input-method-function
(let (;; Let input method work rather tersely.
(input-method-verbose-flag nil)
(isearch-minibuffer-input-method current-input-method)
(setq unread-command-events
(cons 'with-input-method
(cons last-char unread-command-events))
str (read-string prompt))
(if (not str)
;; All inputs were deleted while the input method
;; was working.
(setq str "")
(if (and (= (length str) 1)
(= (aref str 0) last-char))
;; The input method couldn't handle LAST-CHAR.
(setq str nil)))))
(if (and (not str) (keyboard-coding-system))
(setq unread-command-events
(cons 'with-keyboard-coding
(cons last-char unread-command-events))
str (read-string prompt)))
(if (and str (> (length str) 0))
(let ((unread-command-events nil))
(isearch-process-search-string str str))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment