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 | ||
30 | ;;;###autoload | |
31 | (defun isearch-toggle-specified-input-method () | |
32 | "Select and toggle specified input method in interactive search." | |
33 | (interactive) | |
34 | ;; Let the command `toggle-input-method' ask users to select input | |
35 | ;; method interactively. | |
36 | (setq default-input-method nil) | |
37 | (isearch-toggle-input-method)) | |
38 | ||
39 | ;;;###autoload | |
40 | (defun isearch-toggle-input-method () | |
41 | "Toggle input method in interactive search." | |
42 | (interactive) | |
43 | (if isearch-multibyte-characters-flag | |
44 | (setq isearch-multibyte-characters-flag nil) | |
45 | (condition-case nil | |
46 | (progn | |
47 | (if (null default-input-method) | |
48 | (let ((overriding-terminal-local-map nil)) | |
49 | ;; No input method has ever been selected. Select one | |
50 | ;; interactively now. This also sets | |
51 | ;; `default-input-method-title' to the title of the | |
52 | ;; selected input method. | |
53 | (toggle-input-method) | |
54 | ;; And, inactivate it for the moment. | |
55 | (toggle-input-method))) | |
56 | (setq isearch-multibyte-characters-flag t)) | |
57 | (error (ding)))) | |
58 | (isearch-update)) | |
59 | ||
60 | (defun isearch-input-method-after-insert-chunk-function () | |
61 | (funcall inactivate-current-input-method-function)) | |
62 | ||
63 | (defun isearch-process-search-multibyte-characters (last-char) | |
64 | (let* ((overriding-terminal-local-map nil) | |
65 | ;; Let input method exit when a chunk is inserted. | |
66 | (input-method-after-insert-chunk-hook | |
67 | '(isearch-input-method-after-insert-chunk-function)) | |
68 | (input-method-inactivate-hook '(exit-minibuffer)) | |
69 | ;; Let input method work rather tersely. | |
70 | (input-method-tersely-flag t) | |
71 | str) | |
72 | (setq unread-command-events (cons last-char unread-command-events)) | |
73 | (setq str (read-multilingual-string (concat (isearch-message-prefix) | |
74 | isearch-message))) | |
75 | (isearch-process-search-string str str))) | |
76 | ||
77 | ;;; isearch-x.el ends here |