3

Looking for a new convenient keybinding for a frequently used command I stumbled upon Ctrl-M which is the same as Return/Enter.

What is the point of this binding? Can it cause some problem if I overwrite it?

3

ASCII control character Control M is a carriage-return character. It is return, and its ASCII name is RET. That's the reason why C-m in Emacs is RET.

In terminal mode (no graphic display) Emacs does not have a <return> (pseudo-)function key. There is only the RET key, also known as C-m.

In a graphic-display Emacs has both a <return> key and a RET (C-m) key. You can bind either of them to whatever command you like.

If <return> is not explicitly bound then when you use <return> the binding of RET takes effect.

This is for convenience - it's the same principle that lets key M act as key m if m is bound to a command and M is not explicitly bound to a command.


As @phils mentioned in a comment here, see also C-h i g (elisp)Function Keys.

  • So I if used Emacs in terminal (I don't) then I shouldn't rebind C-m, because then RET wouldn't work either? – Tom Sep 5 at 17:36
  • If you rebind C-m then you've just rebound RET. They are the same thing. Whether rebinding it breaks something or not is another question. It likely won't "break" anything, but sometimes when you think RET (C-m) will do one thing it might do another instead. It depends on the keymap you rebind it in etc. – Drew Sep 5 at 18:25
  • See also: C-h i g (elisp)Function Keys – phils Sep 5 at 21:37
  • @phils: Thx; I added that to the answer. – Drew Sep 6 at 0:18

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.