emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#36474: closed (Algorithm in electric-pair--unbalan


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#36474: closed (Algorithm in electric-pair--unbalanced-strings-p unsuitable for CC Mode)
Date: Mon, 08 Jul 2019 09:37:01 +0000

Your message dated Mon, 8 Jul 2019 09:36:27 +0000
with message-id <20190708093627.GB4529@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
address@hidden.)


-- 
36474: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=36474
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: Algorithm in electric-pair--unbalanced-strings-p unsuitable for CC Mode Date: Tue, 2 Jul 2019 13:16:32 +0000 User-agent: Mutt/1.10.1 (2018-07-13)
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).



--- End Message ---
--- Begin Message --- Subject: Re: bug#36474: Acknowledgement (Algorithm in electric-pair--unbalanced-strings-p unsuitable for CC Mode) Date: Mon, 8 Jul 2019 09:36:27 +0000 User-agent: Mutt/1.10.1 (2018-07-13)
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):
>  address@hidden

> If you wish to submit further information on this problem, please
> send it to address@hidden.

> Please do not send mail to address@hidden 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 address@hidden with problems

-- 
Alan Mackenzie (Nuremberg, Germany).


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]