GNU bug report logs -
#63535
Master branch: Error in forw_comment (syntax.c) handling of escaped LFs
Previous Next
Reported by: Alan Mackenzie <acm <at> muc.de>
Date: Tue, 16 May 2023 10:58: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
[Message part 1 (text/plain, inline)]
Your message dated Mon, 22 May 2023 16:16:49 +0000
with message-id <ZGuVcSfR-JEgVb7g <at> ACM>
and subject line Re: bug#63535: Master branch: Error in forw_comment (syntax.c) handling of escaped LFs
has caused the debbugs.gnu.org bug report #63535,
regarding Master branch: Error in forw_comment (syntax.c) handling of escaped LFs
to be marked as done.
(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)
--
63535: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=63535
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
Hello, Emacs.
In the master branch:
Consider the following C++ Mode buffer:
// comment \
comment line 2
line_3();
.. The backslash at the end of line 1 extends the comment into line 2.
Put point at // on L1, and do:
M-: (setq s (parse-partial-sexp (point) (+ (point) 9)))
.. s gets the parse state of the inside of the comment.
Now put point at EOL 1, between the backslash and the LF. Do
M-: (parse-partial-sexp (point) (point-max) nil nil s 'syntax-table)
.. This ought to leave point at BOL 2, since the syntax before the LF at
EOL 1 is that of a C++ comment, otherwise neutral. Instead, it leaves
point wrongly at BOL 3.
#########################################################################
The reason for this bug is at L+42 of forw_comment (in syntax.c). There
we have
&& !(comment_end_can_be_escaped && char_quoted (from, from_byte))
.. Checking char_quoted is wrong. Instead the function should check the
current parse state.
--
Alan Mackenzie (Nuremberg, Germany).
[Message part 3 (message/rfc822, inline)]
Hello, Stefan.
On Mon, May 22, 2023 at 11:16:40 -0400, Stefan Monnier wrote:
> > I think the following patch is better. Would you please have a look at
> > it, in the hope I haven't made any other silly mistakes. Thanks!
> I don't see any silly mistake there, sorry.
Thanks! I've committed the patch, and I'm closing the bug.
> Stefan
> PS: It does remind me that we really should do ourselves a favor and get rid
> of the distinction between `Sescape` and `Scharquote`.
> IIRC there's a risk of backward incompatibility, so it has to be done
> progressively, but we should start the process. E.g. first declare one of the
> two as obsolete, then emit a warning when we see it being used, ...
Yes. I think Sescape should be the survivor. I don't know if
Scharquote is used at all in Emacs code.
--
Alan Mackenzie (Nuremberg, Germany).
This bug report was last modified 2 years and 83 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.