annotate lisp/international/isearch-x.el @ 89961:3fd4a5c21153

Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-29 Merge from lorentey@elte.hu--2004/emacs--multi-tty--0, emacs--cvs-trunk--0 Patches applied: * lorentey@elte.hu--2004/emacs--multi-tty--0--patch-224 Added sorted-doc to backup regex in lib-src. * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-479 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-482 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-483 Build-in-place tweak * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-484 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-485 Update from CVS
author Miles Bader <miles@gnu.org>
date Tue, 10 Aug 2004 07:46:40 +0000
parents 68c22ea6027c
children fb79180b618d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1 ;;; isearch-x.el --- extended isearch handling commands
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
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.
39090
2fd8ebeef411 (isearch-exit-recursive-edit): Take
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
5 ;; Copyright (C) 2001 Free Software Foundation, Inc.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
6
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
7 ;; Keywords: multilingual, isearch
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
8
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
9 ;; Author: Kenichi HANDA <handa@etl.go.jp>
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
10 ;; Maintainer: Kenichi HANDA <handa@etl.go.jp>
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
11
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
12 ;; This file is part of GNU Emacs.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
13
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
14 ;; GNU Emacs is free software; you can redistribute it and/or modify
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
15 ;; it under the terms of the GNU General Public License as published by
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
16 ;; the Free Software Foundation; either version 2, or (at your option)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
17 ;; any later version.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
18
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
19 ;; GNU Emacs is distributed in the hope that it will be useful,
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
22 ;; GNU General Public License for more details.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
23
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
24 ;; You should have received a copy of the GNU General Public License
17071
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
25 ;; along with GNU Emacs; see the file COPYING. If not, write to the
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
26 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
27 ;; Boston, MA 02111-1307, USA.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
28
38436
b174db545cfd Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 32798
diff changeset
29 ;;; Commentary:
b174db545cfd Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 32798
diff changeset
30
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
31 ;;; Code:
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
32
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
33 ;;;###autoload
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
34 (defun isearch-toggle-specified-input-method ()
18713
bca5a6b78f91 (isearch-input-method): New variable.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
35 "Select an input method and turn it on in interactive search."
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
36 (interactive)
19407
50444ccff3f2 (isearch-input-method): Deleted.
Kenichi Handa <handa@m17n.org>
parents: 19390
diff changeset
37 (let ((overriding-terminal-local-map nil))
50444ccff3f2 (isearch-input-method): Deleted.
Kenichi Handa <handa@m17n.org>
parents: 19390
diff changeset
38 (toggle-input-method t))
22780
54069d469c31 (isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents: 19433
diff changeset
39 (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
40 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
41 (setq input-method-function nil)
19407
50444ccff3f2 (isearch-input-method): Deleted.
Kenichi Handa <handa@m17n.org>
parents: 19390
diff changeset
42 (isearch-update))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
43
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
44 ;;;###autoload
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
45 (defun isearch-toggle-input-method ()
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
46 "Toggle input method in interactive search."
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
47 (interactive)
19407
50444ccff3f2 (isearch-input-method): Deleted.
Kenichi Handa <handa@m17n.org>
parents: 19390
diff changeset
48 (let ((overriding-terminal-local-map nil))
50444ccff3f2 (isearch-input-method): Deleted.
Kenichi Handa <handa@m17n.org>
parents: 19390
diff changeset
49 (toggle-input-method))
22780
54069d469c31 (isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents: 19433
diff changeset
50 (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
51 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
52 (setq input-method-function nil)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
53 (isearch-update))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
54
22780
54069d469c31 (isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents: 19433
diff changeset
55 (defvar isearch-minibuffer-local-map
29327
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
56 (let ((map (copy-keymap minibuffer-local-map)))
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
57 (define-key map [with-keyboard-coding] 'isearch-with-keyboard-coding)
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
58 (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
59 map)
29327
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
60 "Keymap to use in minibuffer for multibyte character inputting in isearch.")
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
61
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
62 ;; Exit from recursive edit safely. Set in `after-change-functions'
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
63 ;; by isearch-with-keyboard-coding.
39090
2fd8ebeef411 (isearch-exit-recursive-edit): Take
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
64 (defun isearch-exit-recursive-edit (start end length)
22780
54069d469c31 (isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents: 19433
diff changeset
65 (interactive)
29327
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
66 (throw 'exit nil))
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
67
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
68 ;; Simulate character decoding by the keyboard coding system in the
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
69 ;; current buffer (minibuffer). As soon as a character is inserted,
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
70 ;; it exits from minibuffer.
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
71
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
72 (defun isearch-with-keyboard-coding ()
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
73 (interactive)
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
74 (let ((after-change-functions '(isearch-exit-recursive-edit)))
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
75 (recursive-edit))
22780
54069d469c31 (isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents: 19433
diff changeset
76 (exit-minibuffer))
54069d469c31 (isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents: 19433
diff changeset
77
29327
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
78 ;; Simulate the work of the current input method in the current buffer
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
79 ;; (minibuffer).
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
80
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
81 (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
82 (interactive)
32798
6d04a7aba075 (isearch-with-input-method): Call input-method-function with the first
Kenichi Handa <handa@m17n.org>
parents: 29719
diff changeset
83 (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
84 events)
6d04a7aba075 (isearch-with-input-method): Call input-method-function with the first
Kenichi Handa <handa@m17n.org>
parents: 29719
diff changeset
85 (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
86 events (funcall input-method-function key))
29327
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
87 ;; EVENTS is a list of events the input method has generated. It
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
88 ;; contains a character event and/or the special event
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
89 ;; `compose-last-chars'. We extract only character events and
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
90 ;; insert the corresponding characters.
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
91 (while events
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
92 (if (integerp (car events)) (insert (car events)))
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
93 (setq events (cdr events)))
22920
f80a1ca0112f (isearch-minibuffer-local-map): Bind
Kenichi Handa <handa@m17n.org>
parents: 22803
diff changeset
94 (exit-minibuffer)))
22780
54069d469c31 (isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents: 19433
diff changeset
95
19407
50444ccff3f2 (isearch-input-method): Deleted.
Kenichi Handa <handa@m17n.org>
parents: 19390
diff changeset
96 ;;;###autoload
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
97 (defun isearch-process-search-multibyte-characters (last-char)
22803
c52637c83ebf (isearch-minibuffer-self-insert):
Kenichi Handa <handa@m17n.org>
parents: 22780
diff changeset
98 (if (eq this-command 'isearch-printing-char)
c52637c83ebf (isearch-minibuffer-self-insert):
Kenichi Handa <handa@m17n.org>
parents: 22780
diff changeset
99 (let ((overriding-terminal-local-map nil)
29327
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
100 (prompt (concat (isearch-message-prefix) isearch-message))
22803
c52637c83ebf (isearch-minibuffer-self-insert):
Kenichi Handa <handa@m17n.org>
parents: 22780
diff changeset
101 (minibuffer-local-map isearch-minibuffer-local-map)
c52637c83ebf (isearch-minibuffer-self-insert):
Kenichi Handa <handa@m17n.org>
parents: 22780
diff changeset
102 str)
29327
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
103 (if isearch-input-method-function
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
104 (let (;; Let input method work rather tersely.
29719
bec7534ceb14 (isearch-minibuffer-input-method)
Kenichi Handa <handa@m17n.org>
parents: 29327
diff changeset
105 (input-method-verbose-flag nil))
29327
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
106 (setq unread-command-events
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
107 (cons 'with-input-method
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
108 (cons last-char unread-command-events))
29719
bec7534ceb14 (isearch-minibuffer-input-method)
Kenichi Handa <handa@m17n.org>
parents: 29327
diff changeset
109 ;; Inherit current-input-method in a minibuffer.
bec7534ceb14 (isearch-minibuffer-input-method)
Kenichi Handa <handa@m17n.org>
parents: 29327
diff changeset
110 str (read-string prompt nil nil nil t))
29327
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
111 (if (not str)
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
112 ;; All inputs were deleted while the input method
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
113 ;; was working.
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
114 (setq str "")
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
115 (if (and (= (length str) 1)
29719
bec7534ceb14 (isearch-minibuffer-input-method)
Kenichi Handa <handa@m17n.org>
parents: 29327
diff changeset
116 (= (aref str 0) last-char)
bec7534ceb14 (isearch-minibuffer-input-method)
Kenichi Handa <handa@m17n.org>
parents: 29327
diff changeset
117 (>= last-char 128))
29327
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
118 ;; The input method couldn't handle LAST-CHAR.
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
119 (setq str nil)))))
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
120
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
121 (if (and (not str) (keyboard-coding-system))
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
122 (setq unread-command-events
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
123 (cons 'with-keyboard-coding
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
124 (cons last-char unread-command-events))
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
125 str (read-string prompt)))
18bfc4113440 Mostly re-written.
Kenichi Handa <handa@m17n.org>
parents: 22931
diff changeset
126
22803
c52637c83ebf (isearch-minibuffer-self-insert):
Kenichi Handa <handa@m17n.org>
parents: 22780
diff changeset
127 (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
128 (let ((unread-command-events nil))
fad48aef2340 (isearch-process-search-multibyte-characters): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 22920
diff changeset
129 (isearch-process-search-string str str))
fad48aef2340 (isearch-process-search-multibyte-characters): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 22920
diff changeset
130 (isearch-update)))
22803
c52637c83ebf (isearch-minibuffer-self-insert):
Kenichi Handa <handa@m17n.org>
parents: 22780
diff changeset
131 (isearch-process-search-char last-char)))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
132
89909
68c22ea6027c Sync to HEAD
Kenichi Handa <handa@m17n.org>
parents: 88123
diff changeset
133 ;;; arch-tag: 1a90a6cf-2cb2-477a-814a-9ff895852822
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
134 ;;; isearch-x.el ends here