Why is Ctrl+M bound to Enter in Ubuntu Jaunty? How to turn it off?
I\'m using Emacs and would like to bind Ctrl+M to some other command.
Note: The issue isn't limited to Linux, it exists on Windows (and presumably Mac) as well. Read the other (non stack-overflow) source of all knowledge: Wikipedia on Carriage Return.
If you want to rebind C-m, be sure to all bind
In a plain Emacs, the Enter/Return key is bound to
Try C-h k
RET (translated from
)
So, rebind both in the appropriate keymap to make sure you get the behavior you want.
It might be instructive to play with the following code:
(defun my-return ()
(interactive)
(message "return"))
(defun my-ret ()
(interactive)
(message "RET"))
(defun my-c-m ()
(interactive)
(message "C-m"))
(global-set-key (kbd "") 'my-return)
(global-set-key (kbd "C-m") 'my-c-m)
(global-set-key (kbd "RET") 'my-ret)
Put that in your *scratch*
buffer and press C-j after each line (to evaluate the sexp). Then play with the Enter/Return keys and C-m.