1

describe-key works for complete keys. How can I instead describe a prefix key?

For example, I'd like to be able to do something like this:

M-x describe-prefix-key C-x

And have it describe the keymap which C-x is bound to.

0

1 Answer 1

2

I found the answer which I will post here in case it is useful for someone else. The solution is to evaluate describe-key with the prefix key as an argument, rather than calling it interactively:

M-: (describe-key "\C-x") RET

3
  • 1
    Just in case you didn't know, you can type <prefix> C-h to find out which keys are bound under <prefix>.
    – phils
    Commented May 4 at 4:20
  • @phils Thanks. Yes, I did know that. There is also which-key which does the same (among other things). However it doesn't reveal the keymap name.
    – JBentley
    Commented May 4 at 8:10
  • If it's purely the binding you want to see, then you can use (key-binding KEY) or, for a specific keymap, (lookup-key KEYMAP KEY).
    – phils
    Commented May 4 at 9:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.