Subject: Re: bug#71459: 29.3; reindent-then-newline-and-indent bug when newline triggers abbrev expansion
From: Eli Zaretskii <[email-masked]>
To: [email-masked]
Cc: [email-masked]
Date: Sat, 15 Jun 2024 13:05:51 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

> From: [email-masked]
> Date: Sun, 09 Jun 2024 23:42:58 -0400
> 
> 1. emacs -Q
> 2. Open an empty buffer in a mode like conf-mode.  Enable abbrev-mode.
> 3. Type "# this is a comment", select the line, and run M-x
>    add-mode-abbrev, give it some abbrev like "tc".
> 4. On a new line, type tc and then M-x reindent-then-newline-and-indent
> 
> I expect this to insert "# this is a comment", but instead it inserts
> "#this is a comment".  Note the missing space between the
> comment-start marker and the comment text.
> 
> For context, this came up in a major mode (ledger-mode) where I had
> bound RET to reindent-then-newline-and-indent, so it happens quite
> freqently to me.
> 
> I think just making reindent-then-newline-and-indent use a marker for
> the initial value of `pos' would work, but I haven't thought about it
> very much.

Thanks, I went with your suggestion of using a marker.  I installed
the change on the master branch, and I'm therefore closing this bug.