set-transient-map
set-transient-map is a compiled Lisp function in `subr.el
'.
(set-transient-map MAP &optional KEEP-PRED ON-EXIT)
Set MAP as a temporary keymap taking precedence over other keymaps.
Normally, MAP is used only once, to look up the very next key.
However, if the optional argument KEEP-PRED is t, MAP stays
active if a key from MAP is used. KEEP-PRED can also be a
function of no arguments: it is called from `pre-command-hook' and
if it returns non-nil, then MAP stays active.
Optional arg ON-EXIT, if non-nil, specifies a function that is
called, with no arguments, after MAP is deactivated.
This uses `overriding-terminal-local-map' which takes precedence over all other
keymaps. As usual, if no match for a key is found in MAP, the normal key
lookup sequence then continues.
This returns an "exit function", which can be called with no argument
to deactivate this transient map, regardless of KEEP-PRED.