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

My first foray into customising emacs that didn’t involve copy and paste from something on the internet.

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 above inserted into your .emacs file should map the keys correctly.

Another option would be to re-map the apple key to be the meta key, perhaps another yak.

For copy and paste-ability:

;; Allow hash to be entered
(defun insert-pound ()
  “Inserts a pound into the buffer”
  (insert “#”))
(global-set-key (kbd “M-3”) ‘(lambda()(interactive)(insert-pound)))
Share