diff options
author | Kenichi Handa <handa@m17n.org> | 2000-11-18 00:04:54 +0000 |
---|---|---|
committer | Kenichi Handa <handa@m17n.org> | 2000-11-18 00:04:54 +0000 |
commit | 5f1e183edd14b029ee81816884cac37e17d272af (patch) | |
tree | 461fdae0a0c490f1f1859acc07bd28afaea1eb20 /leim | |
parent | 3c7d764ed9e23dc7c26c6b2bd8b210455172ca95 (diff) | |
download | emacs-5f1e183edd14b029ee81816884cac37e17d272af.tar.gz |
(quail-japanese-kanji-kkc): Use marker to remember the conversion
start.
Diffstat (limited to 'leim')
-rw-r--r-- | leim/quail/japanese.el | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/leim/quail/japanese.el b/leim/quail/japanese.el index 4b04035db01..ef9de406e5e 100644 --- a/leim/quail/japanese.el +++ b/leim/quail/japanese.el @@ -79,22 +79,24 @@ ;; (Kana Kanji Converter) utility. (defun quail-japanese-kanji-kkc () (interactive) - (let ((from (overlay-start quail-conv-overlay)) - (to (overlay-end quail-conv-overlay))) + (when (= (char-before (overlay-end quail-conv-overlay)) ?n) + ;; The last char is `n'. We had better convert it to `ん' + ;; before kana-kanji conversion. + (goto-char (overlay-end quail-conv-overlay)) + (delete-char -1) + (insert ?ん)) + (let* ((from (copy-marker (overlay-start quail-conv-overlay))) + (len (- (overlay-end quail-conv-overlay) from))) (quail-delete-overlays) (setq quail-current-str nil) - (when (= (char-before to) ?n) - ;; The last char is `n'. We had better convert it to `ん' - ;; before kana-kanji conversion. - (goto-char to) - (delete-char -1) - (insert ?ん)) - (let ((result (kkc-region from to))) - (move-overlay quail-conv-overlay from (point)) - (setq quail-conversion-str (buffer-substring from (point))) - (if (= (+ from result) (point)) - (setq quail-converting nil)) - (setq quail-translating nil)))) + (unwind-protect + (let ((result (kkc-region from (+ from len)))) + (move-overlay quail-conv-overlay from (point)) + (setq quail-conversion-str (buffer-substring from (point))) + (if (= (+ from result) (point)) + (setq quail-converting nil)) + (setq quail-translating nil)) + (set-marker from nil)))) (defun quail-japanese-self-insert-and-switch-to-alpha (key idx) (quail-delete-region) |