GNU bug report logs -
#41809
c-context-line-break incorrect after comments: cache issue?
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 41809 in the body.
You can then email your comments to 41809 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#41809
; Package
emacs
.
(Thu, 11 Jun 2020 16:10:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
"Daniel Colascione" <dancol <at> dancol.org>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Thu, 11 Jun 2020 16:10:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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))'
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#41809
; Package
emacs
.
(Thu, 11 Jun 2020 18:39:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 41809 <at> debbugs.gnu.org (full text, mbox):
Hello, Daniel.
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.
--
Alan Mackenzie (Nuremberg, Germany).
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#41809
; Package
emacs
.
(Fri, 12 Jun 2020 07:43:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 41809 <at> debbugs.gnu.org (full text, mbox):
Hello again, 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.
Would you please try out the following patch on your real code where you
found the bug. It seems to fix your test case.
diff -r fd31432873bd cc-engine.el
--- a/cc-engine.el Thu Jun 11 10:50:35 2020 +0000
+++ b/cc-engine.el Fri Jun 12 07:32:38 2020 +0000
@@ -3141,7 +3141,7 @@
(not base) ; FIXME!!! Compare base and far-base??
; (2019-05-21)
(not end)
- (> here end))
+ (>= here end))
(progn
(setq far-base-and-state (c-parse-ps-state-below here)
far-base (car far-base-and-state)
@@ -3154,7 +3154,7 @@
(or
(and (> here base) (null end))
(null (nth 8 s))
- (and end (> here end))
+ (and end (>= here end))
(not
(or
(and (nth 3 s) ; string
Thanks!
--
Alan Mackenzie (Nuremberg, Germany).
Reply sent
to
Alan Mackenzie <acm <at> muc.de>
:
You have taken responsibility.
(Thu, 25 Jun 2020 17:13:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
"Daniel Colascione" <dancol <at> dancol.org>
:
bug acknowledged by developer.
(Thu, 25 Jun 2020 17:13:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 41809-done <at> debbugs.gnu.org (full text, mbox):
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).
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 24 Jul 2020 11:24:04 GMT)
Full text and
rfc822 format available.
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.