emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Is M-j broken for you in Org on Emacs 27 and 28?
@ 2021-11-28 10:26 Richard Lawrence
  2021-11-28 14:37 ` Greg Minshall
  2021-11-28 14:45 ` Colin Baxter 😺
  0 siblings, 2 replies; 31+ messages in thread
From: Richard Lawrence @ 2021-11-28 10:26 UTC (permalink / raw)
  To: emacs-orgmode

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


^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2022-10-04 11:56 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-28 10:26 Is M-j broken for you in Org on Emacs 27 and 28? Richard Lawrence
2021-11-28 14:37 ` Greg Minshall
2021-11-28 14:45 ` Colin Baxter 😺
2021-11-28 20:17   ` Richard Lawrence
2021-11-29  1:18     ` Tim Cross
2021-11-29  8:09       ` Richard Lawrence
2021-11-29 13:35         ` Tim Cross
2021-11-29 15:49           ` Richard Lawrence
2021-11-29 14:31         ` Colin Baxter 😺
2021-11-30  1:10         ` Tim Cross
2021-11-30 17:03           ` [PATCH] Fix org-comment-line-break-function (was: Is M-j broken for you in Org on Emacs 27 and 28?) Richard Lawrence
2021-11-30 20:18             ` [PATCH] Fix org-comment-line-break-function Marco Wahl
2021-11-30 22:06               ` Tim Cross
2021-12-01  8:36                 ` Marco Wahl
2021-11-30 22:08               ` Kaushal Modi
2021-11-30 23:15                 ` Tim Cross
2021-11-30 23:53                   ` Kaushal Modi
2021-12-01  1:44                   ` Kaushal Modi
2021-12-01  6:17                     ` Tim Cross
2021-12-01  8:16                       ` Richard Lawrence
2021-12-01 13:02                     ` Nicolas Goaziou
2021-12-04 22:23                     ` Tim Cross
2021-12-05  3:36                       ` Kaushal Modi
2021-12-05  9:14                         ` Nicolas Goaziou
2021-12-06 13:17                         ` Richard Lawrence
2021-12-06 13:51                           ` Kaushal Modi
2021-12-11 15:47                             ` Nicolas Goaziou
2022-09-29  5:11                             ` Ihor Radchenko
     [not found]                               ` <871qro5e4w.fsf@aquinas.mail-host-address-is-not-set>
2022-10-04 11:55                                 ` Ihor Radchenko
2021-11-30 17:16           ` Is M-j broken for you in Org on Emacs 27 and 28? Morgan Willcock
2021-11-29  8:22       ` Richard Lawrence

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).