5

I see these keybindings sometimes in the help docs. E.g. from C-h f clipboard-kill-ring-save

It is bound to <copy>, <f16>

So, what might this be on my keyboard assuming I do not have CUA enabled? How could I have found this out myself using Emacs' help system?

2 Answers 2

5

Emacs calls these function keys. Emacs usually writes their names with surrounding <...> when it interacts with you.

See the Emacs manual, nodes Function Keys, Keymaps and User Input.

For example (from Emacs manual, node Keymaps):

Most modern keyboards have function keys as well as character keys. Function keys send input events just as character keys do, and keymaps can have bindings for them. Key sequences can mix function keys and characters. For example, if your keyboard has a <Home> function key, Emacs can recognize key sequences like C-x <Home>. You can even mix mouse events with keyboard events, such as S-down-mouse-1.

And (from Emacs manual, node Function Keys):

Key sequences can contain function keys as well as ordinary characters. Just as Lisp characters (actually integers) represent keyboard characters, Lisp symbols represent function keys. If the function key has a word as its label, then that word is also the name of the corresponding Lisp symbol. Here are the conventional Lisp names for common function keys:

  • left, up, right, down -- Cursor arrow keys.

etc.

And the Glossary node of the manual has this entry:

Function Key -- A function key is a key on the keyboard that sends input but does not correspond to any character.

See also the Elisp manual, node Function Keys.

Emacs also has fake function keys, which it uses to represent menu names, menu items, and tool-bar items. See the Elisp manual, nodes Menu Example and Tool Bar for information about these:

These symbols are treated as function keys, but they are not real function keys on the keyboard. They do not affect the functioning of the menu itself, but they are echoed in the echo area when the user selects from the menu, and they appear in the output of where-is and apropos.


As @phils has mentioned, Emacs can't know what function keys your keyboard and system might support, but you can use C-h c or C-h k to try various keyboard keys and see (1) whether Emacs recognizes them (instead of them being captured by your OS or some other app) and (2) what Emacs calls them (e.g. whether it calls them <...>).


As for how to learn about function keys using Emacs help:

  • See above, for help using the manuals. As always, i in Info is your friend, and you can also search using C-M-s function key.

  • M-x apropos function key gives you quick info (and links) about commands, other functions, and variables whose names contain those words. And M-x apropos documentation function key gives you such info about such things whose documentation mentions those words.

2

You won't necessarily have these keys on your keyboard at all, and Emacs won't know which keys your keyboard does or doesn't have (and in any case you might have higher-level customisations on your system translating the keys to something else before they get to Emacs).

However, if you did have a key which sent the copy event / key symbol to Emacs, then that <copy> binding would be used.

You can use the likes of C-hc to find out what Emacs actually received when you typed a key, but AFAIK that's about as far as "asking Emacs" can go for this question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.