Is there a way in emacs (I'm using version 27.2 currently) to get a listing of all the key mappings that are active in the current buffer as well as the name of the mapped function? I also want the name of the key map itself, since more than one key map might be in use.
Unless I am misunderstanding something, the (current-active-maps)
function doesn't return the name of the keymap nor the name of the function, but rather, just an unnamed reference to the keymap and an unnamed representation of the function.
In other words, instead of the standard (current-active-maps)
output, I want a list that might look something like this ...
(
( 'ctl-x-map "\C-c" 'save-buffers-kill-emacs )
;; ... hundreds of other similar entries ...
)
The format of the list could differ slightly. All I care about is that the name of the keymap, the keystrokes, and the name of the mapped function are all shown.
describe-bindings
function and the functions it calls. You can run it withC-h b
. It displays the information you’re after to a buffer, but you could write similar code to collect the information into a list instead. Note that there are some complications you might not have thought about yet: keymaps are often nested, forming a tree, and the key binding is not always a named function. Sometimes it is another key, or a keyboard macro, or a closure or lambda, etc.