I would like to bind the dedicated function keys (F1 through F10) using the standard modifier key, e.g. (define-key my-keymap (kbd "<S-F2>") #'my-function)
. However, this and similar keybindings have no effect.
describe-key
reports: "<f2> (translated from <S-f2>) runs the command. . ." and gives the target command for the unmodified F2 key. This is true for all the function keys on my system (using Windows 10 and Emacs 27.2).
Earlier StackExchange answers about key translation suggest that I must modify one of the translation keymaps. Following some specific advice, I have tried (define-key input-decode-map [f2] 'nil)
but evaluating this form has no effect.
More generally, I cannot find where this bulk translation is occurring. Running emacs -q
shows that some of the translations, but not all, are set early in the start-up process. With -q
, define-key()
says that "<f3> (translated from <S-f3>) runs the command kmacro-start-macro-or-insert-counter."
Is there is an easier way to de-translate the function keys? Is there a downside to doing so?
(define-key my-keymap (kbd "<S-F2>") #'my-function)
without the backslash?