GNU bug report logs - #41809
c-context-line-break incorrect after comments: cache issue?

Previous Next

Package: emacs;

Reported by: "Daniel Colascione" <dancol <at> dancol.org>

Date: Thu, 11 Jun 2020 16:10:02 UTC

Severity: normal

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Alan Mackenzie <acm <at> muc.de>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#41809: closed (c-context-line-break incorrect after comments:
 cache issue?)
Date: Thu, 25 Jun 2020 17:13:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Thu, 25 Jun 2020 17:12:29 +0000
with message-id <20200625171229.GB10342 <at> ACM>
and subject line Re: bug#41809: c-context-line-break incorrect after comments: cache issue?
has caused the debbugs.gnu.org bug report #41809,
regarding c-context-line-break incorrect after comments: cache issue?
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
41809: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=41809
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: "Daniel Colascione" <dancol <at> dancol.org>
To: bug-gnu-emacs <at> gnu.org
Cc: acm <at> muc.de
Subject: c-context-line-break incorrect after comments: cache issue?
Date: Thu, 11 Jun 2020 09:09:17 -0700
c-context-line-break sometimes incorrectly extends a comment when invoked
immediately after the end of a comment. To repro:

emacs -Q --eval '(progn (c-mode) (insert "/*foo*/") (backward-char)
(c-context-line-break) (delete-char -2) (end-of-line)
(c-context-line-break))'

The second c-context-line-break occurs when point is *after* the comment,
so the /*foo*/ comment shouldn't be extended --- yet it is. The problem
appears to be some kind of cc-mode cache corruption. This recipe behaves
correctly:

$ emacs -Q --eval '(progn (c-mode) (insert "/*foo*/") (backward-char)
(c-context-line-break) (delete-char -2) (end-of-line) (c-before-change
(point-min) (point-max)) (c-after-change (point-min) (point-max) (1-
(point-max))) (c-context-line-break))'



[Message part 3 (message/rfc822, inline)]
From: Alan Mackenzie <acm <at> muc.de>
To: Daniel Colascione <dancol <at> dancol.org>
Cc: acm <at> muc.de, 41809-done <at> debbugs.gnu.org
Subject: Re: bug#41809: c-context-line-break incorrect after comments: cache
 issue?
Date: Thu, 25 Jun 2020 17:12:29 +0000
Hello, Daniel.

On Thu, Jun 11, 2020 at 18:38:29 -0000, Alan Mackenzie wrote:
> In article <mailman.1663.1591891807.2541.bug-gnu-emacs <at> gnu.org> you wrote:
> > c-context-line-break sometimes incorrectly extends a comment when invoked
> > immediately after the end of a comment. To repro:

> > emacs -Q --eval '(progn (c-mode) (insert "/*foo*/") (backward-char)
> > (c-context-line-break) (delete-char -2) (end-of-line)
> > (c-context-line-break))'

> > The second c-context-line-break occurs when point is *after* the comment,
> > so the /*foo*/ comment shouldn't be extended --- yet it is. The problem
> > appears to be some kind of cc-mode cache corruption. This recipe behaves
> > correctly:

> > $ emacs -Q --eval '(progn (c-mode) (insert "/*foo*/") (backward-char)
> > (c-context-line-break) (delete-char -2) (end-of-line) (c-before-change
> > (point-min) (point-max)) (c-after-change (point-min) (point-max) (1-
> > (point-max))) (c-context-line-break))'

> Thanks for the report.

> After a quick bit of edebugging, it seems to be an off-by-one error in
> some cache handling.  It shouldn't be too difficult to sort out.

It wasn't.  I've committed a simple patch for this, and I'm closing the
bug.

> -- 
> Alan Mackenzie (Nuremberg, Germany).


This bug report was last modified 4 years and 330 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.