diff lisp/international/mule-cmds.el @ 87098:ec0ef12211d9

Merge from emacs--rel--22 Revision: emacs@sv.gnu.org/emacs--devo--0--patch-943
author Miles Bader <miles@gnu.org>
date Thu, 06 Dec 2007 00:46:18 +0000
parents 2cce56fd7361 42b98dfc31f6
children f322e8d4c5e3 53108e6cea98
line wrap: on
line diff
--- a/lisp/international/mule-cmds.el	Thu Dec 06 00:21:00 2007 +0000
+++ b/lisp/international/mule-cmds.el	Thu Dec 06 00:46:18 2007 +0000
@@ -1492,6 +1492,9 @@
     (customize-mark-as-set 'default-input-method))
   default-input-method)
 
+(defvar toggle-input-method-active nil
+  "Non-nil inside `toggle-input-method'.")
+
 (defun toggle-input-method (&optional arg interactive)
   "Enable or disable multilingual text input method for the current buffer.
 Only one input method can be enabled at any time in a given buffer.
@@ -1511,9 +1514,12 @@
 which marks the variable `default-input-method' as set for Custom buffers."
 
   (interactive "P\np")
+  (if toggle-input-method-active
+      (error "Recursive use of `toggle-input-method'"))
   (if (and current-input-method (not arg))
       (inactivate-input-method)
-    (let ((default (or (car input-method-history) default-input-method)))
+    (let ((toggle-input-method-active t)
+	  (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)))