Ticket #241: isearch-fep.el

File isearch-fep.el, 1.4 kB (added by anonymous, 3 years ago)
Line 
1 ;;; isearch-fep.el for meadow3
2
3 (defvar isearch-fep-title "IME")
4
5 (defun isearch-fep ()
6   (interactive)
7   (if (not (fep-get-mode))
8       (isearch-message)
9     (let ((mw32-ime-buffer-switch-p nil)
10           (overriding-terminal-local-map nil))
11       (while (and isearch-mode (fep-get-mode))
12         (read-from-minibuffer
13          (let ((current-input-method t)
14                (current-input-method-title isearch-fep-title))
15            (concat (isearch-message-prefix) isearch-message))
16          nil '(keymap (t . exit-minibuffer)))
17         (let ((c (lookup-key isearch-mode-map (this-command-keys))))
18           (if (commandp c)
19               (call-interactively c)
20             (message "unknown key: %s" (this-command-keys))))
21         ))))
22
23 (defadvice isearch-toggle-input-method (after isearch-fep-toggle activate)
24   (isearch-fep))
25
26 (define-key isearch-mode-map [kanji]
27   (lambda () (interactive)
28     (let ((c (lookup-key global-map [kanji])))
29       (cond ((eq c 'mw32-ime-toggle)
30              (if (equal current-input-method "MW32-IME")
31                  (isearch-toggle-input-method)
32                (if current-input-method (isearch-toggle-input-method))
33                (setq input-method-history
34                      (cons "MW32-IME"
35                            (delete "MW32-IME" input-method-history)))
36                (isearch-toggle-input-method)))
37             ((eq c 'toggle-input-method)
38              (isearch-toggle-input-method))
39             (t
40              (call-interactively c)
41              (isearch-fep))))))
42
43 (add-hook 'isearch-mode-hook 'isearch-fep)
44
45 (provide 'isearch-fep)
46
47 ;;; isearch-fep.el ends here
48