Function: toggle-input-method
toggle-input-method is an interactive and byte-compiled function
defined in mule-cmds.el.gz.
Signature
(toggle-input-method &optional ARG INTERACTIVE)
Documentation
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.
The normal action is to enable an input method if none was enabled,
and disable the current one otherwise. Which input method to enable
can be determined in various ways--either the one most recently used,
or the one specified by default-input-method, or as a last resort
by reading the name of an input method in the minibuffer.
With a prefix argument ARG, read an input method name with the minibuffer
and enable that one. The default is the most recent input method specified
(not including the currently active input method, if any).
When called interactively, the optional argument INTERACTIVE is non-nil,
which marks the variable default-input-method as set for Custom buffers.
Probably introduced at or before Emacs version 20.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/international/mule-cmds.el.gz
(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.
The normal action is to enable an input method if none was enabled,
and disable the current one otherwise. Which input method to enable
can be determined in various ways--either the one most recently used,
or the one specified by `default-input-method', or as a last resort
by reading the name of an input method in the minibuffer.
With a prefix argument ARG, read an input method name with the minibuffer
and enable that one. The default is the most recent input method specified
\(not including the currently active input method, if any).
When called interactively, the optional argument 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))
(if current-transient-input-method
(deactivate-transient-input-method)
(deactivate-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)))
(activate-input-method
(if (or arg (not default))
(progn
(read-input-method-name
(format-prompt "Input method" default)
default t))
default))
(unless default-input-method
(prog1
(setq default-input-method current-input-method)
(when interactive
(customize-mark-as-set 'default-input-method)))))))