I have a Mac Laptop and I am connecting to server running Linux. As Alt+3 is already bound in EMACS to a command, so I cannot insert the hash symbol in a file. I have tried the following solution I found online:
(global-unset-key (kbd "C-3")) (global-set-key (kbd "C-3") '(lambda() (interactive) (insert-string "#"))) //I know that C is for CTRL not Alt - I have tried with M-3 instead as well
and some others as well, but none seem to work. Can you tell me any other way in which I might be able to enter the hash sign (#) in a file.
Aso tried (did not work):
(fset 'insertPound "#") (global-set-key (kbd "M-3") 'insertPound)
Thank you!
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 "#")))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With