Emacs question – hash key

From http://jimbarritt.com/non-random/2010/11/07/typing-the-pound-or-hash-key-in-emacs-on-uk-macbook

Typing the pound, or hash (#) key in emacs on UK Macbook:

The problem with OS X and the UK keyboard is that the pound key actually has a £ on it. To get “#” you have to press Alt+3

Of course, in emacs, the alt key is the meta key which is trapped by emacs. The simple function below inserted into your .emacs file should map the keys correctly.

;; Allow hash to be entered  
(global-set-key (kbd "M-3") '(lambda () (interactive) (insert "#")))

Leave a Comment