key-binding
probes keys in the currently active keymaps. For those keymaps, such as minibuffer ones, or isearch-mode-map
which are restrictive and become inactive as soon as the user presses a key outside of a limited set of defined keys, I am not able to invoke key-binding
without deactivating those keymaps.
How do I:
Determine which keymaps come into effect after invoking certain commands (for example,
isearch-mode-map
is set as the overriding-local-map byisearch-forward-regexp
) in a way that does not involve analyzing source code. Is there a hook that I can use to track/log the state of a variable?Probe keys in those keymaps. For example, to what is
RET
bound inisearch-mode-map
?
My closest solution has been to bind this function:
(defun probe_keybinding ()
(interactive)
(message (prin1-to-string (key-binding (read-key-sequence-vector "Enter key to probe"))))
)
to an uncommon key like 'S-f9' and invoke it when the keymaps in which I am interested are active (eg in the middle of a find-file
in the minibuffer or a eval-expression
). This does not always work, for example, isearch-forward-regexp
exits as soon as a non-recognized key is entered.