Commit | Line | Data |
---|---|---|
4ed46869 KH |
1 | ;;; isearch-x.el --- extended isearch handling commands |
2 | ||
4ed46869 | 3 | ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN. |
fa526c4a | 4 | ;; Licensed to the Free Software Foundation. |
4ed46869 KH |
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 | |
369314dc KH |
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. | |
4ed46869 KH |
27 | |
28 | ;;; Code: | |
29 | ||
e81ed9ed KH |
30 | ;;;###autoload |
31 | (defvar isearch-input-method nil | |
32 | "Input method activated in interactive search.") | |
33 | ||
34 | (defvar isearch-input-method-title nil | |
35 | "Title string of input method activated in interactive search.") | |
36 | ||
4ed46869 KH |
37 | ;;;###autoload |
38 | (defun isearch-toggle-specified-input-method () | |
e81ed9ed | 39 | "Select an input method and turn it on in interactive search." |
4ed46869 | 40 | (interactive) |
e81ed9ed KH |
41 | (setq isearch-input-method nil) |
42 | (let ((default-input-method nil)) | |
43 | (isearch-toggle-input-method))) | |
4ed46869 KH |
44 | |
45 | ;;;###autoload | |
46 | (defun isearch-toggle-input-method () | |
47 | "Toggle input method in interactive search." | |
48 | (interactive) | |
e81ed9ed KH |
49 | (if isearch-input-method |
50 | (setq isearch-input-method nil) | |
51 | (setq isearch-input-method | |
52 | (or default-input-method | |
4ed46869 | 53 | (let ((overriding-terminal-local-map nil)) |
e81ed9ed KH |
54 | (read-input-method-name "Input method: ")))) |
55 | (if isearch-input-method | |
56 | (setq isearch-input-method-title | |
57 | (nth 3 (assoc isearch-input-method input-method-alist))) | |
58 | (ding))) | |
4ed46869 KH |
59 | (isearch-update)) |
60 | ||
61 | (defun isearch-input-method-after-insert-chunk-function () | |
62 | (funcall inactivate-current-input-method-function)) | |
63 | ||
64 | (defun isearch-process-search-multibyte-characters (last-char) | |
e81ed9ed KH |
65 | (let ((overriding-terminal-local-map nil) |
66 | ;; Let input method exit when a chunk is inserted. | |
67 | (input-method-after-insert-chunk-hook | |
68 | '(isearch-input-method-after-insert-chunk-function)) | |
69 | (input-method-inactivate-hook '(exit-minibuffer)) | |
70 | ;; Let input method work rather tersely. | |
8dc586a7 | 71 | (input-method-verbose-flag nil) |
e81ed9ed | 72 | str) |
4ed46869 | 73 | (setq unread-command-events (cons last-char unread-command-events)) |
e81ed9ed KH |
74 | (setq str (read-multilingual-string |
75 | (concat (isearch-message-prefix) isearch-message) | |
76 | nil | |
77 | isearch-input-method)) | |
4ed46869 KH |
78 | (isearch-process-search-string str str))) |
79 | ||
80 | ;;; isearch-x.el ends here |