I use Emacs to write blog. In the recent update, I found
M-RET no longer behave as leader key in org mode, but behave as
org-meta-return. And even more strange is that in other mode, it behave as leader key. And
M-RET also works in terminal in org mode. In GUI, pressing
C-M-m can trigger leader key.
SO I opened this issue, with the help of these friends, the issue has been fixed. Here is the cause of the bug.
RET is not a key in keyboard, it is same as
C-m (press ctrl and m) key. Pressing
<Return> key actually sends
<return> to Emacs, and Emacs automatically maps
This can be proved: type
SPC h d k <Enter> in spacemacs, it will output
RET (translated from <return>) runs the command org-open-at-point, which is an interactive compiled Lisp function in ‘org.el’.
<Enter> key usually given the same result. But you can also bind these with two different command. Take
M-RET as example. If only
<M-return> is bind, the
C-M-m is unbinded. If only
C-M-m is binded, then
M-return is implicitly also bind to same command as
In org mode scr:
(org-defkey org-mode-map (kbd "M-<return>") #'org-meta-return) (org-defkey org-mode-map (kbd "M-RET") #'org-meta-return)
These two keys were binded to
The unfixed Spacemacs configuration file binds
In terminal, the
<Enter> is the same as
C-m, both of them send ASCII 13 character. So press meta return will trigger leader key.
In GUI, the
<Enter> key will send
<return> to Emacs. Org mode has explicitly bind
org-meta-return is triggered. In other mode, the
M-<return> key binding is not defined, so
<return> will translate to
RET, then trigger leader key.
In the fixed version,
dotspacemacs-major-mode-emacs-leader-key bind to
M-<return> in GUI, and this override org mode’s binding. Finally meta return becomes leader key again.