Sync up with egg-980712.
[elisp/egg.git] / egg-mlh.el
index a520acf..e3f8297 100644 (file)
@@ -10,7 +10,7 @@
 ;; Maintainer: NIIBE Yutaka <gniibe@mri.co.jp>
 ;; Keywords: mule, multilingual, input method
 
-;; This file will be part of GNU Emacs (in future).
+;; This file is part of EGG.
 
 ;; EGG is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
@@ -33,6 +33,8 @@
 
 ;;; Code:
 
+(defvar mlh-default-backend "wnn")
+
 (defun mlh-space-bar-backward-henkan ()
   "If the character preceding point is / (slash),
 Do `mlh-backward-henkan'.  Then, invoke appropriate conversion, if needed.
@@ -41,16 +43,17 @@ Or else, execute command that space-bar invokes usually."
   (let ((henkan-begin nil)
         (inhibit-henkan t)
         (its-disable-special-action t))
-    (its-select-hiragana)    ;; force to Japanese
+    (if (null egg-conversion-backend)
+       (progn
+          (setq egg-mode-preference nil)
+          (activate-input-method (concat "japanese-egg-" mlh-default-backend)))
+      ;; force to Japanese
+      (its-select-hiragana))
     (mlh-backward-henkan)
     (if henkan-begin
         (if (or inhibit-henkan (= henkan-begin (point)))
             (egg-do-auto-fill)
-          (progn
-            (message "Converting...")
-            (sit-for 0)
-           (egg-convert-region henkan-begin (point))
-            (message "") ))
+         (egg-convert-region henkan-begin (point)))
       (setq this-command 'self-insert-command)
       (call-interactively 'self-insert-command))))
 
@@ -481,10 +484,7 @@ CHAR.  MNEMONIC             CONVERSION SCHEME
   (goto-char end-marker)
   (forward-char -2)
   (its-translate-region-internal beg (point))
-  (insert (mlh-hira-to-kata
-          (prog1
-              (buffer-substring beg (point))
-            (delete-region beg (point)))))
+  (japanese-katakana-region beg (point))
   (delete-region (point) end-marker)
   (if (null henkan-begin)
       (setq henkan-begin beg)))
@@ -500,15 +500,6 @@ CHAR.  MNEMONIC             CONVERSION SCHEME
   (if (null henkan-begin)
       (setq henkan-begin beg)))
 
-(defun mlh-hira-to-kata (str)
-  "Convert hiragana to katakana in STR."
-  (let ((result (copy-sequence str))
-        (i 0))
-    (while (setq i (string-match "[\e$B$!\e(B-\e$B$s\e(B]" str i))
-      (aset result (1+ i) ?\245)
-      (setq i (+ i 3)))
-    result))
-
 (defun mlh-hangul ()
   (forward-char -1)
   (skip-chars-backward "a-zEO-RTW,.[]")