The Help for key M-x key says

M-x runs the command execute-extended-command (found in global-map),
which is an interactive compiled Lisp function.

It is bound to <execute>, <menu>, M-x.

But in the global-map there is no entry for M-x, there are only entries for execute and menu. Where is the M-x binding present ?


You say: "But in the global-map there is no entry for M-x, there are only entries for execute and menu."

That's not true. If you are just using C-h v global-map then it's difficult to tell, unless you're good at reading the Lisp representation of a keymap.

Instead, load library help-fns+.el (Help+) and use C-h M-k global-map, to see a human-readable key listing for that keymap. There you'll see this entry, for M-x:

M-x   execute-extended-command

C-h M-k is bound to command describe-keymap.

[Emacs 27 will also have such a command, based on the one in help-fns+.el, but the one in help-fns+.el is still a bit better, IMO. Some of the features of the help-fns+.el definition weren't adopted for vanilla Emacs.]

There is, however, another keymap variable that contains the execute-extended-command binding for M-x: variable esc-map.

Meta keys are in fact on that keymap. ESC followed by a key sequence is essentially the same as META followed by that same key sequence. So M-x is equivalent to ESC x. ESC is not a modifier key here; it's a prefix key.

When you see keys listed in *Help* you'll often notice ESC listed as a prefix key, and you'll see ESC followed by some key sequence listed as a binding.

And you'll see in the value shown for C-h v global-map an entry for ESC-prefix, which means that ESC is a prefix key globally.

  • I executed "M-x load-library" "help-fns" and then as soon as i press "C-h M-k" , the command mini buffer prints "C-h M-k is undefined". I use emacs 26.3 and "describe-keymap" command is not found. I launched emacs with no config(emacs -q) – john323423 Jun 24 '20 at 17:24
  • Did you follow the links for help-fns+.el? Note the +. – Drew Jun 24 '20 at 19:25
  • See also stackoverflow.com/questions/3480173/… – phils Jun 27 '20 at 5:48

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.