Subject: Re: 27.1.50; c-context-line-break misbehaves at end of comment

From: Alan Mackenzie <[email-masked]>
Date: Tue, 24 Nov 2020 16:39:29 +0000

Hello again, Eli.

On Tue, Nov 24, 2020 at 16:22:46 +0000, Alan Mackenzie wrote:
> On Mon, Nov 23, 2020 at 19:33:35 +0200, Eli Zaretskii wrote:
> > To reproduce:

> >   emacs -Q
> >   C-x C-f src/xdisp.c
> >   C-u 19 M-g g
> >   C-e

> > This should bring you to the end of this line in xdisp.c:

> >   along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.  */

> > It is the end of a comment.  Now do this:

> >   M-: (local-set-key "\C-m" 'c-context-line-break) RET

> > Then press RET.  I expect Emacs to open a new line, indent it
> > according to the context, and put point after the indentation.
> > Instead, the new line is inserted _before_ the point's line, and point
> > stays at the end of the comment as it was before.

> > This is a regression wrt Emacs 26.

> > I had this customization of RET in CC mode since about forever, and it
> > always worked like I expected.  Until Emacs 27.1.

> > Can this be fixed for Emacs 27.2, please?

> This is an off-by-one error, and was fixed in master with the following
> commit:

> commit 7574390099f0de11939a0e3626cf222b58863290
> Author: Alan Mackenzie <[email-masked]>
> Date:   Thu Jun 25 17:07:16 2020 +0000

>     CC Mode.  Fix an off by one error.  Fixes bug #41809

>     * lisp/progmodes/cc-engine.el (c-full-pp-to-literal): Change > to >= (twice).

> I can't remember why I didn't commit this to the emacs-27 branch.
> Possibly it was too close to the release.

> I'll cherry-pick it back to the emacs-27 branch.

DONE.  It appears now to be working.

-- 
Alan Mackenzie (Nuremberg, Germany).