elisp: Input Methods
32.11 Input Methods
===================
“Input methods” provide convenient ways of entering non-ASCII characters
from the keyboard. Unlike coding systems, which translate non-ASCII
characters to and from encodings meant to be read by programs, input
methods provide human-friendly commands. ((emacs)Input Methods,
for information on how users use input methods to enter text.) How to
define input methods is not yet documented in this manual, but here we
describe how to use them.
Each input method has a name, which is currently a string; in the
future, symbols may also be usable as input method names.
-- Variable: current-input-method
This variable holds the name of the input method now active in the
current buffer. (It automatically becomes local in each buffer
when set in any fashion.) It is ‘nil’ if no input method is active
in the buffer now.
-- User Option: default-input-method
This variable holds the default input method for commands that
choose an input method. Unlike ‘current-input-method’, this
variable is normally global.
-- Command: set-input-method input-method
This command activates input method INPUT-METHOD for the current
buffer. It also sets ‘default-input-method’ to INPUT-METHOD. If
INPUT-METHOD is ‘nil’, this command deactivates any input method
for the current buffer.
-- Function: read-input-method-name prompt &optional default
inhibit-null
This function reads an input method name with the minibuffer,
prompting with PROMPT. If DEFAULT is non-‘nil’, that is returned
by default, if the user enters empty input. However, if
INHIBIT-NULL is non-‘nil’, empty input signals an error.
The returned value is a string.
-- Variable: input-method-alist
This variable defines all the supported input methods. Each
element defines one input method, and should have the form:
(INPUT-METHOD LANGUAGE-ENV ACTIVATE-FUNC
TITLE DESCRIPTION ARGS...)
Here INPUT-METHOD is the input method name, a string; LANGUAGE-ENV
is another string, the name of the language environment this input
method is recommended for. (That serves only for documentation
purposes.)
ACTIVATE-FUNC is a function to call to activate this method. The
ARGS, if any, are passed as arguments to ACTIVATE-FUNC. All told,
the arguments to ACTIVATE-FUNC are INPUT-METHOD and the ARGS.
TITLE is a string to display in the mode line while this method is
active. DESCRIPTION is a string describing this method and what it
is good for.
The fundamental interface to input methods is through the variable
DONTPRINTYET ‘input-method-function’. Reading One Event, and *noteInvoking
DONTPRINTYET ‘input-method-function’. Reading One Event, and Invoking
the Input Method.