1

I want to use the forward-sexp function in Emacs, which on my Spacemacs for Mac is bound to C-M-f.

Similarly for the backward-sexp. However, upon pressing C- for Control, and then the Meta key, which is the Escape key, I'm getting the following in the minibuffer:

<C-escape> is undefined. 

How to fix this?

  • The Meta key is NOT the Escape key. – NickD Sep 14 at 3:19
  • @NickD I used to think all along that the escape key was meta key because when I did Escape - x, spacemacs would show M - x. Why is that the case if Escape isn't the meta key? – lamp bottle Sep 14 at 18:33
  • Escape-x gets translated to M-x - current versions of Emacs say M-x (translated from <escape> x) runs the command execute-extended-command which should make things a bit clearer. @Drew's answer explains in more depth. – NickD Sep 14 at 18:41
2

If you don't have a Meta key (it is often Alt) then you can use Escape, yes.

But in that case, what you want to use is Escape followed by Control + f, which we write as ESC C-f.

That is, Emacs writes the key sequence as ESC C-f when it talks to you about it.

A Meta key, which we write as M-, is a modifier key, which means you press and hold it down while you press the next key. Same thing for the Control key, which we write as C-: it's also a modifier key. And so is the Shift key.

The Escape key is not a modifier key. It's a prefix key. You press and release it, then carry on with the other keys of the key sequence. So you press and release Escape, then you press and hold down Control while you press f.

See the Emacs manual, node User Input, and the Elisp manual, nodes Functions for Key Lookup and Prefix Keys.

| improve this answer | |
  • I used to think all along that the escape key was meta key because when I did Escape - x, spacemacs would show M - x. Why is that the case if Escape isn't the meta key? – lamp bottle Sep 14 at 18:33
  • See the manual pages I pointed to. – Drew Sep 14 at 19:45

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.