]> git.eshelyaron.com Git - emacs.git/commitdiff
(quail-japanese-use-double-n): New variable.
authorKenichi Handa <handa@m17n.org>
Thu, 6 Aug 1998 05:38:11 +0000 (05:38 +0000)
committerKenichi Handa <handa@m17n.org>
Thu, 6 Aug 1998 05:38:11 +0000 (05:38 +0000)
(quail-japanese-update-translation): Adjusted for the change of
quail-update-translation.  Now this function should return
CONTROL-FLAG.
(quail-japanese-toggle-kana): Update quail-conversion-str.
(quail-japanese-kanji-kkc): Likewise.
(quail-japanese-switch-package): Reset quail-current-str and
quail-conversion-str.

leim/quail/japanese.el

index 01c36fbc4ed2e3510512b2e9a5fd6406ce485bb9..d0faf534a83c39994860f323b9b7c9ee7fee5b5b 100644 (file)
 (require 'quail)
 (require 'kkc)
 
+(defvar quail-japanese-use-double-n nil
+  "If non-nil, use type \"nn\" to insert \e$B$s\e(B.")
+
 ;; Update Quail translation region while considering Japanese bizarre
 ;; translation rules.
 (defun quail-japanese-update-translation (control-flag)
-  (cond ((eq control-flag t)
-        (insert quail-current-str)
-        (quail-terminate-translation))
-       ((null control-flag)
-        (if (/= (aref quail-current-key 0) ?q)
-            (insert (or quail-current-str quail-current-key))))
-       ((= control-flag 0)
-        (insert (aref quail-current-key 0))
-        (quail-terminate-translation))
-       (t
-        (cond ((= (aref quail-current-key 0) ?n)
-               (insert ?\e$B$s\e(B))
-              ((= (aref quail-current-key 0) (aref quail-current-key 1))
-               (insert ?\e$B$C\e(B))
-              (t
-               (insert (aref quail-current-key 0))))
-        (setq unread-command-events
-              (list (aref quail-current-key control-flag)))
-        (quail-terminate-translation))))
+  (if (null control-flag)
+      (setq quail-current-str
+           (if (/= (aref quail-current-key 0) ?q)
+               (or quail-current-str quail-current-key)
+             ""))
+    (if (integerp control-flag)
+       (if (= control-flag 0)
+           (setq quail-current-str (aref quail-current-key 0))
+         (cond ((= (aref quail-current-key 0) ?n)
+                (setq quail-current-str ?\e$B$s\e(B)
+                (if (and quail-japanese-use-double-n
+                         (= (aref quail-current-key 1) ?n))
+                    (setq control-flag t)))
+               ((= (aref quail-current-key 0) (aref quail-current-key 1))
+                (setq quail-current-str ?\e$B$C\e(B))
+               (t
+                (setq quail-current-str (aref quail-current-key 0))))
+         (if (integerp control-flag)
+             (setq unread-command-events
+                   (list (aref quail-current-key control-flag)))))))
+  control-flag)
         
 ;; Flag to control the behavior of `quail-japanese-toggle-kana'.
 (defvar quail-japanese-kana-state nil)
              (not quail-japanese-kana-state)))
     (if quail-japanese-kana-state
        (japanese-hiragana-region start end)
-      (japanese-katakana-region start end))))
+      (japanese-katakana-region start end))
+    (setq quail-conversion-str
+         (buffer-substring (overlay-start quail-conv-overlay)
+                           (overlay-end quail-conv-overlay)))))
 
 ;; Convert Hiragana in the current translation region to Kanji by KKC
 ;; (Kana Kanji Converter) utility.
@@ -77,6 +85,7 @@
     (quail-delete-overlays)
     (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))))
 
 (defun quail-japanese-switch-package (key idx)
   (quail-delete-region)
-  (setq quail-converting nil)
+  (setq quail-current-str nil
+       quail-converting nil
+       quail-conversion-str "")
   (let ((pkg (cdr (assq (aref key (1- idx)) quail-japanese-switch-table))))
     (if (null pkg)
        (quail-error "No package to be switched")