GNU bug report logs -
#36474
Algorithm in electric-pair--unbalanced-strings-p unsuitable for CC Mode
Previous Next
Reported by: Alan Mackenzie <acm <at> muc.de>
Date: Tue, 2 Jul 2019 13:17:01 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, 8 Jul 2019 09:36:27 +0000
with message-id <20190708093627.GB4529 <at> ACM>
and subject line Re: bug#36474: Acknowledgement (Algorithm in electric-pair--unbalanced-strings-p unsuitable for CC Mode)
has caused the debbugs.gnu.org bug report #36474,
regarding Algorithm in electric-pair--unbalanced-strings-p unsuitable for CC Mode
to be marked as done.
(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)
--
36474: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=36474
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
Hello João and Emacs.
This is a follow up bug to bug #36423: 27.0.50; electric-pair-mode not
working properly depending of file content.
Start the Emacs master (up to date state as of 2019-07-02T14:30 +0000)
with emacs -Q, put the following in a C++ Mode buffer and enable
electric-pair-mode:
"foo\n
. Type a " at the end of foo. electric-pair-mode wrongly inserts two
"s.
Diagnosis: electric-pair--unbalanced-strings-p works after the (single)
newly typed " has been stripped from the buffer. It attempts to
determine whether there are any open strings after the point of
insertion. It does this by using parse-partial-sexp, and checks (nth 3
<result>) as evidence of an open string.
This does not work in CC Mode, since although there is an open string
marker (with a string fence syntax-table property on it) this is
"closed" (from parse-partial-sexp's point of view) by the string fence
property on the newline at the end of the line.
electric-pair--unbalanced-strings-p thus returns the wrong result.
A more suitable algorithm might look something like this: check whether
the newly inserted " has a string fence syntax-table text property.
(Its insertion will have already triggered the before- and
after-change-functions which set this property.) If so, there is an
open string. Of course, this only applies to CC Mode modes.
--
Alan Mackenzie (Nuremberg, Germany).
[Message part 3 (message/rfc822, inline)]
The bug has been fixed in CC Mode.
On Tue, Jul 02, 2019 at 13:17:01 +0000, GNU bug Tracking System wrote:
> Thank you for filing a new bug report with debbugs.gnu.org.
> This is an automatically generated reply to let you know your message
> has been received.
> Your message is being forwarded to the package maintainers and other
> interested parties for their attention; they will reply in due course.
> Your message has been sent to the package maintainer(s):
> bug-gnu-emacs <at> gnu.org
> If you wish to submit further information on this problem, please
> send it to 36474 <at> debbugs.gnu.org.
> Please do not send mail to help-debbugs <at> gnu.org unless you wish
> to report a problem with the Bug-tracking system.
> --
> 36474: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=36474
> GNU Bug Tracking System
> Contact help-debbugs <at> gnu.org with problems
--
Alan Mackenzie (Nuremberg, Germany).
This bug report was last modified 5 years and 354 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.