I have defined a keymap my-custom-key-map
with some commands. This keymap lives in memory. There is no (prefix) key to activate this keymap.
How to activate this keymap from lisp code?
I don't want to bind this keymap to a prefix key. I want to "invoke" it from lisp code.
Example I have a command which does things. And after it has done it, I want my keymap activated. So that when I type a key from the keymap, the associated command is invoked. Then the keymap should deactivate again and not be accessible anymore. Until my command activates it again for just one usage.
Another way to ask the question: I want to do what a prefix key does when it is bound to a keymap. It activates the keymap for one key stroke. This is what I want to do.
Another one: I want to do what a leader key does. It activates? starts? triggers? invokes? its keymap.
Another one: Given, I have defined (global-set-key (kbd "X H") 'help)
. What does emacs invoke when I press X
?
X
, Emacs does nothing: it waits for you to press another key until it gets a complete key sequence according to the current set of active key maps. – NickD Mar 27 '23 at 18:47read-key-sequence
in the C source of Emacs in the filesrc/keyboard.c
. See also Command Loop Overview and Key sequence input. – NickD Mar 27 '23 at 18:47