Thursday, 18 February 2010

Typing # in emacs on OS X with a UK keyboard

What a pain!

It's bad enough that the Apple UK keyboard doesn't have an obvious way of typing a # - alt-3 since you ask, and it's not printed on the key either like the Euro symbol, €, is! This isn't such a terrible thing in most editors since alt-3 isn't too hard to cope with. But in emacs the alt key is mapped to Meta, so alt-3, by default does something else - not sure what.

Thankfully, this is emacs so it's easy enough to put right, simply add the following to your .emacs file:
(global-set-key (kbd "M-3") "#")
Done and done.

No comments: