Go to the first, previous, next, last section, table of contents.


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. (See section `Input Methods' in The GNU Emacs Manual, 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.

Variable: 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.

Function: set-input-method input-method
This function activates input method input-method for the current buffer. It also sets default-input-method to input-method. If input-method is nil, this function 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.)

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.

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.

The fundamental interface to input methods is through the variable input-method-function. See section Reading One Event.


Go to the first, previous, next, last section, table of contents.