I want to create a new key binding that puts out a single letter with a key combination. For example: M-E inserts an "ê" character. Is this possible?
1 Answer
Try this:
(global-set-key (kbd "M-e") '(lambda () (interactive) (insert-char 234))) How to get 234? Place your cursor on the letter ê and press C-x =. Modeline will show you the codes:
Char: ê (234, #o352, #xea, file ...) point=3 of 27 (7%) column=0 - 2Why not simply
(insert "ê"), without having to look the char up?T. Verron– T. Verron2016-10-14 14:53:08 +00:00Commented Oct 14, 2016 at 14:53
insert-charto insert that character.C-x 8 ^ einsertsê. Similarly usingA,E,I,O,U,a,i,o,uafterC-x 8 ^would work as you would guess.M-xis already bound to a command so it can't be a prefix for a keybinding (as the error msg says).