Mercurial > emacs
annotate lisp/international/isearch-x.el @ 38567:5ee0cb00ee57
(resize_mini_window): Give up when inhibit-redisplay
is non-nil, instead of when redisplaying_p is non-zero. See
comment there.
(mark_window_display_accurate_1): Add an assertion.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Thu, 26 Jul 2001 09:54:02 +0000 |
parents | b174db545cfd |
children | 2fd8ebeef411 |
rev | line source |
---|---|
17052 | 1 ;;; isearch-x.el --- extended isearch handling commands |
2 | |
3 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN. | |
18377
8b4a66c66dd6
Change copyright notice.
Richard M. Stallman <rms@gnu.org>
parents:
17071
diff
changeset
|
4 ;; Licensed to the Free Software Foundation. |
17052 | 5 |
6 ;; Keywords: multilingual, isearch | |
7 | |
8 ;; Author: Kenichi HANDA <handa@etl.go.jp> | |
9 ;; Maintainer: Kenichi HANDA <handa@etl.go.jp> | |
10 | |
11 ;; This file is part of GNU Emacs. | |
12 | |
13 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
14 ;; it under the terms of the GNU General Public License as published by | |
15 ;; the Free Software Foundation; either version 2, or (at your option) | |
16 ;; any later version. | |
17 | |
18 ;; GNU Emacs is distributed in the hope that it will be useful, | |
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 ;; GNU General Public License for more details. | |
22 | |
23 ;; You should have received a copy of the GNU General Public License | |
17071 | 24 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
25 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
26 ;; Boston, MA 02111-1307, USA. | |
17052 | 27 |
38436
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
32798
diff
changeset
|
28 ;;; Commentary: |
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
32798
diff
changeset
|
29 |
17052 | 30 ;;; Code: |
31 | |
32 ;;;###autoload | |
33 (defun isearch-toggle-specified-input-method () | |
18713
bca5a6b78f91
(isearch-input-method): New variable.
Kenichi Handa <handa@m17n.org>
parents:
18377
diff
changeset
|
34 "Select an input method and turn it on in interactive search." |
17052 | 35 (interactive) |
19407
50444ccff3f2
(isearch-input-method): Deleted.
Kenichi Handa <handa@m17n.org>
parents:
19390
diff
changeset
|
36 (let ((overriding-terminal-local-map nil)) |
50444ccff3f2
(isearch-input-method): Deleted.
Kenichi Handa <handa@m17n.org>
parents:
19390
diff
changeset
|
37 (toggle-input-method t)) |
22780
54069d469c31
(isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents:
19433
diff
changeset
|
38 (setq isearch-input-method-function input-method-function |
54069d469c31
(isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents:
19433
diff
changeset
|
39 isearch-input-method-local-p t) |
54069d469c31
(isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents:
19433
diff
changeset
|
40 (setq input-method-function nil) |
19407
50444ccff3f2
(isearch-input-method): Deleted.
Kenichi Handa <handa@m17n.org>
parents:
19390
diff
changeset
|
41 (isearch-update)) |
17052 | 42 |
43 ;;;###autoload | |
44 (defun isearch-toggle-input-method () | |
45 "Toggle input method in interactive search." | |
46 (interactive) | |
19407
50444ccff3f2
(isearch-input-method): Deleted.
Kenichi Handa <handa@m17n.org>
parents:
19390
diff
changeset
|
47 (let ((overriding-terminal-local-map nil)) |
50444ccff3f2
(isearch-input-method): Deleted.
Kenichi Handa <handa@m17n.org>
parents:
19390
diff
changeset
|
48 (toggle-input-method)) |
22780
54069d469c31
(isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents:
19433
diff
changeset
|
49 (setq isearch-input-method-function input-method-function |
54069d469c31
(isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents:
19433
diff
changeset
|
50 isearch-input-method-local-p t) |
54069d469c31
(isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents:
19433
diff
changeset
|
51 (setq input-method-function nil) |
17052 | 52 (isearch-update)) |
53 | |
22780
54069d469c31
(isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents:
19433
diff
changeset
|
54 (defvar isearch-minibuffer-local-map |
29327 | 55 (let ((map (copy-keymap minibuffer-local-map))) |
56 (define-key map [with-keyboard-coding] 'isearch-with-keyboard-coding) | |
57 (define-key map [with-input-method] 'isearch-with-input-method) | |
22780
54069d469c31
(isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents:
19433
diff
changeset
|
58 map) |
29327 | 59 "Keymap to use in minibuffer for multibyte character inputting in isearch.") |
60 | |
61 ;; Exit from recursive edit safely. Set in `after-change-functions' | |
62 ;; by isearch-with-keyboard-coding. | |
63 (defun isearch-exit-recursive-edit () | |
22780
54069d469c31
(isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents:
19433
diff
changeset
|
64 (interactive) |
29327 | 65 (throw 'exit nil)) |
66 | |
67 ;; Simulate character decoding by the keyboard coding system in the | |
68 ;; current buffer (minibuffer). As soon as a character is inserted, | |
69 ;; it exits from minibuffer. | |
70 | |
71 (defun isearch-with-keyboard-coding () | |
72 (interactive) | |
73 (let ((after-change-functions '(isearch-exit-recursive-edit))) | |
74 (recursive-edit)) | |
22780
54069d469c31
(isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents:
19433
diff
changeset
|
75 (exit-minibuffer)) |
54069d469c31
(isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents:
19433
diff
changeset
|
76 |
29327 | 77 ;; Simulate the work of the current input method in the current buffer |
78 ;; (minibuffer). | |
79 | |
80 (defun isearch-with-input-method () | |
22780
54069d469c31
(isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents:
19433
diff
changeset
|
81 (interactive) |
32798
6d04a7aba075
(isearch-with-input-method): Call input-method-function with the first
Kenichi Handa <handa@m17n.org>
parents:
29719
diff
changeset
|
82 (let ((key (car unread-command-events)) |
6d04a7aba075
(isearch-with-input-method): Call input-method-function with the first
Kenichi Handa <handa@m17n.org>
parents:
29719
diff
changeset
|
83 events) |
6d04a7aba075
(isearch-with-input-method): Call input-method-function with the first
Kenichi Handa <handa@m17n.org>
parents:
29719
diff
changeset
|
84 (setq unread-command-events (cdr unread-command-events) |
6d04a7aba075
(isearch-with-input-method): Call input-method-function with the first
Kenichi Handa <handa@m17n.org>
parents:
29719
diff
changeset
|
85 events (funcall input-method-function key)) |
29327 | 86 ;; EVENTS is a list of events the input method has generated. It |
87 ;; contains a character event and/or the special event | |
88 ;; `compose-last-chars'. We extract only character events and | |
89 ;; insert the corresponding characters. | |
90 (while events | |
91 (if (integerp (car events)) (insert (car events))) | |
92 (setq events (cdr events))) | |
22920
f80a1ca0112f
(isearch-minibuffer-local-map): Bind
Kenichi Handa <handa@m17n.org>
parents:
22803
diff
changeset
|
93 (exit-minibuffer))) |
22780
54069d469c31
(isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents:
19433
diff
changeset
|
94 |
19407
50444ccff3f2
(isearch-input-method): Deleted.
Kenichi Handa <handa@m17n.org>
parents:
19390
diff
changeset
|
95 ;;;###autoload |
17052 | 96 (defun isearch-process-search-multibyte-characters (last-char) |
22803
c52637c83ebf
(isearch-minibuffer-self-insert):
Kenichi Handa <handa@m17n.org>
parents:
22780
diff
changeset
|
97 (if (eq this-command 'isearch-printing-char) |
c52637c83ebf
(isearch-minibuffer-self-insert):
Kenichi Handa <handa@m17n.org>
parents:
22780
diff
changeset
|
98 (let ((overriding-terminal-local-map nil) |
29327 | 99 (prompt (concat (isearch-message-prefix) isearch-message)) |
22803
c52637c83ebf
(isearch-minibuffer-self-insert):
Kenichi Handa <handa@m17n.org>
parents:
22780
diff
changeset
|
100 (minibuffer-local-map isearch-minibuffer-local-map) |
c52637c83ebf
(isearch-minibuffer-self-insert):
Kenichi Handa <handa@m17n.org>
parents:
22780
diff
changeset
|
101 str) |
29327 | 102 (if isearch-input-method-function |
103 (let (;; Let input method work rather tersely. | |
29719
bec7534ceb14
(isearch-minibuffer-input-method)
Kenichi Handa <handa@m17n.org>
parents:
29327
diff
changeset
|
104 (input-method-verbose-flag nil)) |
29327 | 105 (setq unread-command-events |
106 (cons 'with-input-method | |
107 (cons last-char unread-command-events)) | |
29719
bec7534ceb14
(isearch-minibuffer-input-method)
Kenichi Handa <handa@m17n.org>
parents:
29327
diff
changeset
|
108 ;; Inherit current-input-method in a minibuffer. |
bec7534ceb14
(isearch-minibuffer-input-method)
Kenichi Handa <handa@m17n.org>
parents:
29327
diff
changeset
|
109 str (read-string prompt nil nil nil t)) |
29327 | 110 (if (not str) |
111 ;; All inputs were deleted while the input method | |
112 ;; was working. | |
113 (setq str "") | |
114 (if (and (= (length str) 1) | |
29719
bec7534ceb14
(isearch-minibuffer-input-method)
Kenichi Handa <handa@m17n.org>
parents:
29327
diff
changeset
|
115 (= (aref str 0) last-char) |
bec7534ceb14
(isearch-minibuffer-input-method)
Kenichi Handa <handa@m17n.org>
parents:
29327
diff
changeset
|
116 (>= last-char 128)) |
29327 | 117 ;; The input method couldn't handle LAST-CHAR. |
118 (setq str nil))))) | |
119 | |
120 (if (and (not str) (keyboard-coding-system)) | |
121 (setq unread-command-events | |
122 (cons 'with-keyboard-coding | |
123 (cons last-char unread-command-events)) | |
124 str (read-string prompt))) | |
125 | |
22803
c52637c83ebf
(isearch-minibuffer-self-insert):
Kenichi Handa <handa@m17n.org>
parents:
22780
diff
changeset
|
126 (if (and str (> (length str) 0)) |
22931
fad48aef2340
(isearch-process-search-multibyte-characters): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
22920
diff
changeset
|
127 (let ((unread-command-events nil)) |
fad48aef2340
(isearch-process-search-multibyte-characters): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
22920
diff
changeset
|
128 (isearch-process-search-string str str)) |
fad48aef2340
(isearch-process-search-multibyte-characters): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
22920
diff
changeset
|
129 (isearch-update))) |
22803
c52637c83ebf
(isearch-minibuffer-self-insert):
Kenichi Handa <handa@m17n.org>
parents:
22780
diff
changeset
|
130 (isearch-process-search-char last-char))) |
17052 | 131 |
132 ;;; isearch-x.el ends here |