Multilingual Editing

Protesilaos Stavrou (Prot) has an excellent short video that discusses how to use multilingual characters in Emacs. Prot, of course, is Greek and often wants to write Greek in Emacs. You can do that by switching keyboards at the system level but then—especially with languages like Greek—the Emacs keybindings break because the system is sending the wrong code to Emacs.

Happily, there’s another way: toggle-input-method bound to Ctrl+\ by default. This mode allows you to type with a non-English character set but still have Emacs perform correctly.

You can set a “default” input method that will become active when you type Ctrl+\ but if you add the universal prefix, Emacs will allow you to choose the input method you want. For example, I have my input method set to TeX so I can enter things like em dashes and various mathematical constructs but I’m currently learning Spanish so if I want to write in Spanish, I can toggle the input method to Spanish. Regardless of what input method I’m using, Emacs and its keybindings continue to operate.

Finally, there’s activate-transient-input-method, bound to Ctrl+x \, that allows you to switch to the default input method for the next character only. That’s nice for me when I simply want to add an em dash (—) but otherwise use my normal English input method. Prot uses it to add single Greek characters to his English text. As with toggle-input-method, adding the universal prefix will allow you to select the input method for the next character.

Prot’s video is 10 minutes, 59 seconds so it should be easy to fit it in. These are really useful commands even if you aren’t bilingual.

This entry was posted in General and tagged . Bookmark the permalink.