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?

Sean Allred
  • 6,861
  • 16
  • 85

1 Answers1

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.

Stefan
  • 26,154
  • 3
  • 46
  • 84