GNU bug report logs -
#40658
Fforward-comment: Incorrect recognition of end of comment in C++
Previous Next
Reported by: Alan Mackenzie <acm <at> muc.de>
Date: Thu, 16 Apr 2020 12:45:02 UTC
Severity: normal
Done: Alan Mackenzie <acm <at> muc.de>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 40658 in the body.
You can then email your comments to 40658 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#40658
; Package
emacs
.
(Thu, 16 Apr 2020 12:45:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Alan Mackenzie <acm <at> muc.de>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Thu, 16 Apr 2020 12:45:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hello, Emacs.
C++ comments can be continued onto the next line by an escaped NL. This
is configured in Emacs with the variable comment-end-can-be-escaped.
However, Fforward_comment (in the backward direction) doesn't take this
into account. A BOL following an escaped NL cannot be at the end of a
C++ line comment:
// C++ comment first line \
Second line of comment
^
|
point
Point here is in the middle of a comment.
It is therefore wrong in Fforward_comment not to check
comment-end-can-be-escaped when immediately after an Sendcomment. This
can be fixed thusly:
diff --git a/src/syntax.c b/src/syntax.c
index e24b98da32..ff125b137c 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -2572,8 +2572,9 @@ between them, return t; otherwise return nil. */)
}
else if (code == Sendcomment)
{
- found = back_comment (from, from_byte, stop, comnested, comstyle,
- &out_charpos, &out_bytepos);
+ found = (!quoted || !Vcomment_end_can_be_escaped)
+ && back_comment (from, from_byte, stop, comnested, comstyle,
+ &out_charpos, &out_bytepos);
if (!found)
{
if (c == '\n')
This should clearly go into the master branch. I think it should also go
into the emacs-27 release branch, since it is relevant for a nasty bug,
bug #40052. There, scrolling in a C++ include file, which consists of a
#define macro ~2,400 lines long is deadly slow. With the above fix in
place, scrolling is over 4 times as fast, although still too slow.
--
Alan Mackenzie (Nuremberg, Germany).
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#40658
; Package
emacs
.
(Thu, 16 Apr 2020 13:36:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 40658 <at> debbugs.gnu.org (full text, mbox):
> Date: Thu, 16 Apr 2020 12:44:26 +0000
> From: Alan Mackenzie <acm <at> muc.de>
> Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>
>
> This should clearly go into the master branch. I think it should also go
> into the emacs-27 release branch, since it is relevant for a nasty bug,
> bug #40052.
Sorry, too late for that now. This code is there for the last 20+
years, we can endure that a bit more, I think.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#40658
; Package
emacs
.
(Thu, 16 Apr 2020 17:30:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 40658 <at> debbugs.gnu.org (full text, mbox):
Hello, Eli.
On Thu, Apr 16, 2020 at 16:35:14 +0300, Eli Zaretskii wrote:
> > Date: Thu, 16 Apr 2020 12:44:26 +0000
> > From: Alan Mackenzie <acm <at> muc.de>
> > Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>
> > This should clearly go into the master branch. I think it should also go
> > into the emacs-27 release branch, since it is relevant for a nasty bug,
> > bug #40052.
> Sorry, too late for that now. This code is there for the last 20+
> years, we can endure that a bit more, I think.
OK, I've committed the patch to master. The code, in effect, just dates
from 2015, when I added support for escaped EOLs in comments.
I will put some workaround into CC Mode (which I would have to have done
anyway).
--
Alan Mackenzie (Nuremberg, Germany).
Reply sent
to
Alan Mackenzie <acm <at> muc.de>
:
You have taken responsibility.
(Thu, 16 Apr 2020 17:32:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Alan Mackenzie <acm <at> muc.de>
:
bug acknowledged by developer.
(Thu, 16 Apr 2020 17:32:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 40658-done <at> debbugs.gnu.org (full text, mbox):
Bug fixed.
--
Alan Mackenzie (Nuremberg, Germany).
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#40658
; Package
emacs
.
(Thu, 16 Apr 2020 18:02:01 GMT)
Full text and
rfc822 format available.
Message #19 received at 40658 <at> debbugs.gnu.org (full text, mbox):
> I will put some workaround into CC Mode
Even better, thanks.
> (which I would have to have done anyway).
Well, there's no such obligation, really ;-)
Stefan
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 15 May 2020 11:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 5 years and 94 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.