I’d like to use a keycode with modifiers in my .emacs file. However my naive attempts have failed so far. For instance if I use:
(global-set-key [93] "\\")
The ¥ key on my keyboard will emit \. However, what I’d also like to do is:
(global-set-key "M-[93]" "\\") ;; doesn't work
My implementation says that:
error: Key sequence ⇧M - [ 9 3 ] starts with non-prefix key ⇧M
How do I use modifiers such as M, S with keys defined by keycode?
The back story is that I’m trying to modify my .emacs file to handle both the ¥ and \ behavior which exist on Japanese keyboards. For instance on an Apple keyboard, option-¥ would emit \ while ¥ would emit ¥. A different workaround is to use:
(setq ns-alternate-modifier 'option)
However this sets the option key as option. Which means meta must be defined on another key, which is inconvenient. Thus the motivation for this question.
Run the command with
M-x global-set-keyand type the desired key combo. Then have Emacs output what it used to do the binding by doingC-x ESC ESC. Then you can copy that.For more info than you ever wanted: the guide