annotate lisp/international/isearch-x.el @ 28701:de35af6ab1ad

*** empty log message ***
author Dave Love <fx@gnu.org>
date Mon, 24 Apr 2000 20:42:00 +0000
parents fad48aef2340
children 18bfc4113440
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.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
5
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
6 ;; Keywords: multilingual, isearch
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
7
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
8 ;; Author: Kenichi HANDA <handa@etl.go.jp>
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
9 ;; Maintainer: Kenichi HANDA <handa@etl.go.jp>
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
10
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
11 ;; This file is part of GNU Emacs.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
12
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
13 ;; GNU Emacs is free software; you can redistribute it and/or modify
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
14 ;; it under the terms of the GNU General Public License as published by
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
15 ;; the Free Software Foundation; either version 2, or (at your option)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
16 ;; any later version.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
17
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
18 ;; GNU Emacs is distributed in the hope that it will be useful,
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
21 ;; GNU General Public License for more details.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
22
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
23 ;; 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
24 ;; 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
25 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
26 ;; Boston, MA 02111-1307, USA.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
27
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
28 ;;; Code:
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
29
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
30 ;;;###autoload
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
31 (defun isearch-toggle-specified-input-method ()
18713
bca5a6b78f91 (isearch-input-method): New variable.
Kenichi Handa <handa@m17n.org>
parents: 18377
diff changeset
32 "Select an input method and turn it on in interactive search."
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
33 (interactive)
19407
50444ccff3f2 (isearch-input-method): Deleted.
Kenichi Handa <handa@m17n.org>
parents: 19390
diff changeset
34 (let ((overriding-terminal-local-map nil))
50444ccff3f2 (isearch-input-method): Deleted.
Kenichi Handa <handa@m17n.org>
parents: 19390
diff changeset
35 (toggle-input-method t))
22780
54069d469c31 (isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents: 19433
diff changeset
36 (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
37 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
38 (setq input-method-function nil)
19407
50444ccff3f2 (isearch-input-method): Deleted.
Kenichi Handa <handa@m17n.org>
parents: 19390
diff changeset
39 (isearch-update))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
40
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
41 ;;;###autoload
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
42 (defun isearch-toggle-input-method ()
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
43 "Toggle input method in interactive search."
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
44 (interactive)
19407
50444ccff3f2 (isearch-input-method): Deleted.
Kenichi Handa <handa@m17n.org>
parents: 19390
diff changeset
45 (let ((overriding-terminal-local-map nil))
50444ccff3f2 (isearch-input-method): Deleted.
Kenichi Handa <handa@m17n.org>
parents: 19390
diff changeset
46 (toggle-input-method))
22780
54069d469c31 (isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents: 19433
diff changeset
47 (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
48 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
49 (setq input-method-function nil)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
50 (isearch-update))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
51
22780
54069d469c31 (isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents: 19433
diff changeset
52 (defvar isearch-minibuffer-local-map
54069d469c31 (isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents: 19433
diff changeset
53 (let ((map (make-keymap)))
54069d469c31 (isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents: 19433
diff changeset
54 (define-key map [t] 'isearch-minibuffer-non-self-insert)
54069d469c31 (isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents: 19433
diff changeset
55 (let ((i ?\ ))
54069d469c31 (isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents: 19433
diff changeset
56 (while (< i 256)
54069d469c31 (isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents: 19433
diff changeset
57 (define-key map (vector i) 'isearch-minibuffer-self-insert)
54069d469c31 (isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents: 19433
diff changeset
58 (setq i (1+ i))))
54069d469c31 (isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents: 19433
diff changeset
59 (let ((l (generic-character-list))
54069d469c31 (isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents: 19433
diff changeset
60 (table (nth 1 map)))
54069d469c31 (isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents: 19433
diff changeset
61 (while l
54069d469c31 (isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents: 19433
diff changeset
62 (set-char-table-default table (car l) 'isearch-minibuffer-self-insert)
54069d469c31 (isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents: 19433
diff changeset
63 (setq l (cdr l))))
54069d469c31 (isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents: 19433
diff changeset
64 (define-key map "\C-m" 'exit-minibuffer)
54069d469c31 (isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents: 19433
diff changeset
65 (define-key map [return] 'exit-minibuffer)
22920
f80a1ca0112f (isearch-minibuffer-local-map): Bind
Kenichi Handa <handa@m17n.org>
parents: 22803
diff changeset
66 (define-key map "\C-g" 'exit-minibuffer)
22780
54069d469c31 (isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents: 19433
diff changeset
67 map)
54069d469c31 (isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents: 19433
diff changeset
68 "Keymap of minibuffer to input multibyte characters while isearching.")
54069d469c31 (isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents: 19433
diff changeset
69
54069d469c31 (isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents: 19433
diff changeset
70 (defun isearch-minibuffer-non-self-insert ()
54069d469c31 (isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents: 19433
diff changeset
71 (interactive)
54069d469c31 (isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents: 19433
diff changeset
72 (setq unread-command-events (cons last-command-event unread-command-events))
54069d469c31 (isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents: 19433
diff changeset
73 (exit-minibuffer))
54069d469c31 (isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents: 19433
diff changeset
74
54069d469c31 (isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents: 19433
diff changeset
75 (defun isearch-minibuffer-self-insert ()
54069d469c31 (isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents: 19433
diff changeset
76 (interactive)
22803
c52637c83ebf (isearch-minibuffer-self-insert):
Kenichi Handa <handa@m17n.org>
parents: 22780
diff changeset
77 (let ((events (cons last-command-event unread-post-input-method-events)))
c52637c83ebf (isearch-minibuffer-self-insert):
Kenichi Handa <handa@m17n.org>
parents: 22780
diff changeset
78 (catch 'isearch-tag
c52637c83ebf (isearch-minibuffer-self-insert):
Kenichi Handa <handa@m17n.org>
parents: 22780
diff changeset
79 (while events
c52637c83ebf (isearch-minibuffer-self-insert):
Kenichi Handa <handa@m17n.org>
parents: 22780
diff changeset
80 (let* ((event (car events))
22920
f80a1ca0112f (isearch-minibuffer-local-map): Bind
Kenichi Handa <handa@m17n.org>
parents: 22803
diff changeset
81 (cmd (key-binding (vector event))))
f80a1ca0112f (isearch-minibuffer-local-map): Bind
Kenichi Handa <handa@m17n.org>
parents: 22803
diff changeset
82 (cond ((or (eq cmd 'isearch-printing-char)
f80a1ca0112f (isearch-minibuffer-local-map): Bind
Kenichi Handa <handa@m17n.org>
parents: 22803
diff changeset
83 (eq cmd 'isearch-minibuffer-self-insert))
22803
c52637c83ebf (isearch-minibuffer-self-insert):
Kenichi Handa <handa@m17n.org>
parents: 22780
diff changeset
84 (insert event)
c52637c83ebf (isearch-minibuffer-self-insert):
Kenichi Handa <handa@m17n.org>
parents: 22780
diff changeset
85 (setq events (cdr events)))
c52637c83ebf (isearch-minibuffer-self-insert):
Kenichi Handa <handa@m17n.org>
parents: 22780
diff changeset
86 ((eq cmd 'exit-minibuffer)
c52637c83ebf (isearch-minibuffer-self-insert):
Kenichi Handa <handa@m17n.org>
parents: 22780
diff changeset
87 (setq events (cdr events))
c52637c83ebf (isearch-minibuffer-self-insert):
Kenichi Handa <handa@m17n.org>
parents: 22780
diff changeset
88 (throw 'isearch-tag nil))
c52637c83ebf (isearch-minibuffer-self-insert):
Kenichi Handa <handa@m17n.org>
parents: 22780
diff changeset
89 (t
c52637c83ebf (isearch-minibuffer-self-insert):
Kenichi Handa <handa@m17n.org>
parents: 22780
diff changeset
90 (throw 'isearch-tag nil))))))
c52637c83ebf (isearch-minibuffer-self-insert):
Kenichi Handa <handa@m17n.org>
parents: 22780
diff changeset
91 (setq unread-post-input-method-events events)
22920
f80a1ca0112f (isearch-minibuffer-local-map): Bind
Kenichi Handa <handa@m17n.org>
parents: 22803
diff changeset
92 (exit-minibuffer)))
22780
54069d469c31 (isearch-toggle-specified-input-method): Adjusted for the change
Kenichi Handa <handa@m17n.org>
parents: 19433
diff changeset
93
19407
50444ccff3f2 (isearch-input-method): Deleted.
Kenichi Handa <handa@m17n.org>
parents: 19390
diff changeset
94 ;;;###autoload
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
95 (defun isearch-process-search-multibyte-characters (last-char)
22803
c52637c83ebf (isearch-minibuffer-self-insert):
Kenichi Handa <handa@m17n.org>
parents: 22780
diff changeset
96 (if (eq this-command 'isearch-printing-char)
c52637c83ebf (isearch-minibuffer-self-insert):
Kenichi Handa <handa@m17n.org>
parents: 22780
diff changeset
97 (let ((overriding-terminal-local-map nil)
c52637c83ebf (isearch-minibuffer-self-insert):
Kenichi Handa <handa@m17n.org>
parents: 22780
diff changeset
98 ;; Let input method work rather tersely.
c52637c83ebf (isearch-minibuffer-self-insert):
Kenichi Handa <handa@m17n.org>
parents: 22780
diff changeset
99 (input-method-verbose-flag nil)
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)
22920
f80a1ca0112f (isearch-minibuffer-local-map): Bind
Kenichi Handa <handa@m17n.org>
parents: 22803
diff changeset
102 (setq unread-command-events
f80a1ca0112f (isearch-minibuffer-local-map): Bind
Kenichi Handa <handa@m17n.org>
parents: 22803
diff changeset
103 (cons last-char unread-command-events))
22803
c52637c83ebf (isearch-minibuffer-self-insert):
Kenichi Handa <handa@m17n.org>
parents: 22780
diff changeset
104 (setq str (read-multilingual-string
c52637c83ebf (isearch-minibuffer-self-insert):
Kenichi Handa <handa@m17n.org>
parents: 22780
diff changeset
105 (concat (isearch-message-prefix) isearch-message)
c52637c83ebf (isearch-minibuffer-self-insert):
Kenichi Handa <handa@m17n.org>
parents: 22780
diff changeset
106 nil
c52637c83ebf (isearch-minibuffer-self-insert):
Kenichi Handa <handa@m17n.org>
parents: 22780
diff changeset
107 current-input-method))
c52637c83ebf (isearch-minibuffer-self-insert):
Kenichi Handa <handa@m17n.org>
parents: 22780
diff changeset
108 (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
109 (let ((unread-command-events nil))
fad48aef2340 (isearch-process-search-multibyte-characters): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 22920
diff changeset
110 (isearch-process-search-string str str))
fad48aef2340 (isearch-process-search-multibyte-characters): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents: 22920
diff changeset
111 (isearch-update)))
22803
c52637c83ebf (isearch-minibuffer-self-insert):
Kenichi Handa <handa@m17n.org>
parents: 22780
diff changeset
112 (isearch-process-search-char last-char)))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
113
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
114 ;;; isearch-x.el ends here