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?

Drew
  • 75,699
  • 9
  • 109
  • 225
zendevil.eth
  • 151
  • 2
  • The Meta key is *NOT* the Escape key. – NickD Sep 14 '20 at 03: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? – zendevil.eth Sep 14 '20 at 18:33
  • `Escape-x` gets translated to `M-x` - current versions of Emacs say `M-x (translated from x) runs the command execute-extended-command` which should make things a bit clearer. @Drew's answer explains in more depth. – NickD Sep 14 '20 at 18:41

1 Answers1

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.

Drew
  • 75,699
  • 9
  • 109
  • 225
  • 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? – zendevil.eth Sep 14 '20 at 18:33
  • See the manual pages I pointed to. – Drew Sep 14 '20 at 19:45