Cataclysmic Mutation

Machine Learning and Whatever Else

Emacs, Icelandic, and Input Methods

So Icelandic has bizarro-world characters in its alphabet. The Mac has an Icelandic keyboard map built in, but it’s slightly inconvenient to use. A lot of characters (á, ö, etc.) can be typed without switching layouts by typing Alt-key sequences, but typing characters like ð and þ require switching keymaps, and that process is cumbersome. You can put the switcher in the menu bar, but because I don’t want to give up my nice US layout the vast majority of the time, I end up switching layouts just to type one or two characters, and then switching back immediately. Since this requires the mouse, it’s slow.

The other problem with this is that the Alt key method doesn’t work at all in Emacs, which interprets those as meta key bindings. The solution to this problem turns out to be Emacs’ great support for input methods.

You type ‘C-‘ to switch input methods. The first time you do it, it prompts you to select one. I choose ‘icelandic-keyboard’. This accomplishes the same thing as setting Mac OS X’s keymap, but only affects emacs. The really great part is that once you’ve set the input method, pressing ‘C-‘ again toggles it. So I can really quickly toggle back and forth between Icelandic (to get ð, þ, and really easy access to the accents) and my normal US keymap that has much easier access to semicolons and the like.