[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Is M-j broken for you in Org on Emacs 27 and 28?
From: |
Richard Lawrence |
Subject: |
Is M-j broken for you in Org on Emacs 27 and 28? |
Date: |
Sun, 28 Nov 2021 11:26:38 +0100 |
Hi Org community,
Some questions for those of you on Emacs 27 and 28:
Does M-j in an org-mode buffer do what you expect?
Does it throw an error?
What function is M-j bound to in Org?
Backstory:
I have long been on Emacs 26.3 (in Debian stable) but recently decided
to try a newer Emacs from GNU Guix. I immediately ran into an issue,
and now I'm trying to figure out if it's a bug, and if so where to file
it: in both Emacs 27.2 and 28.0.50, typing M-j in an Org buffer throws
(wrong-type-argument char-or-string-p nil)
The source of this problem appears to be that the keybinding for M-j
changed between Emacs 26 and 27. In Emacs 26 it calls
indent-new-comment-line. In Emacs 27 and 28 it calls
default-indent-new-line, and the call stack look like:
insert-before-markers-and-inherit(nil)
org-comment-line-break-function(nil)
default-indent-new-line()
funcall-interactively(default-indent-new-line)
call-interactively(default-indent-new-line nil nil)
command-execute(default-indent-new-line)
The error arises because insert-before-markers-and-inherit cannot accept
nil (the value of fill-prefix in this context).
I see this error in emacs -q with both Emacs 27 and 28 from Guix.
After some investigation, the functions involved here don't appear to
have changed at all recently (though see [1]); just the binding. This
leads me to ask: why hasn't this been discovered already? Which leads
me to wonder if I am using M-j in some non-standard way.
Some time in the distant past, I internalized the idea that M-j is a
better way to type a newline because (a) it doesn't involve a pinky
reach and (b) in most contexts in Emacs, it is more likely to "do what I
mean" than RET is. In particular, it continues comments and indents
properly. (I am also an evil-mode user and there is probably some part
of my brain that thinks "M-j is like j for insert mode".) But maybe that
was always wrong, and the recently changed binding is just an indication
that I was not using M-j as intended.
So which is it? Is this a bug in Emacs, in Org, or in my ingrained
typing habits? Many thanks for your advice.
--
Best,
Richard
[1] There is a commit which changed default-indent-new-line in August of
this year, but the changes don't seem relevant to the error I'm seeing,
since I also see it in Emacs 27.2:
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=b41f31d2b60269bd0e7addd1081f3738f91e76bc
- Is M-j broken for you in Org on Emacs 27 and 28?,
Richard Lawrence <=