changeset 23049:82a27d5b4582

(activate-input-method): Handle the case that the arg INPUT-METHOD is nil correctly. (read-multilingual-string): Activate the specified input method before calling read-string. Afterward, activate the original input method.
author Kenichi Handa <handa@m17n.org>
date Tue, 18 Aug 1998 00:44:20 +0000
parents fd2d1a752d93
children c3cb64f8dc9c
files lisp/international/mule-cmds.el
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/international/mule-cmds.el	Tue Aug 18 00:43:52 1998 +0000
+++ b/lisp/international/mule-cmds.el	Tue Aug 18 00:44:20 1998 +0000
@@ -786,11 +786,11 @@
   "Switch to input method INPUT-METHOD for the current buffer.
 If some other input method is already active, turn it off first.
 If INPUT-METHOD is nil, deactivate any current input method."
-  (if (symbolp input-method)
+  (if (and input-method (symbolp input-method))
       (setq input-method (symbol-name input-method)))
   (if (and current-input-method
 	   (not (string= current-input-method input-method)))
-    (inactivate-input-method))
+      (inactivate-input-method))
   (unless (or current-input-method (null input-method))
     (let ((slot (assoc input-method input-method-alist)))
       (if (null slot)
@@ -907,8 +907,12 @@
 	    (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 ((prev-input-method current-input-method))
+    (unwind-protect
+	(progn
+	  (activate-input-method input-method)
+	  (read-string prompt initial-input nil nil t))
+      (activate-input-method prev-input-method))))
 
 ;; Variables to control behavior of input methods.  All input methods
 ;; should react to these variables.