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.
Some very good explanations here as to the nature of the problem, and I won't expound on those issues. However, I want to address the original question directly. I solved the problem for changing the (control m)
sequence bound to 'newline
command by the following code in my ~/.xemacs/custom.el
file:
(defun my-compile-hook-for-c-and-cpp-mode ()
"My compile hook for C and C++ mode"
(local-set-key [(control m)] 'compile)
)
(add-hook 'c-mode-hook 'my-compile-hook-for-c-and-cpp-mode)
(add-hook 'c++-mode-hook 'my-compile-hook-for-c-and-cpp-mode)
In the above example, I have changed (control m)
to run the 'compile
command (M-x compile
) when the c-mode
or c++-mode
is active.
Note that you can change the behavior of (control m)
globally as well, without the mode related bindings. In that case, just add the following to your ~/.xemacs/custom.el
file:
(global-set-key [(control m)] 'compile)