Subject: bug#43007: 27.1; M-j doesn't behave properly in comments

From: Alessio Vanni <[email-masked]>
Date: Mon, 24 Aug 2020 13:47:00 +0200

Lars Ingebrigtsen <[email-masked]> writes:

> This happens for me, too, if I have point behind the "//" characters.
> But that seems like a natural behaviour?

When the point is at the end of the line, as it's normal after writing
something, the new line is still being opened above.

I should add that after testing it some more after sending the bug
report, it managed to create a new line above a paragraph that was
disconnected to the one I was currently editing, like so (the |
character is the point):

// Paragraph one.
// With some other lines.

normal(text);

// Another paragraph
// begins here.|

Which became:

// |
// Paragraph one.
// With some other lines.

normal(text);

// Another paragraph
// begins here.

> I'm unable to reproduce this in Emacs 28.  Where is point when you hit M-j?

The point is always in the spot placed by M-j.  In the case of //, it's
after the space (so 3 characters after the beginning of the line), in
case of *, it's right after the star without any spaces.  The first time
I press the keybinding the point is at the end of the line, as shown in
the example above.

This is happening consistently, both in my customized session and with
emacs -Q.  The end result is relatively random and sometimes it doesn't
break immediately, but it happens eventually after a while that I'm
editing a file.