Next: , Previous: Input Methods, Up: International

22.5 Selecting an Input Method

C-\
Enable or disable use of the selected input method (toggle-input-method).
C-x <RET> C-\ method <RET>
Select a new input method for the current buffer (set-input-method).
C-h I method <RET>
C-h C-\ method <RET>
Describe the input method method (describe-input-method). By default, it describes the current input method (if any). This description should give you the full details of how to use any particular input method.
M-x list-input-methods
Display a list of all the supported input methods.

To choose an input method for the current buffer, use C-x <RET> C-\ (set-input-method). This command reads the input method name from the minibuffer; the name normally starts with the language environment that it is meant to be used with. The variable current-input-method records which input method is selected.

Input methods use various sequences of ASCII characters to stand for non-ASCII characters. Sometimes it is useful to turn off the input method temporarily. To do this, type C-\ (toggle-input-method). To reenable the input method, type C-\ again.

If you type C-\ and you have not yet selected an input method, it prompts you to specify one. This has the same effect as using C-x <RET> C-\ to specify an input method.

When invoked with a numeric argument, as in C-u C-\, toggle-input-method always prompts you for an input method, suggesting the most recently selected one as the default.

Selecting a language environment specifies a default input method for use in various buffers. When you have a default input method, you can select it in the current buffer by typing C-\. The variable default-input-method specifies the default input method (nil means there is none).

In some language environments, which support several different input methods, you might want to use an input method different from the default chosen by set-language-environment. You can instruct Emacs to select a different default input method for a certain language environment, if you wish, by using set-language-environment-hook (see set-language-environment-hook). For example:

     (defun my-chinese-setup ()
       "Set up my private Chinese environment."
       (if (equal current-language-environment "Chinese-GB")
           (setq default-input-method "chinese-tonepy")))
     (add-hook 'set-language-environment-hook 'my-chinese-setup)

This sets the default input method to be chinese-tonepy whenever you choose a Chinese-GB language environment.

You can instruct Emacs to activate a certain input method automatically. For example:

     (add-hook 'text-mode-hook
       (lambda () (set-input-method "german-prefix")))

This automatically activates the input method “german-prefix” in Text mode.

Some input methods for alphabetic scripts work by (in effect) remapping the keyboard to emulate various keyboard layouts commonly used for those scripts. How to do this remapping properly depends on your actual keyboard layout. To specify which layout your keyboard has, use the command M-x quail-set-keyboard-layout.

You can use the command M-x quail-show-key to show what key (or key sequence) to type in order to input the character following point, using the selected keyboard layout. The command C-u C-x = also shows that information, in addition to other information about the character.

M-x list-input-methods displays a list of all the supported input methods. The list gives information about each input method, including the string that stands for it in the mode line.