5

I'm trying to find which map C-c C-x is bound to on my system, but C-c C-x C-h reveals nothing. (describe-key (kbd "C-c C-x")) reports that the sequence is unbound, yet I can still type C-c C-x and Emacs awaits more input (as if it were waiting for another key in the sequence).

What's going on?

  • 1
  • @Gilles problem is that it's an empty keymap. – Sean Allred Dec 7 '14 at 21:17
  • Empty? How can it be empty if it maps your key? – T. Verron Dec 8 '14 at 8:56
  • @T.Verron Beats me. Try it out in emacs -Q; the behavior persists for me (homebrewed emacs 24.4) – Sean Allred Dec 8 '14 at 13:13
  • I'm pretty sure Stefan figured out the issue. The two questions I pose in the original question are unrelated, so I'm just going to focus on the one :) (The X–Y problem at work…) – Sean Allred Dec 8 '14 at 13:18
7

Indeed, interactively C-h k can't be used if you're trying to find where a prefix map is defined. And even the question itself may be somewhat meaningless in the sense that it can be defined at various places at the same time (Typically the C-c prefix is bound to a keymap which is a dynamically-computed combination of various keymaps, e.g. from the major-mode and from various minor modes).

But you can still do

M-: (describe-key [?\C-c ?\C-x]) RET

which should tell you (in a recent enough Emacs, and in the case where all bindings in this prefix come from a single keymap) which keymap defines this prefix.

Note that C-c C-x might wait for more input as if it were a prefix even if it isn't. This is because determining "the end of a key-sequence" is quite tricky: while there's no binding for C-c C-x maybe what you're trying to see is if there's a binding for C-c é and you're doing that by hitting C-c C-x 8 ' e, so after the C-x Emacs keeps waiting for more input to figure out what's going on.

Another way to investigate key prefixes is with C-h, so you'd do C-c C-x C-h and it should show you the bindings available in C-c C-x. Sadly in this case it only shows you the "normal" bindings and not the key-remapping bindings, so it won't explain why Emacs is waiting. This probably deserves a feature request via M-x report-emacs-bug, so that C-c C-x C-h shows that it can be followed by 8 ' e and things like that.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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