changeset 21983:487cd71c058d

(toggle-input-method): Use a more appropriate default value while reading an input method.
author Richard M. Stallman <rms@gnu.org>
date Thu, 07 May 1998 20:50:48 +0000
parents 456f95c03285
children 7daf32aabd53
files lisp/international/mule-cmds.el
diffstat 1 files changed, 17 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/international/mule-cmds.el	Thu May 07 20:48:17 1998 +0000
+++ b/lisp/international/mule-cmds.el	Thu May 07 20:50:48 1998 +0000
@@ -687,22 +687,29 @@
 (defun toggle-input-method (&optional arg)
   "Turn on or off a multilingual text input method for the current buffer.
 
-With arg, read an input method from minibuffer and turn it on.
+With no prefix argument, if some input method is currently activated,
+turn it off.  Otherwise, activate an input method--the one most recently used,
+or the one specified in `default-input-method', or one read from the
+minibuffer.
 
-Without arg, if some input method is currently activated, turn it off,
-else turn on an input method selected last time
-or the default input method (see `default-input-method').
+With a prefix arg, read an input method from minibuffer and turn it on.
+The default is the most recent input method specified
+\(not including the currently active input method, if any).
 
 When there's no input method to turn on, turn on what read from minibuffer."
   (interactive "P")
-  (let* ((default (or (car input-method-history) default-input-method)))
-    (if (and current-input-method (not arg))
-	(inactivate-input-method)
+  (if (and current-input-method (not arg))
+      (inactivate-input-method)
+    (let ((default (or (car input-method-history) default-input-method)))
+      (if (and arg default (equal current-input-method default)
+	       (> (length input-method-history) 1))
+	  (setq default (nth 1 input-method-history)))
       (activate-input-method
        (if (or arg (not default))
-	   (read-input-method-name
-	    (if default "Input method (default %s): " "Input method: " )
-	    default t)  
+	   (progn
+	     (read-input-method-name
+	      (if default "Input method (default %s): " "Input method: " )
+	      default t))
 	 default))
       (or default-input-method
 	  (setq default-input-method current-input-method)))))