| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 |
(defun isearch-toggle-specified-input-method () |
|---|
| 38 |
"Select an input method and turn it on in interactive search." |
|---|
| 39 |
(interactive) |
|---|
| 40 |
(let ((overriding-terminal-local-map nil)) |
|---|
| 41 |
(toggle-input-method t)) |
|---|
| 42 |
(setq isearch-input-method-function input-method-function |
|---|
| 43 |
isearch-input-method-local-p t) |
|---|
| 44 |
(setq input-method-function nil) |
|---|
| 45 |
(isearch-update)) |
|---|
| 46 |
|
|---|
| 47 |
|
|---|
| 48 |
(defun isearch-toggle-input-method () |
|---|
| 49 |
"Toggle input method in interactive search." |
|---|
| 50 |
(interactive) |
|---|
| 51 |
(let ((overriding-terminal-local-map nil)) |
|---|
| 52 |
(toggle-input-method)) |
|---|
| 53 |
(setq isearch-input-method-function input-method-function |
|---|
| 54 |
isearch-input-method-local-p t) |
|---|
| 55 |
(setq input-method-function nil) |
|---|
| 56 |
(isearch-update)) |
|---|
| 57 |
|
|---|
| 58 |
(defvar isearch-minibuffer-local-map |
|---|
| 59 |
(let ((map (copy-keymap minibuffer-local-map))) |
|---|
| 60 |
(define-key map [with-keyboard-coding] 'isearch-with-keyboard-coding) |
|---|
| 61 |
(define-key map [with-input-method] 'isearch-with-input-method) |
|---|
| 62 |
map) |
|---|
| 63 |
"Keymap to use in minibuffer for multibyte character inputting in isearch.") |
|---|
| 64 |
|
|---|
| 65 |
|
|---|
| 66 |
|
|---|
| 67 |
(defun isearch-exit-recursive-edit (start end length) |
|---|
| 68 |
(interactive) |
|---|
| 69 |
(throw 'exit nil)) |
|---|
| 70 |
|
|---|
| 71 |
|
|---|
| 72 |
|
|---|
| 73 |
|
|---|
| 74 |
|
|---|
| 75 |
(defun isearch-with-keyboard-coding () |
|---|
| 76 |
(interactive) |
|---|
| 77 |
(let ((after-change-functions '(isearch-exit-recursive-edit))) |
|---|
| 78 |
(recursive-edit)) |
|---|
| 79 |
(exit-minibuffer)) |
|---|
| 80 |
|
|---|
| 81 |
|
|---|
| 82 |
|
|---|
| 83 |
|
|---|
| 84 |
(defun isearch-with-input-method () |
|---|
| 85 |
(interactive) |
|---|
| 86 |
(let ((key (car unread-command-events)) |
|---|
| 87 |
events) |
|---|
| 88 |
(setq unread-command-events (cdr unread-command-events) |
|---|
| 89 |
events (funcall input-method-function key)) |
|---|
| 90 |
|
|---|
| 91 |
|
|---|
| 92 |
|
|---|
| 93 |
|
|---|
| 94 |
(while events |
|---|
| 95 |
(if (integerp (car events)) (insert (car events))) |
|---|
| 96 |
(setq events (cdr events))) |
|---|
| 97 |
(exit-minibuffer))) |
|---|
| 98 |
|
|---|
| 99 |
|
|---|
| 100 |
(defun isearch-process-search-multibyte-characters (last-char) |
|---|
| 101 |
(if (eq this-command 'isearch-printing-char) |
|---|
| 102 |
(let ((overriding-terminal-local-map nil) |
|---|
| 103 |
(prompt (isearch-message-prefix)) |
|---|
| 104 |
(minibuffer-local-map isearch-minibuffer-local-map) |
|---|
| 105 |
str junk-hist) |
|---|
| 106 |
|
|---|
| 107 |
|
|---|
| 108 |
|
|---|
| 109 |
|
|---|
| 110 |
|
|---|
| 111 |
|
|---|
| 112 |
|
|---|
| 113 |
(set-text-properties 0 (length prompt) nil prompt) |
|---|
| 114 |
|
|---|
| 115 |
(if isearch-input-method-function |
|---|
| 116 |
(let ( |
|---|
| 117 |
(input-method-verbose-flag nil)) |
|---|
| 118 |
(setq unread-command-events |
|---|
| 119 |
(cons 'with-input-method |
|---|
| 120 |
(cons last-char unread-command-events)) |
|---|
| 121 |
|
|---|
| 122 |
str (read-string prompt isearch-message 'junk-hist nil t)) |
|---|
| 123 |
(if (or (not str) (< (length str) (length isearch-message))) |
|---|
| 124 |
|
|---|
| 125 |
|
|---|
| 126 |
(setq str "") |
|---|
| 127 |
(setq str (substring str (length isearch-message))) |
|---|
| 128 |
(if (and (= (length str) 1) |
|---|
| 129 |
(= (aref str 0) last-char) |
|---|
| 130 |
(>= last-char 128)) |
|---|
| 131 |
|
|---|
| 132 |
(setq str nil))))) |
|---|
| 133 |
|
|---|
| 134 |
(if (and (not str) (keyboard-coding-system)) |
|---|
| 135 |
(setq unread-command-events |
|---|
| 136 |
(cons 'with-keyboard-coding |
|---|
| 137 |
(cons last-char unread-command-events)) |
|---|
| 138 |
str (read-string prompt nil 'junk-hist))) |
|---|
| 139 |
|
|---|
| 140 |
(if (and str (> (length str) 0)) |
|---|
| 141 |
(let ((unread-command-events nil)) |
|---|
| 142 |
(isearch-process-search-string str str)) |
|---|
| 143 |
(isearch-update))) |
|---|
| 144 |
(isearch-process-search-char last-char))) |
|---|
| 145 |
|
|---|
| 146 |
|
|---|
| 147 |
|
|---|
| 148 |
|
|---|