]> git.eshelyaron.com Git - emacs.git/commitdiff
(read-multilingual-string): Use
authorKenichi Handa <handa@m17n.org>
Tue, 21 Oct 1997 10:47:35 +0000 (10:47 +0000)
committerKenichi Handa <handa@m17n.org>
Tue, 21 Oct 1997 10:47:35 +0000 (10:47 +0000)
current-input-method prior to default-input-method.  Don't bind
current-input-method by `let', instead, activate the specified
input method in the current buffer temporarily.

lisp/international/mule-cmds.el

index af6aaf03955a2edaabdf24b4404e8b6a65208961..fa02eb71aaae5eabc1df3205fd8dd32f733041df 100644 (file)
@@ -549,8 +549,7 @@ When there's no input method to turn on, turn on what read from minibuffer."
        (ding))
     (error "No input method is activated now")))
 
-(defun read-multilingual-string (prompt &optional initial-input
-                                       input-method)
+(defun read-multilingual-string (prompt &optional initial-input input-method)
   "Read a multilingual string from minibuffer, prompting with string PROMPT.
 The input method selected last time is activated in minibuffer.
 If optional second arg INITIAL-INPUT is non-nil, insert it in the minibuffer
@@ -560,12 +559,19 @@ to be activated instead of the one selected last time.  It is a symbol
 or a string."
   (setq input-method
        (or input-method
+           current-input-method
            default-input-method
            (read-input-method-name "Input method: " nil t)))
   (if (and input-method (symbolp input-method))
       (setq input-method (symbol-name input-method)))
-  (let ((current-input-method input-method))
-    (read-string prompt initial-input nil nil t)))
+  (let ((previous-input-method current-input-method))
+    (unwind-protect
+       (progn
+         (activate-input-method input-method)
+         (read-string prompt initial-input nil nil t))
+      (if previous-input-method
+         (activate-input-method previous-input-method)
+       (inactivate-input-method)))))
 
 ;; Variables to control behavior of input methods.  All input methods
 ;; should react to these variables.