From: Richard M. Stallman Date: Thu, 29 Nov 2007 22:35:11 +0000 (+0000) Subject: (toggle-input-method-active): New var. X-Git-Tag: emacs-pretest-22.1.90~307 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=023df4cfe39ec4ee699e882c3a2219ce9da5807d;p=emacs.git (toggle-input-method-active): New var. (toggle-input-method): Bind toggle-input-method-active to t. Error if it was already non-nil. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3576d72bf1a..e94db35386c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2007-11-29 Richard Stallman + + * international/mule-cmds.el (toggle-input-method-active): New var. + (toggle-input-method): Bind toggle-input-method-active to t. + Error if it was already non-nil. + 2007-11-29 Glenn Morris * calendar/time-date.el (with-decoded-time-value): Doc fix. diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index 6dd1bf07213..19663f594b9 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el @@ -1492,6 +1492,9 @@ To deactivate it programmatically, use `inactivate-input-method'." (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 @@ When called interactively, the optional arg INTERACTIVE is non-nil, 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)))