An input method is a kind of character conversion designed specifically for interactive input. In Emacs, typically each language has its own input method; sometimes several languages that use the same characters can share one input method. A few languages support several input methods.
The simplest kind of input method works by mapping ASCII letters into another alphabet; this allows you to use one other alphabet instead of ASCII. The Greek and Russian input methods work this way.
A more powerful technique is composition: converting sequences of characters into one letter. Many European input methods use composition to produce a single non-ASCII letter from a sequence that consists of a letter followed by accent characters (or vice versa). For example, some methods convert the sequence o ^ into a single accented letter. These input methods have no special commands of their own; all they do is compose sequences of printing characters.
The input methods for syllabic scripts typically use mapping followed by composition. The input methods for Thai and Korean work this way. First, letters are mapped into symbols for particular sounds or tone marks; then, sequences of these that make up a whole syllable are mapped into one syllable sign.
Chinese and Japanese require more complex methods. In Chinese input
methods, first you enter the phonetic spelling of a Chinese word (in
chinese-py, among others), or a sequence of
portions of the character (input methods
chinese-sw, and others). One input sequence typically
corresponds to many possible Chinese characters. You select the one
you mean using keys such as C-f, C-b, C-n,
C-p (or the arrow keys), and digits, which have special meanings
in this situation.
The possible characters are conceptually arranged in several rows,
with each row holding up to 10 alternatives. Normally, Emacs displays
just one row at a time, in the echo area;
appears at the beginning, to indicate that this is the ith row
out of a total of j rows. Type C-n or C-p to
display the next row or the previous row.
Type C-f and C-b to move forward and backward among the alternatives in the current row. As you do this, Emacs highlights the current alternative with a special color; type C-<SPC> to select the current alternative and use it as input. The alternatives in the row are also numbered; the number appears before the alternative. Typing a number selects the associated alternative of the current row and uses it as input.
<TAB> in these Chinese input methods displays a buffer showing all the possible characters at once; then clicking mouse-2 on one of them selects that alternative. The keys C-f, C-b, C-n, C-p, and digits continue to work as usual, but they do the highlighting in the buffer showing the possible characters, rather than in the echo area.
In Japanese input methods, first you input a whole word using phonetic spelling; then, after the word is in the buffer, Emacs converts it into one or more characters using a large dictionary. One phonetic spelling corresponds to a number of different Japanese words; to select one of them, use C-n and C-p to cycle through the alternatives.
Sometimes it is useful to cut off input method processing so that the
characters you have just entered will not combine with subsequent
characters. For example, in input method
sequence o ^ combines to form an ‘o’ with an accent. What if
you want to enter them as separate characters?
One way is to type the accent twice; this is a special feature for
entering the separate letter and accent. For example, o ^ ^ gives
you the two characters ‘o^’. Another way is to type another letter
after the o—something that won't combine with that—and
immediately delete it. For example, you could type o o <DEL>
^ to get separate ‘o’ and ‘^’. Another method, more
general but not quite as easy to type, is to use C-\ C-\ between
two characters to stop them from combining. This is the command
toggle-input-method) used twice.
See Select Input Method.
C-\ C-\ is especially useful inside an incremental search, because it stops waiting for more characters to combine, and starts searching for what you have already entered.
To find out how to input the character after point using the current input method, type C-u C-x =. See Position Info.
input-method-verbose-flag control how input methods explain
what is happening. If
nil, the partial sequence is highlighted in the buffer (for
most input methods—some disable this feature). If
input-method-verbose-flag is non-
nil, the list of
possible characters to type next is displayed in the echo area (but
not when you are in the minibuffer).
You can modify how an input method works by making your changes in a
function that you add to the hook variable
See Hooks. For example, you can redefine some of the input
method's keys by defining key bindings in the keymap returned by the
See Init Rebinding.
Another facility for typing characters not on your keyboard is by
using C-x 8 <RET> (
insert-char) to insert a single
character based on its Unicode name or code-point; see Inserting Text.