diff options
| author | Kenichi Handa | 1997-08-18 10:54:31 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1997-08-18 10:54:31 +0000 |
| commit | afc53a91e468f02b1b9bcd6bb5749fe75c96363b (patch) | |
| tree | b3fcf6055b7ef79706ee69647df67501b54f965f | |
| parent | 60071afc7effd8c51f457b5bf165d6668fce7fe8 (diff) | |
| download | emacs-afc53a91e468f02b1b9bcd6bb5749fe75c96363b.tar.gz emacs-afc53a91e468f02b1b9bcd6bb5749fe75c96363b.zip | |
(quail-japanese-toggle-kana): Don't call
throw.
(quail-japanese-kanji-kkc): Completely re-written.
(quail-japanese-kkc-mode-exit): New function.
(quail-japanese-switch-package): Call activate-input-method
instead of select-input-metho.
| -rw-r--r-- | leim/quail/japanese.el | 73 |
1 files changed, 30 insertions, 43 deletions
diff --git a/leim/quail/japanese.el b/leim/quail/japanese.el index 793cc7e7136..86219e1b62d 100644 --- a/leim/quail/japanese.el +++ b/leim/quail/japanese.el | |||
| @@ -27,8 +27,8 @@ | |||
| 27 | (require 'quail) | 27 | (require 'quail) |
| 28 | (require 'kkc) | 28 | (require 'kkc) |
| 29 | 29 | ||
| 30 | ;; Update Quail translation region for Japanese bizarre translation | 30 | ;; Update Quail translation region while considering Japanese bizarre |
| 31 | ;; rules. | 31 | ;; translation rules. |
| 32 | (defun quail-japanese-update-translation (control-flag) | 32 | (defun quail-japanese-update-translation (control-flag) |
| 33 | (cond ((eq control-flag t) | 33 | (cond ((eq control-flag t) |
| 34 | (insert quail-current-str) | 34 | (insert quail-current-str) |
| @@ -54,48 +54,34 @@ | |||
| 54 | ;; Convert Hiragana <-> Katakana in the current translation region. | 54 | ;; Convert Hiragana <-> Katakana in the current translation region. |
| 55 | (defun quail-japanese-toggle-kana () | 55 | (defun quail-japanese-toggle-kana () |
| 56 | (interactive) | 56 | (interactive) |
| 57 | (if (quail-point-in-conversion-region) | 57 | (let ((start (overlay-start quail-conv-overlay)) |
| 58 | (let ((start (overlay-start quail-conv-overlay)) | 58 | (end (overlay-end quail-conv-overlay))) |
| 59 | (end (overlay-end quail-conv-overlay))) | 59 | (setq quail-japanese-kana-state |
| 60 | (setq quail-japanese-kana-state | 60 | (if (eq last-command this-command) |
| 61 | (if (eq last-command this-command) | 61 | (not quail-japanese-kana-state))) |
| 62 | (not quail-japanese-kana-state))) | 62 | (if quail-japanese-kana-state |
| 63 | (if quail-japanese-kana-state | 63 | (japanese-hiragana-region start end) |
| 64 | (japanese-hiragana-region start end) | 64 | (japanese-katakana-region start end)) |
| 65 | (japanese-katakana-region start end)) | 65 | (goto-char (overlay-end quail-conv-overlay)))) |
| 66 | (goto-char (overlay-end quail-conv-overlay)) | ||
| 67 | (setq quail-exit-conversion-mode t)) | ||
| 68 | ;; When this command is invoked, the point is not in a valid | ||
| 69 | ;; region. Try the event which invoked this command again out of | ||
| 70 | ;; conversion mode. | ||
| 71 | (setq unread-command-events (list last-command-event)) | ||
| 72 | (throw 'exit nil))) | ||
| 73 | 66 | ||
| 74 | ;; Convert Hiragana in the current translation region to Kanji by KKC | 67 | ;; Convert Hiragana in the current translation region to Kanji by KKC |
| 75 | ;; (Kana Kanji Converter) utility. | 68 | ;; (Kana Kanji Converter) utility. |
| 76 | (defun quail-japanese-kanji-kkc () | 69 | (defun quail-japanese-kanji-kkc () |
| 77 | (interactive) | 70 | (interactive) |
| 78 | (if (quail-point-in-conversion-region) | 71 | (let ((from (overlay-start quail-conv-overlay)) |
| 79 | (let ((from (overlay-start quail-conv-overlay)) | 72 | (to (overlay-end quail-conv-overlay)) |
| 80 | (to (overlay-end quail-conv-overlay)) | 73 | newfrom) |
| 81 | newfrom) | 74 | (quail-delete-overlays) |
| 82 | (delete-overlay quail-overlay) | 75 | (setq overriding-terminal-local-map nil) |
| 83 | (delete-overlay quail-conv-overlay) | 76 | (kkc-region from to 'quail-japanese-kkc-mode-exit))) |
| 84 | (unwind-protect | 77 | |
| 85 | (setq newfrom (kkc-region from to)) | 78 | ;; Function to call on exiting KKC mode. ARG is nil if KKC mode is |
| 86 | ;; Activate the original (or shrinked) conversion region | 79 | ;; exited normally, else ARG is a cons (FROM . TO) where FROM and TO |
| 87 | ;; again. | 80 | ;; specify a region not yet processed. |
| 88 | (if newfrom | 81 | (defun quail-japanese-kkc-mode-exit (arg) |
| 89 | ;; `kkc-region' is canceled. | 82 | (setq overriding-terminal-local-map (quail-conversion-keymap)) |
| 90 | (move-overlay quail-conv-overlay newfrom (point)) | 83 | (if arg |
| 91 | ;; `kkc-region' is terminated normally. | 84 | (move-overlay quail-conv-overlay (car arg) (cdr arg)))) |
| 92 | (move-overlay quail-conv-overlay from (point)) | ||
| 93 | (throw 'exit nil)))) | ||
| 94 | ;; When this command is invoked, the point is not in a valid | ||
| 95 | ;; region. Try the event which invoked this command again out of | ||
| 96 | ;; conversion mode. | ||
| 97 | (setq unread-command-events (list last-command-event)) | ||
| 98 | (throw 'exit nil))) | ||
| 99 | 85 | ||
| 100 | (defun quail-japanese-self-insert-and-switch-to-alpha (key idx) | 86 | (defun quail-japanese-self-insert-and-switch-to-alpha (key idx) |
| 101 | (quail-delete-region) | 87 | (quail-delete-region) |
| @@ -116,15 +102,16 @@ | |||
| 116 | (let ((pkg (cdr (assq (aref key (1- idx)) quail-japanese-switch-table)))) | 102 | (let ((pkg (cdr (assq (aref key (1- idx)) quail-japanese-switch-table)))) |
| 117 | (if (null pkg) | 103 | (if (null pkg) |
| 118 | (error "No package to be switched") | 104 | (error "No package to be switched") |
| 105 | (setq overriding-terminal-local-map nil) | ||
| 119 | (quail-delete-region) | 106 | (quail-delete-region) |
| 120 | (if (stringp pkg) | 107 | (if (stringp pkg) |
| 121 | (select-input-method pkg) | 108 | (activate-input-method pkg) |
| 122 | (if (string= (car pkg) current-input-method) | 109 | (if (string= (car pkg) current-input-method) |
| 123 | (if quail-japanese-package-saved | 110 | (if quail-japanese-package-saved |
| 124 | (select-input-method quail-japanese-package-saved)) | 111 | (activate-input-method quail-japanese-package-saved)) |
| 125 | (setq quail-japanese-package-saved current-input-method) | 112 | (setq quail-japanese-package-saved current-input-method) |
| 126 | (select-input-method (car pkg)))) | 113 | (activate-input-method (car pkg)))))) |
| 127 | (throw 'quail-tag nil)))) | 114 | (throw 'quail-tag nil)) |
| 128 | 115 | ||
| 129 | (quail-define-package | 116 | (quail-define-package |
| 130 | "japanese" "Japanese" "Aあ" | 117 | "japanese" "Japanese" "Aあ" |