In emacs, how can I show shadowed/overridden key bindings for the current buffer?
They won't show up when running describe-bindings
(C-h b
).
In other words: how can I see if the modes active in a buffer have conflicting key bindings?
Just call describe-mode
: C-hm
The majority of mode docstrings will display their keymaps, and the method used to list them here also tells you if a binding is shadowed.
It doesn't tell you what it's shadowed by, but of course that's trivial to check with C-hc or C-hk.
e.g.:
key binding
--- -------
[...]
C-M-q indent-sexp
(that binding is currently shadowed by another mode)
That text is generated by the function substitute-command-keys
which processes the mode docstring when the documentation
function is called.
e.g.:
(substitute-command-keys "\\{lisp-interaction-mode-map}")
The following functions can also be useful:
(key-binding KEY &optional ACCEPT-DEFAULT NO-REMAP POSITION) ;; dominant binding
(global-key-binding KEYS &optional ACCEPT-DEFAULT)
(local-key-binding KEYS &optional ACCEPT-DEFAULT)
(minor-mode-key-binding KEY &optional ACCEPT-DEFAULT) ;; discover keymap(s)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With