GNU bug report logs - #50538
[PATCH] 28.0.50; electric-pair-mode fails to pair double quotes in some cases in CC mode

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Jim Porter <jporterbugs@HIDDEN>; Keywords: patch; dated Sun, 12 Sep 2021 03:59:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 50538 <at> debbugs.gnu.org:


Received: (at 50538) by debbugs.gnu.org; 17 Sep 2021 17:08:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 17 13:08:45 2021
Received: from localhost ([127.0.0.1]:32907 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mRHLx-0005Y6-L5
	for submit <at> debbugs.gnu.org; Fri, 17 Sep 2021 13:08:45 -0400
Received: from colin.muc.de ([193.149.48.1]:55456 helo=mail.muc.de)
 by debbugs.gnu.org with smtp (Exim 4.84_2)
 (envelope-from <acm@HIDDEN>) id 1mRHLt-0005Xp-3s
 for 50538 <at> debbugs.gnu.org; Fri, 17 Sep 2021 13:08:43 -0400
Received: (qmail 32555 invoked by uid 3782); 17 Sep 2021 17:08:34 -0000
Received: from acm.muc.de (p4fe159e7.dip0.t-ipconnect.de [79.225.89.231])
 (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP;
 Fri, 17 Sep 2021 19:08:34 +0200
Received: (qmail 7811 invoked by uid 1000); 17 Sep 2021 17:08:33 -0000
Date: Fri, 17 Sep 2021 17:08:33 +0000
To: Jim Porter <jporterbugs@HIDDEN>
Subject: Re: bug#50538: [PATCH] 28.0.50; electric-pair-mode fails to pair
 double quotes in some cases in CC mode
Message-ID: <YUTLkQr79kmGLOGC@ACM>
References: <021853bf-0169-c158-ab3d-296b6c144e08@HIDDEN>
 <83r1dufgxu.fsf@HIDDEN>
 <94c7b4ec-813b-515f-d947-116c294dd74b@HIDDEN>
 <YUOt0GbHZET3sHE6@ACM>
 <456ed31d-77dc-cc2d-2fe9-8fcd379e04c6@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <456ed31d-77dc-cc2d-2fe9-8fcd379e04c6@HIDDEN>
X-Submission-Agent: TMDA/1.3.x (Ph3nix)
From: Alan Mackenzie <acm@HIDDEN>
X-Primary-Address: acm@HIDDEN
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 50538
Cc: 50538 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hello, Jim.

On Thu, Sep 16, 2021 at 14:36:06 -0700, Jim Porter wrote:
> On 9/16/2021 1:49 PM, Alan Mackenzie wrote:
> > There were two or three minor problems with the patch:

> > 1-/.  CC Mode doesn't use syntax-ppss at all.  This was because way back
> > when, syntax-ppss was buggy, and even now doesn't do the right thing for
> > CC Mode in some edge cases (e.g. with the buffer narrowed and point-min
> > inside a string or comment).  Instead it uses its own internal syntactic
> > cacheing, largely centred around the function c-semi-pp-to-literal.

> > 2/-  Rather than using get-text-property and friends directly, CC Mode
> > uses the macros c-get-char-property, etc.  This is (?was) to maintain
> > compatibility with XEmacs.

> > 3/- (A bit more serious) The patch looks for the last " in the current
> > line without taking account of any escaped new lines.  There is already
> > a CC Mode macro which does all the work here, c-point, which can be given
> > the argument 'eoll for "end of logical line".

> Thanks, I've incorporated all these changes into the attached patch. The 
> only difference between my patch and the version you provided was to 
> keep the `(search-backward "\"")' portion from my patch, since the code 
> needs to find the last double-quote, not the end of line.

Duh!  Sorry about that, I clean forgot about it.  I did say that I
hadn't tested it, though. ;-)

> As an aside, it's probably worth explaining why my patch searches for 
> the last double-quote in the first place. As far as I understand CC 
> Mode, when there's an unterminated double-quote on a line, both the 
> quote and the newline have a string fence property applied to them.

Yes.

> This means we could check the newline for that property, *but* there's
> no guarantee a newline actually exists: `(c-point 'eoll)' could
> actually point to the end of the buffer. To get around that, we search
> backwards for the last double-quote of the (logical) line, since
> that's guaranteed to exist.

Yes.  This is a very important case, the one that occurs when somebody's
typing a new file, or at the end of an existing one.

> If we wanted to, we could avoid searching backwards for the last 
> double-quote when a newline exists, but I'm not sure the gain in 
> performance (likely very small) is worth the extra code complexity.

I'm fairly sure it wouldn't be.

[ Patch snipped but read. ]

-- 
Alan Mackenzie (Nuremberg, Germany).




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#50538; Package emacs. Full text available.

Message received at 50538 <at> debbugs.gnu.org:


Received: (at 50538) by debbugs.gnu.org; 16 Sep 2021 21:36:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 16 17:36:17 2021
Received: from localhost ([127.0.0.1]:56746 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mQz3J-0008O0-7b
	for submit <at> debbugs.gnu.org; Thu, 16 Sep 2021 17:36:17 -0400
Received: from mail-pl1-f180.google.com ([209.85.214.180]:33298)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jporterbugs@HIDDEN>) id 1mQz3G-0008Nf-5t
 for 50538 <at> debbugs.gnu.org; Thu, 16 Sep 2021 17:36:15 -0400
Received: by mail-pl1-f180.google.com with SMTP id t4so4824746plo.0
 for <50538 <at> debbugs.gnu.org>; Thu, 16 Sep 2021 14:36:14 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=subject:to:cc:references:from:message-id:date:mime-version
 :in-reply-to:content-language;
 bh=GcXevKWji7YMKsLJUWZwOwiGgpQtNPT2iTGbbq6MGes=;
 b=HYdSDLyhb7bqSKYmj0BrB3uP2flag7eqPt78xodSpOzbPxSeuBc8ThTzeImYEAGNdT
 xOSU52UIdJopKFC610v2G2FNR9TtcuN6BNQwRXjBS4gvLIqQvF/XrdohI/YmLEBrAMWJ
 LShM+0+0yRBE+kwViqhLdGqsDdLHuDm0WTXZ85BT2zqsTs2w7vqSIOsI4wcV81d6qnuG
 VPrh1qeLWWW/Tlr8JWEK5MNYLu61K+yjzMZbc5/463QKkVfxvSPqO8Bjvjed1xlwAKyb
 znCeGAfmtoFKMZkGYFwvRVXfZsczZAK2JkMCkzWliCWEmI2c3DtfOkUxHqpmV7b1F0o9
 QY8A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:subject:to:cc:references:from:message-id:date
 :mime-version:in-reply-to:content-language;
 bh=GcXevKWji7YMKsLJUWZwOwiGgpQtNPT2iTGbbq6MGes=;
 b=BmB99wX1AawebtRW0+58Ib0v7637y6a39Bgr94/Iu4Kk3ItpP0j8hpqUhUkxlD8NVo
 mqAOWS+Pik+MkjUjVowEzPUtGrJde6bwUyasbwn6WBWLpXHyFuYdF/js2LWt3PvXzFnV
 TZMoGxbipotA1jVqgdiHMXUFe0J+p7A/u33IV2GRKSYwaL+c3sSKS/wEutfj10vzAdVt
 OxRhOtAWX5wmWvgcq++RyraO/7Due2aIdXNWZynajxJS2EX9wQgh0GCd2oRoNy0bA+Hi
 B14F3S6FFT0FSDAuc35pFkdln0gDxUnHOwxJ50ECqVAO6WgHSk9tkjOZRBFf4d9ZTPNQ
 UqDw==
X-Gm-Message-State: AOAM533m3CZcX/HTEpMEHUPmUO6wCGCabegKbTdgp72oz8Rkidf4UmSR
 ec1X2YTegT50j6vhKvbNWM4dL4AsKv4=
X-Google-Smtp-Source: ABdhPJxvo5QOrdXoLvsqTc+whpBj/3HXyOMnw3jW/mBlOz+F6YCOnGmdml1KneVpZzIOGYPp0hYeGg==
X-Received: by 2002:a17:902:8488:b029:129:97e8:16e7 with SMTP id
 c8-20020a1709028488b029012997e816e7mr6495109plo.39.1631828168108; 
 Thu, 16 Sep 2021 14:36:08 -0700 (PDT)
Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com.
 [76.168.148.233])
 by smtp.googlemail.com with ESMTPSA id u9sm4141015pgp.83.2021.09.16.14.36.06
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Thu, 16 Sep 2021 14:36:07 -0700 (PDT)
Subject: Re: bug#50538: [PATCH] 28.0.50; electric-pair-mode fails to pair
 double quotes in some cases in CC mode
To: Alan Mackenzie <acm@HIDDEN>
References: <021853bf-0169-c158-ab3d-296b6c144e08@HIDDEN>
 <83r1dufgxu.fsf@HIDDEN> <94c7b4ec-813b-515f-d947-116c294dd74b@HIDDEN>
 <YUOt0GbHZET3sHE6@ACM>
From: Jim Porter <jporterbugs@HIDDEN>
Message-ID: <456ed31d-77dc-cc2d-2fe9-8fcd379e04c6@HIDDEN>
Date: Thu, 16 Sep 2021 14:36:06 -0700
MIME-Version: 1.0
In-Reply-To: <YUOt0GbHZET3sHE6@ACM>
Content-Type: multipart/mixed; boundary="------------2078361F0C2C0B09047F0A56"
Content-Language: en-US
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 50538
Cc: 50538 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

This is a multi-part message in MIME format.
--------------2078361F0C2C0B09047F0A56
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit

On 9/16/2021 1:49 PM, Alan Mackenzie wrote:
> There were two or three minor problems with the patch:
> 
> 1-/.  CC Mode doesn't use syntax-ppss at all.  This was because way back
> when, syntax-ppss was buggy, and even now doesn't do the right thing for
> CC Mode in some edge cases (e.g. with the buffer narrowed and point-min
> inside a string or comment).  Instead it uses its own internal syntactic
> cacheing, largely centred around the function c-semi-pp-to-literal.
> 
> 2/-  Rather than using get-text-property and friends directly, CC Mode
> uses the macros c-get-char-property, etc.  This is (?was) to maintain
> compatibility with XEmacs.
> 
> 3/- (A bit more serious) The patch looks for the last " in the current
> line without taking account of any escaped new lines.  There is already
> a CC Mode macro which does all the work here, c-point, which can be given
> the argument 'eoll for "end of logical line".

Thanks, I've incorporated all these changes into the attached patch. The 
only difference between my patch and the version you provided was to 
keep the `(search-backward "\"")' portion from my patch, since the code 
needs to find the last double-quote, not the end of line.

As an aside, it's probably worth explaining why my patch searches for 
the last double-quote in the first place. As far as I understand CC 
Mode, when there's an unterminated double-quote on a line, both the 
quote and the newline have a string fence property applied to them. This 
means we could check the newline for that property, *but* there's no 
guarantee a newline actually exists: `(c-point 'eoll)' could actually 
point to the end of the buffer. To get around that, we search backwards 
for the last double-quote of the (logical) line, since that's guaranteed 
to exist.

If we wanted to, we could avoid searching backwards for the last 
double-quote when a newline exists, but I'm not sure the gain in 
performance (likely very small) is worth the extra code complexity.

--------------2078361F0C2C0B09047F0A56
Content-Type: text/plain; charset=UTF-8;
 name="0001-Improve-behavior-of-electric-pair-mode-in-cc-mode.patch"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename*0="0001-Improve-behavior-of-electric-pair-mode-in-cc-mode.patch"

RnJvbSA0NzU5ZWQwYzhmYTdmYThmYWZkNDdkMTY2YjNmMTI2ZTYwNmZmZTg0IE1vbiBTZXAg
MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBKaW0gUG9ydGVyIDxqcG9ydGVyYnVnc0BnbWFpbC5j
b20+CkRhdGU6IFRodSwgMTYgU2VwIDIwMjEgMTQ6MzI6MTcgLTA3MDAKU3ViamVjdDogW1BB
VENIXSBJbXByb3ZlIGJlaGF2aW9yIG9mICdlbGVjdHJpYy1wYWlyLW1vZGUnIGluICdjYy1t
b2RlJwoKVGhpcyBlbnN1cmVzIHRoYXQgcXVvdGVzIGFyZSBwYWlyZWQgY29ycmVjdGx5IHdp
dGhpbiBjb21tZW50cywgYWxsb3dzIGZvcgppbnNlcnRpb24gb2YgcXVvdGUgcGFpcnMgaW1t
ZWRpYXRlbHkgYmVmb3JlIGFub3RoZXIgcXVvdGUsIGFuZCBhbGxvd3MKaW5zZXJ0aW5nIHF1
b3RlIHBhaXJzIHdpdGhpbiBhIHN0cmluZyAodGh1cyBzcGxpdHRpbmcgdGhlIHN0cmluZyBp
biB0d28pLgoKKiBsaXNwL3Byb2dtb2Rlcy9jYy1tb2RlLmVsIChjLWVsZWN0cmljLXBhaXIt
aW5oaWJpdC1wcmVkaWNhdGUpOgpJbmhpYml0IGluc2VydGlvbiBvZiBwYWlyZWQgcXVv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KSkKICAg
ICAgICAgKHNhdmVkLWxheW91dCAoaWYgZWxlY3RyaWMtbGF5b3V0LW1vZGUgMSAtMSkpCkBA
IC0xNzMsNyArMTc2LDcgQEAgZGVmaW5lLWVsZWN0cmljLXBhaXItdGVzdAogICAgICAgICAg
IGV4cGVjdGVkLXN0cmluZwogICAgICAgICAgIGV4cGVjdGVkLXBvaW50CiAgICAgICAgICAg
YmluZGluZ3MKLSAgICAgICAgICAobW9kZXMgJyhxdW90ZSAocnVieS1tb2RlIGpzLW1vZGUp
KSkKKyAgICAgICAgICAobW9kZXMgJyhxdW90ZSAocnVieS1tb2RlIGpzLW1vZGUgYy1tb2Rl
KSkpCiAgICAgICAgICAgKHRlc3QtaW4tY29tbWVudHMgdCkKICAgICAgICAgICAodGVzdC1p
bi1zdHJpbmdzIHQpCiAgICAgICAgICAgKHRlc3QtaW4tY29kZSB0KQotLSAKMi4yNS4xCgo=
--------------2078361F0C2C0B09047F0A56--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#50538; Package emacs. Full text available.

Message received at 50538 <at> debbugs.gnu.org:


Received: (at 50538) by debbugs.gnu.org; 16 Sep 2021 20:51:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 16 16:51:25 2021
Received: from localhost ([127.0.0.1]:56717 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mQyLs-00074z-SJ
	for submit <at> debbugs.gnu.org; Thu, 16 Sep 2021 16:51:25 -0400
Received: from mail-wm1-f48.google.com ([209.85.128.48]:42989)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joaotavora@HIDDEN>) id 1mQyLq-00074h-My
 for 50538 <at> debbugs.gnu.org; Thu, 16 Sep 2021 16:51:23 -0400
Received: by mail-wm1-f48.google.com with SMTP id
 u19-20020a7bc053000000b002f8d045b2caso5466249wmc.1
 for <50538 <at> debbugs.gnu.org>; Thu, 16 Sep 2021 13:51:22 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version:content-transfer-encoding;
 bh=FtmTkl6EjiY8YyXCrD0hRCU7wOdw2Zj0cbggJeuvwkE=;
 b=MNUseeuD4vFvH8/0SbfXS8Ak4fdnEoKKv1UELhiA93z6Fc0edDEbrAYh0IReIBiSJE
 iqTmFzNF37L4SGdp1VoauERN8Jr/+kH4LMOACNP825nco2DsX7WFnqSq7u+UCOIm0naW
 4+CTte/wARd9M9R6VC4X+3ERp6szIK6yqq7WqwUCSj4uzRwzRi4t91UwBpiew2gyEvsE
 3Pb50Yx1Bh//2bJ39MfI46FaAs8bP8Zavmp/QmiEOwlan/3UOlpnHQcEQ+yUeFqgNIT9
 lYN9X8OIIvl4+IwPZwEcoxmet3jXWkeoQI0Q886nP6bBZmM2IsYMJT1mOJmY8hvYNH2f
 AVGg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version:content-transfer-encoding;
 bh=FtmTkl6EjiY8YyXCrD0hRCU7wOdw2Zj0cbggJeuvwkE=;
 b=doeI0lQnE6CQv4rgDs9c1fgU00ZrDIVxDIF/ckaTTq4ibTjLV5uR65lMBCgOoxgg4u
 EipUfHRFisIcv0vLj51z/k0E/Tjjbl5h+j00XTO71lszDs0vj3qNdfemAo7PvTnWDSBW
 74jBiQGmK7QSul9Hl4JLRMhT6rlEfniGLFRIEjWurLmWkfSd15KRI6o4hdfTmIWGMsTx
 1xqyCpNdQlccegDA5LIcIoLQV3ujp4uxenWWy1qEjooyJ/9aRJcgykaDPmLtusKtJYnC
 k6Pz0jGJh7V5Er+yIKK6hSqsq6jtGLpufgEVQ7aaP3+uZq1mxBGXa0sldoUnsMtQ3G/o
 F+WQ==
X-Gm-Message-State: AOAM533FWRSg+KVc+v/XleMHt5tLfxGl2Vy1vOdHvmAp4oZbiyE/7wAL
 VdZ+6UXlqYMONbAKG34Sf0+H+04ud7A=
X-Google-Smtp-Source: ABdhPJwsJSXofK3u21tQ3BG8NQZ6bmH1ZZub6QyuTaRHbuTrg7eK09ISo3hn8PQhw2+dKCVMT/YBJw==
X-Received: by 2002:a1c:4d7:: with SMTP id 206mr11972269wme.158.1631825476241; 
 Thu, 16 Sep 2021 13:51:16 -0700 (PDT)
Received: from krug (a83-132-177-247.cpe.netcabo.pt. [83.132.177.247])
 by smtp.gmail.com with ESMTPSA id r2sm4841063wrg.31.2021.09.16.13.51.15
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 16 Sep 2021 13:51:15 -0700 (PDT)
From: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
To: Alan Mackenzie <acm@HIDDEN>
Subject: Re: bug#50538: [PATCH] 28.0.50; electric-pair-mode fails to pair
 double quotes in some cases in CC mode
References: <021853bf-0169-c158-ab3d-296b6c144e08@HIDDEN>
 <83r1dufgxu.fsf@HIDDEN>
 <94c7b4ec-813b-515f-d947-116c294dd74b@HIDDEN>
 <716194ea-817f-eaad-f9ce-7d600ad359b1@HIDDEN>
 <83k0jh9jn6.fsf@HIDDEN> <87o88s3d87.fsf@HIDDEN>
 <feb902af-1402-8936-89ca-c37d59ed27a4@HIDDEN>
 <871r5o3biv.fsf@HIDDEN> <87fsu4h2oa.fsf@HIDDEN>
 <YUOVlH9MVbVOq4dU@ACM>
Date: Thu, 16 Sep 2021 21:51:13 +0100
In-Reply-To: <YUOVlH9MVbVOq4dU@ACM> (Alan Mackenzie's message of "Thu, 16 Sep
 2021 19:05:56 +0000")
Message-ID: <87czp8fdmm.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 50538
Cc: Jim Porter <jporterbugs@HIDDEN>, Lars Ingebrigtsen <larsi@HIDDEN>,
 Eli Zaretskii <eliz@HIDDEN>, 50538 <at> debbugs.gnu.org,
 Dmitry Gutov <dgutov@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hello Alan,

[I apologize in advance for any spelling mistakes, my spell checker has
taken a vacation in this new operating system.]

Alan Mackenzie <acm@HIDDEN> writes:

> I think it is up to both of us to make this relationship less rocky.

Agreed.  But I'm afraid I don't have much to add the discussion.  I've
made all my points.  And so have you.  I understand, though I
respectfully disagree with your standpoint.  And so do you, I hope.  I
have, in a way, given up on this integration.  electric-pair-mode
doesn't support cc-mode or any more directly derived from it
"officially".  That harmony ended in Emacs 25.x, I believe (might have
been 26.x).  After that, you may have some success with it, or you may
not.

>>        (add-hook 'c-mode-common-hook
>>                  (lambda ()
>>                    (kill-local-variable 'electric-pair-inhibit-predicate=
)))))
>
> Needless to say, my point of view with respect to the above is somewhat
> different.  Succinctly put, the minor modes electric-.... are MINOR
> modes, and are quite new.
> In particular, they interfered with CC Mode features which had existed
> for 20 years at the time.

My belief is that the term "minor" (which you so emphasize) in the name
"minor-mode" doesn't mean "less important" in any way.  In my view, it
means merely "transversal".  You've often pitched e-p-m and cc-mode
against each other in terms of their relative ages, implying a hierarchy
of importance, deference or prestige.  My belief is that this is
unproductive.  Emacs minor modes, old or new, are not less or more
important.  All other things being equal, they don't deserve less or
more care and attention than Major or "old" modes.  The only criteria to
motivate a change is technical.

> modes, and are quite new.  They were implemented in a way which
> interfered with major modes,

You mention "major modes" in the plural form, but it is fair for me to
point out that only sub-modes of the cc-mode which you command entirely
are in that set.  If I'm forgetting any others, you're welcome to
refresh my memory.

> and I can't see there was any need for this.

I hope you will first notice I didn't adjectify or make any value
judgement on the motivation, necessity or pertinence of your work in CC
mode.  Therefore, I would appreciate if you could return the courtesy.
If you can't personally "see" the need for my work or how it was
performed, that's fine.  I don't demand that you do, though I have gone
to some lengths in the past to inform you of the motivation.  But that
isn't the same as there not being a such a need, or that I worked
spuriously, gratutiously or recklessly or with the intent to interfere
with anything.  In fact, the Git log and users memory records clearly
that when e-p-m was first introduced in Emacs, it worked harmoniously
with cc-mode for a number of years until cc-mode was modified by you to
change that harmony.

Moreover, as far as I gather, electric-pair-mode is a fairly popular
minor mode, so at least some significant group of people adhere to the
same need that I saw.  Even e-p-m's now abandoned predecessor,
"autopair"[1], is still fairly popular today.  Before archiving it some
time ago, I was still seeing healthy download counts.  See also [2] for
some Emacswiki user's (not me) account of the history and relationship
between autopair, e-p-m and other autopairing solutions for Emacs.

Now, to practical matters:

* If CC-mode users agree with you about the absence of a need for such a
  thing as e-p-m, they may simply not turn it on (same goes for
  electric-layout-mode and electric-foo-mode I suppose).  I believe you
  yourself and Eli are in this group.

* If CC-mode users disagree with you, they must find some alternative to
  CC-mode that lets them confortably turn on those modes there.  My two
  self-described hacks are such alternatives.  Not ideal ones, but
  reasonably workable.

As a user, I chose the latter option.  I look forward to a different
Major mode for editing C/CC code.  That is my personal ambition as a
user.

As a developer, changing electric-pair-mode's core principles that work
harmoniously (if not downright flawlessly) for any other major mode not
based on cc-mode is not on the table.

>> On the C++/C editing-front, I am eagerly waiting for Treesitter to
>> arrive so that is it becomes possible to write a new major mode for c++
>> and c from scratch.
>
> I am also looking forward to Treesitter, though I think starting a new
> C++ Mode from scratch would not be a good use of time, and would be
> needlessly disruptive for current CC Mode users.

I certainly didn't want to imply it would be _your_ time.  I believe
what other people do with the time they generously offer us is their
business.  Certainly, I wouldn't dream of implying that the features
you're adding to cc-mode's ever-growing code base are not a good use of
your time.  Furthermore, I think Emacs is fertile in alternative ways to
solve similar problems.  I know others disagree, but I think this is a
quality.

> Could you please express your expert view?  In Jim's opening post he
> implies that:
> (i) electric-pair-mode should be active inside comments.
> (ii) In some circumstances at least, typing a " immediately in front
>   of another " causes two "s to be inserted.  Are these circumstances
>   spelt out anywhere?
> (iii) Typing a " inside a string causes two "s to be inserted, leaving
>   point between the two new adjacent strings formed.  This feature is
>   not intended to work in C++ raw strings, or other similar multi-line
>   strings in other CC Mode modes.
> Are these three features all intended in electric-pair-mode?

(i) Yes.  Much as syntax tables and C-M-f , C-M-b, C-M-u,
    etc. navigation work is comments, so does e-p-m.

(ii) As you well note, it depends on the circumstances.

     The circumstances are well spelt out in the tests.  I can name one
     here.

     If you have the buffer with contents

       "hello"

     And you type a double quote at buffer ends, you get

       "hello"""

     This example was taken from one of the tests of the group
     'pair-some-quotes-skip-others', found in electric-tests.el, as I
     think you know.

     As I think you also know, the principle of
     'electric-pair-preserve-balance' stipulates that
     'electric-pair-mode' will only make 'self-insert-command' do
     "suprising electric behaviour" -- insert two delimiters or skip one
     -- if that action helps keep or improve the balance of said
     delimiter in the buffer.

     Therefore, if you find a circumstance where e-p-m inserts two
     quotes and that happens to _worsen_ the balancing of the buffer
     (i.e. creates an unterminated string somewhere where previously
     there wasn't), then you have found a bug in e-p-m.  In that case,
     please describe it clearly as a bug report.

     However, and very importantly, you must find this circumstance in
     any major mode _other_ than cc-mode.  Because -- as I've tried to
     make clear -- "all bets are off in cc-mode", so to speak.  So if
     you are finding this misbehaviour in e-p-m _in conjunction with
     cc-mode_, I wouldn't bother reporting it.  We've established that
     the solution that I would propose to you is very likely not going
     to appeal to you.

(iii) Yes.  That is the way that e-p-m always worked.  By behaving so,
      the balancing state of the buffer is preseved.

      Some packages, (like smartparens [3], I believe) will insert a
      single quote preceded by an escape character.  That action also
      keeps the balance.

      Perhaps e-p-m could accomodate this behaviour from smartparens.
      If some users would like it, I think it can be easily done.

Best regards,
Jo=C3=A3o

[1]: https://github.com/joaotavora/autopair/
[2]: https://www.emacswiki.org/emacs/AutoPairs
[3]: https://github.com/Fuco1/smartparens




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#50538; Package emacs. Full text available.

Message received at 50538 <at> debbugs.gnu.org:


Received: (at 50538) by debbugs.gnu.org; 16 Sep 2021 20:49:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 16 16:49:36 2021
Received: from localhost ([127.0.0.1]:56713 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mQyK8-00071L-8t
	for submit <at> debbugs.gnu.org; Thu, 16 Sep 2021 16:49:36 -0400
Received: from colin.muc.de ([193.149.48.1]:23990 helo=mail.muc.de)
 by debbugs.gnu.org with smtp (Exim 4.84_2)
 (envelope-from <acm@HIDDEN>) id 1mQyJz-00070s-QZ
 for 50538 <at> debbugs.gnu.org; Thu, 16 Sep 2021 16:49:34 -0400
Received: (qmail 9023 invoked by uid 3782); 16 Sep 2021 20:49:20 -0000
Received: from acm.muc.de (p4fe15a47.dip0.t-ipconnect.de [79.225.90.71])
 (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP;
 Thu, 16 Sep 2021 22:49:20 +0200
Received: (qmail 9539 invoked by uid 1000); 16 Sep 2021 20:49:20 -0000
Date: Thu, 16 Sep 2021 20:49:20 +0000
To: Jim Porter <jporterbugs@HIDDEN>
Subject: Re: bug#50538: [PATCH] 28.0.50; electric-pair-mode fails to pair
 double quotes in some cases in CC mode
Message-ID: <YUOt0GbHZET3sHE6@ACM>
References: <021853bf-0169-c158-ab3d-296b6c144e08@HIDDEN>
 <83r1dufgxu.fsf@HIDDEN>
 <94c7b4ec-813b-515f-d947-116c294dd74b@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <94c7b4ec-813b-515f-d947-116c294dd74b@HIDDEN>
X-Submission-Agent: TMDA/1.3.x (Ph3nix)
From: Alan Mackenzie <acm@HIDDEN>
X-Primary-Address: acm@HIDDEN
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 50538
Cc: acm@HIDDEN, Eli Zaretskii <eliz@HIDDEN>, 50538 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hello, Jim.

On Sun, Sep 12, 2021 at 11:05:17 -0700, Jim Porter wrote:
> On 9/11/2021 11:26 PM, Eli Zaretskii wrote:
> >> From: Jim Porter <jporterbugs@HIDDEN>
> >> Date: Sat, 11 Sep 2021 20:58:47 -0700

> >> There are a few related issues with pairing double quotes in CC mode
> >> while using `electric-pair-mode'. Hopefully the steps to reproduce below
> >> will explain the issues. In all the cases, I'd expect
> >> `electric-pair-mode' to insert a closing quote, but it doesn't.

OK.  Just for context, I'm the maintainer of CC Mode, but I don't use
electric-pair-mode in my day-to-day editing.

> > Your expected results seem to expect Emacs to assume that a new string
> > will be inserted, but is that an assumption that is always true?

> In these cases, I believe that's true (with the default 
> `electric-pair-mode' settings, that is). More broadly, the goal of the 
> patch is to ensure that pairing of double quotes works the same in CC 
> mode as it does in other modes (`ruby-mode', `python-mode', `js-mode', 
> `emacs-lisp-mode', etc), which is why I added `c-mode' to the list of 
> modes to test in `test/lisp/electric-tests.el'.

The goal should be to make all these modes work correctly with respect
to e-p-m, for whatever value of correctly we decide upon.

> That said, there's one potential case I didn't account for (mostly 
> because it wasn't accounted for in the patch for bug#36474): if a user 
> customizes `electric-pair-inhibit-predicate' to inhibit cases like (2) 
> or (3) in my original message, that won't work right in CC modes, since 
> the default value of `electric-pair-inhibit-predicate' (set by the user) 
> won't be called.

> Attached is an updated patch that changes the logic of 
> `c-electric-pair-inhibit-predicate' to either a) inhibit insertion of 
> the closing quote, or b) call the default-value of 
> `electric-pair-inhibit-predicate' to determine what to do. This should 
> give users more consistent behavior when customizing 
> `electric-pair-inhibit-predicate'.

There were two or three minor problems with the patch:

1-/.  CC Mode doesn't use syntax-ppss at all.  This was because way back
when, syntax-ppss was buggy, and even now doesn't do the right thing for
CC Mode in some edge cases (e.g. with the buffer narrowed and point-min
inside a string or comment).  Instead it uses its own internal syntactic
cacheing, largely centred around the function c-semi-pp-to-literal.

2/-  Rather than using get-text-property and friends directly, CC Mode
uses the macros c-get-char-property, etc.  This is (?was) to maintain
compatibility with XEmacs.

3/- (A bit more serious) The patch looks for the last " in the current
line without taking account of any escaped new lines.  There is already
a CC Mode macro which does all the work here, c-point, which can be given
the argument 'eoll for "end of logical line".

Incorporating all these points into the macro (which I admit I haven't
tested) the function would look something like this:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Connection with Emacs's electric-pair-mode
(defun c-electric-pair-inhibit-predicate (char)
  "Return t to inhibit the insertion of a second copy of CHAR.

At the time of call, point is just after the newly inserted CHAR.

When CHAR is \" and not within a comment, t will be returned if
the quotes on the current line are already balanced (i.e. if the
last \" is not marked with a string fence syntax-table text
property).  For other cases, the default value of
`electric-pair-inhibit-predicate' is called and its value
returned.

This function is the appropriate value of
`electric-pair-inhibit-predicate' for CC Mode modes, which mark
invalid strings with such a syntax table text property on the
opening \" and the next unescaped end of line."
  (or (and (eq char ?\")
           (not (memq (cadr (c-semi-pp-to-literal (1- (point)))) '(c c++)))
           (not (equal (c-get-char-property (c-point 'eoll) 'c-fl-syn-tab)
                       '(15))))
      (funcall (default-value 'electric-pair-inhibit-predicate) char)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

> The tests still pass, although I wasn't able to figure out a good way to 
> add a test for setting `electric-pair-inhibit-predicate' that works with 
> how CC mode overrides it (using `:bindings' in 
> `define-electric-pair-test' didn't work, since the binding is set too 
> late). Hopefully that's ok; if not, I can try and see about making some 
> more extensive changes to the tests to account for this.

> Note however that this solution isn't perfect: it means a user's custom 
> `electric-pair-inhibit-predicate' can only inhibit *more* than CC mode's 
> default behavior, not less. I think that's a reasonable compromise 
> though, and users who want more direct control can set 
> `electric-pair-inhibit-predicate' inside `c-mode-common-hook'. A 
> "perfect" solution here would probably require adding new customization 
> points to `electric-pair-mode' (e.g. a way for major modes to override 
> how the syntax is analyzed), and I'm not sure the added complexity would 
> be worth it, especially since this code is already a bit tricky.

Indeed so.  ;-)

-- 
Alan Mackenzie (Nuremberg, Germany).




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#50538; Package emacs. Full text available.

Message received at 50538 <at> debbugs.gnu.org:


Received: (at 50538) by debbugs.gnu.org; 16 Sep 2021 19:06:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 16 15:06:08 2021
Received: from localhost ([127.0.0.1]:56579 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mQwhz-0003lV-9S
	for submit <at> debbugs.gnu.org; Thu, 16 Sep 2021 15:06:08 -0400
Received: from colin.muc.de ([193.149.48.1]:21250 helo=mail.muc.de)
 by debbugs.gnu.org with smtp (Exim 4.84_2)
 (envelope-from <acm@HIDDEN>) id 1mQwhu-0003ku-Kb
 for 50538 <at> debbugs.gnu.org; Thu, 16 Sep 2021 15:06:06 -0400
Received: (qmail 41644 invoked by uid 3782); 16 Sep 2021 19:05:56 -0000
Received: from acm.muc.de (p4fe15a47.dip0.t-ipconnect.de [79.225.90.71])
 (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP;
 Thu, 16 Sep 2021 21:05:56 +0200
Received: (qmail 9504 invoked by uid 1000); 16 Sep 2021 19:05:56 -0000
Date: Thu, 16 Sep 2021 19:05:56 +0000
To: =?iso-8859-1?Q?Jo=E3o_T=E1vora?= <joaotavora@HIDDEN>
Subject: Re: bug#50538: [PATCH] 28.0.50; electric-pair-mode fails to pair
 double quotes in some cases in CC mode
Message-ID: <YUOVlH9MVbVOq4dU@ACM>
References: <021853bf-0169-c158-ab3d-296b6c144e08@HIDDEN>
 <83r1dufgxu.fsf@HIDDEN>
 <94c7b4ec-813b-515f-d947-116c294dd74b@HIDDEN>
 <716194ea-817f-eaad-f9ce-7d600ad359b1@HIDDEN>
 <83k0jh9jn6.fsf@HIDDEN> <87o88s3d87.fsf@HIDDEN>
 <feb902af-1402-8936-89ca-c37d59ed27a4@HIDDEN>
 <871r5o3biv.fsf@HIDDEN> <87fsu4h2oa.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <87fsu4h2oa.fsf@HIDDEN>
X-Submission-Agent: TMDA/1.3.x (Ph3nix)
From: Alan Mackenzie <acm@HIDDEN>
X-Primary-Address: acm@HIDDEN
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 50538
Cc: Jim Porter <jporterbugs@HIDDEN>, Lars Ingebrigtsen <larsi@HIDDEN>,
 Eli Zaretskii <eliz@HIDDEN>, 50538 <at> debbugs.gnu.org,
 Dmitry Gutov <dgutov@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hello, Joćo.

On Thu, Sep 16, 2021 at 18:04:53 +0100, Joćo Tįvora wrote:
> Lars Ingebrigtsen <larsi@HIDDEN> writes:

> > Dmitry Gutov <dgutov@HIDDEN> writes:

> >>>> I don't use this minor mode, so I don't think my opinion on this
> >>>> matters much.  I will defer to Lars and Alan here.
> >>> I seldom use electric-pair-mode, and since this touches cc-mode, I'll
> >>> defer to Alan.:-)
> >>> Alan?

> >> At risk of reigniting an old disagreement, perhaps we should ask Joao?

> > Sure; added to the CCs.  Joćo, do you have an opinion here?

> I couldn't understand the initial issue fully, but I can only confirm
> that the relationship between cc-mode and electric-pair-mode has been
> rocky.  I think the situation is similar with electric-layout-mode and
> with electric-indent-mode, to a certain degree (though I am not sure for
> this last one).

I think it is up to both of us to make this relationship less rocky.

> I don't think there are any easy technical solutions for it. I certainly
> cannot invest the effort in any of them right now.

> It wasn't like this from the beginning: when I first created
> electric-pair-mode it worked mostly if not fully fine with cc-mode, like
> one expects e-p-m to work in other modes (ruby, python, js, elisp, rust,
> perl, even non-programming modes).

> At times, compatibility deteriorated as cc-mode added mechanisms for
> solving electricity problems or related problems in an idiosyncratic
> way.  Sometimes these changes broke e-p-m's tests and the solution was
> -- incorrectly in my view --to disable the tests "temporarily".  I see
> that for one of them at least, the test has been re-instated.  A good
> sign, maybe.  

> Regardless of history and current state of affairs, my personal solution
> to C in Emacs is to use a hand-rolled mode, a so-called plainer-cc-mode.
> The goal is to make it behave like most other modes w.r.t
> electric-pair-mode and keep the basic c syntax and indentation.  I've
> used it reasonably successfully with C and C++.  Here it is in its
> entirety.  I think I use something similar for c++-mode.

>    (define-derived-mode plainer-c-mode c-mode "pC"
>      "A plainer C-mode with no internal electric machinery."
>      (c-toggle-electric-state -1)
>      (setq-local electric-indent-local-mode-hook nil)
>      (setq-local electric-indent-mode-hook nil)
>      (electric-indent-local-mode 1)
>      (dolist (key '(?\" ?\' ?\{ ?\} ?\( ?\) ?\[ ?\]))
>        (local-set-key (vector key) 'self-insert-command)))

> Among other simpler things, this makes the major mode not bind special
> keys to special commands.  They are all bound to `self-insert-command`
> like most major modes.  This simplifies electric-pair-mode, as far as I
> remember.

> The above is a hack, but not very dirty one.  The one below much more so.
> It's a brute-force hack for solving electricity problems.  It simply
> disables some cc internal functions.  May be out of date by now, YMMV, 
> warranty void, etc, as they say.

>    (defun joaot/disable-some-cc-things ()
>      (interactive)
>      (dolist (name '(c-restore-string-fences
>                      c-remove-string-fences
>                      c-before-change-check-unbalanced-strings
>                      c-after-change-mark-abnormal-strings
>                      c-after-change-escape-NL-in-string))
>        (advice-add name :override #'ignore '((name . joaot/remove-disable-some-cc-things)))
>        (add-hook 'c-mode-common-hook
>                  (lambda ()
>                    (kill-local-variable 'electric-pair-inhibit-predicate)))))

Needless to say, my point of view with respect to the above is somewhat
different.  Succinctly put, the minor modes electric-.... are MINOR
modes, and are quite new.  They were implemented in a way which
interfered with major modes, and I can't see there was any need for
this.  In particular, they interfered with CC Mode features which had
existed for 20 years at the time.

> On the C++/C editing-front, I am eagerly waiting for Treesitter to
> arrive so that is it becomes possible to write a new major mode for c++
> and c from scratch.

I am also looking forward to Treesitter, though I think starting a new
C++ Mode from scratch would not be a good use of time, and would be
needlessly disruptive for current CC Mode users.

> Reusing solid and efficient parsing logic based on language grammars.
> Another more closely available option, is to simply use LSP for
> indentation and fontification.  Though that is almost certainly slower
> and less confortable/portable/etc... Anyway, whatever the solution,
> I'm quite confident that such a mode won't have these characteristics
> that cc-mode has when used with `electric-pair-mode`.

> If you're writing C, and not C++, my also try Stefan Monnier's aptly
> named sm-c-mode, installable via M-x package-install RET sm-c-mode.
> Works fine with electric-pair-mode, but seems to indent very oddly for
> some reason.

I would rather suggest using straight C Mode, which works and works
well.  If there are incompatibilities between CC Mode and
electric-pair-mode, and it seems there are, let's get these fixed.

> Hope this helps.  I'm sorry I can't offer any better solutions.

Could you please express your expert view?  In Jim's opening post he
implies that:
(i) electric-pair-mode should be active inside comments.
(ii) In some circumstances at least, typing a " immediately in front
  of another " causes two "s to be inserted.  Are these circumstances
  spelt out anywhere?
(iii) Typing a " inside a string causes two "s to be inserted, leaving
  point between the two new adjacent strings formed.  This feature is
  not intended to work in C++ raw strings, or other similar multi-line
  strings in other CC Mode modes.

Are these three features all intended in electric-pair-mode?

Thanks!

> Joćo

-- 
Alan Mackenzie (Nuremberg, Germany).




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#50538; Package emacs. Full text available.

Message received at 50538 <at> debbugs.gnu.org:


Received: (at 50538) by debbugs.gnu.org; 16 Sep 2021 18:26:48 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 16 14:26:47 2021
Received: from localhost ([127.0.0.1]:56527 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mQw5v-0002XD-M7
	for submit <at> debbugs.gnu.org; Thu, 16 Sep 2021 14:26:47 -0400
Received: from colin.muc.de ([193.149.48.1]:20187 helo=mail.muc.de)
 by debbugs.gnu.org with smtp (Exim 4.84_2)
 (envelope-from <acm@HIDDEN>) id 1mQw5r-0002Wr-M7
 for 50538 <at> debbugs.gnu.org; Thu, 16 Sep 2021 14:26:46 -0400
Received: (qmail 15368 invoked by uid 3782); 16 Sep 2021 18:26:36 -0000
Received: from acm.muc.de (p4fe15a47.dip0.t-ipconnect.de [79.225.90.71])
 (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP;
 Thu, 16 Sep 2021 20:26:36 +0200
Received: (qmail 9483 invoked by uid 1000); 16 Sep 2021 18:26:36 -0000
Date: Thu, 16 Sep 2021 18:26:36 +0000
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#50538: [PATCH] 28.0.50; electric-pair-mode fails to pair
 double quotes in some cases in CC mode
Message-ID: <YUOMXG7i2E9FhAqa@ACM>
References: <021853bf-0169-c158-ab3d-296b6c144e08@HIDDEN>
 <83r1dufgxu.fsf@HIDDEN>
 <94c7b4ec-813b-515f-d947-116c294dd74b@HIDDEN>
 <716194ea-817f-eaad-f9ce-7d600ad359b1@HIDDEN>
 <83k0jh9jn6.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <83k0jh9jn6.fsf@HIDDEN>
X-Submission-Agent: TMDA/1.3.x (Ph3nix)
From: Alan Mackenzie <acm@HIDDEN>
X-Primary-Address: acm@HIDDEN
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 50538
Cc: Jim Porter <jporterbugs@HIDDEN>, Lars Ingebrigtsen <larsi@HIDDEN>,
 50538 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hello, Eli.

On Thu, Sep 16, 2021 at 08:25:33 +0300, Eli Zaretskii wrote:
> > From: Jim Porter <jporterbugs@HIDDEN>
> > Cc: 50538 <at> debbugs.gnu.org
> > Date: Wed, 15 Sep 2021 15:17:23 -0700

> > On 9/11/2021 8:58 PM, Jim Porter wrote:
> >  > (Note: I've just updated my copyright assignment information, but
> >  > haven't received confirmation that everything is in order, so this might
> >  > need to wait until that's done for it to merge.)

> > I've gotten confirmation that my copyright assignment info is all 
> > up-to-date, so once this patch passes muster, it should be ok to merge it.

> Your copyright assignment is on file, so we are good in that
> department.

> > On 9/12/2021 11:05 AM, Jim Porter wrote:
> > > Note however that this solution isn't perfect: it means a user's custom 
> > > `electric-pair-inhibit-predicate' can only inhibit *more* than CC mode's 
> > > default behavior, not less. I think that's a reasonable compromise 
> > > though, and users who want more direct control can set 
> > > `electric-pair-inhibit-predicate' inside `c-mode-common-hook'. A 
> > > "perfect" solution here would probably require adding new customization 
> > > points to `electric-pair-mode' (e.g. a way for major modes to override 
> > > how the syntax is analyzed), and I'm not sure the added complexity would 
> > > be worth it, especially since this code is already a bit tricky.

> > I'm not sure if someone has a better idea for how to do things, but for 
> > my config[1], the patch works well and makes CC modes behave the same as 
> > other programming modes. In my opinion, the worst thing 
> > `electric-pair-mode' can do is to behave inconsistently, since that 
> > forces the user to pay close attention to something that should be 
> > almost invisible/automatic.

> I don't use this minor mode, so I don't think my opinion on this
> matters much.  I will defer to Lars and Alan here.

Thanks, I've downloaded the bug thread from debbugs, and I'll look at
it.  I don't actually use the minor mode either, but the patch is to do
with C++ Mode.

-- 
Alan Mackenzie (Nuremberg, Germany).




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#50538; Package emacs. Full text available.

Message received at 50538 <at> debbugs.gnu.org:


Received: (at 50538) by debbugs.gnu.org; 16 Sep 2021 17:33:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 16 13:33:45 2021
Received: from localhost ([127.0.0.1]:56479 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mQvGW-0000xd-4w
	for submit <at> debbugs.gnu.org; Thu, 16 Sep 2021 13:33:44 -0400
Received: from mail-pj1-f48.google.com ([209.85.216.48]:51171)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joaotavora@HIDDEN>) id 1mQvGK-0000xC-Jh
 for 50538 <at> debbugs.gnu.org; Thu, 16 Sep 2021 13:33:38 -0400
Received: by mail-pj1-f48.google.com with SMTP id k23so5096734pji.0
 for <50538 <at> debbugs.gnu.org>; Thu, 16 Sep 2021 10:33:28 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc:content-transfer-encoding;
 bh=tG2tePMmNduefnAziSSmvI1Rvq3RGtey3IRc275xPi4=;
 b=LIaNRd9fF6l7v85bZISUCbHlF8746o32SJYsspNcBqXgu2+LKLUUo91wZSGP/F4FFp
 oRsl1c3TDknId/dwEd9J0VulVRjCNME/YqaQE9gbiqsrkxO/BqaErKeewYQzfkscGjCB
 FvUFZ3s157+ovInyY24QokQbrL34TKGI/0HpeJAMp0OwePf5BxqPTLbEmT981RRS36Z0
 nLZid3NtiNzjT7fESw+GooleDTlf6iW7s8CgyqYD/GPemi+1LkW+VqxBbBdb/etXFCT1
 rbsC8Y56RgbsWaYGq67ohXxQ/QkHZHbB07yEN5ie7Gh8J5Zxxbv93k2XU4lz4ltGmsRL
 tveQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc:content-transfer-encoding;
 bh=tG2tePMmNduefnAziSSmvI1Rvq3RGtey3IRc275xPi4=;
 b=GsI12G4G9LyKRRiw8Ro3AJObqbp2QbOlBoAt7gdLASF9zo7W5vueTB5ec4tbGUvIs7
 1plZmvHw+sjRoyJVpz2yiTkJN0tpldGtBwF3e7gNmZqvGrhD1nUPDsgJtus7AZ75YEg0
 coBpileVmU3Y/smcX3Chr196h/3jMijtVURc2zKm8mS5Uo9NfDyO9FiQG2olIAsWc+0U
 mZmr5SpozWV4TY5lgByqpnKYmFwQINPU3HZxDCdd9ZSPbMsQTt6ym7J0hApyZB864HH0
 b3Pe+s3V5GUA1yDdAJNHZqqz6gZxCLxB5UDY4tP5lN68o+l0COsclExFlvCuWwClhf3p
 qLWw==
X-Gm-Message-State: AOAM532nnykLoUt6J6dsW70TWOHxV7VQTHJUfchH7tHNM767KXXyhtH9
 YLmb4fKAYNJ2RDHV9wgndG9iThN4/m4NfptkAe+yg30Q
X-Google-Smtp-Source: ABdhPJzK9W4FzkpEytZXW3irJsbLn8BaBGrKp6gHhYtRJC5bzQwuplziSVgsB5v7Tt38j3umjZ6aj1NqEGqP42MYe3g=
X-Received: by 2002:a17:90a:5a86:: with SMTP id n6mr7304040pji.3.1631813602821; 
 Thu, 16 Sep 2021 10:33:22 -0700 (PDT)
MIME-Version: 1.0
References: <021853bf-0169-c158-ab3d-296b6c144e08@HIDDEN>
 <83r1dufgxu.fsf@HIDDEN> <94c7b4ec-813b-515f-d947-116c294dd74b@HIDDEN>
 <716194ea-817f-eaad-f9ce-7d600ad359b1@HIDDEN> <83k0jh9jn6.fsf@HIDDEN>
 <87o88s3d87.fsf@HIDDEN> <feb902af-1402-8936-89ca-c37d59ed27a4@HIDDEN>
 <871r5o3biv.fsf@HIDDEN> <87fsu4h2oa.fsf@HIDDEN> <83wnng8mya.fsf@HIDDEN>
In-Reply-To: <83wnng8mya.fsf@HIDDEN>
From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
Date: Thu, 16 Sep 2021 18:33:12 +0100
Message-ID: <CALDnm52OZPd=oHLL1Mom9cp2jbGSu6MShg6EodF8EZ3GEPm=Yw@HIDDEN>
Subject: Re: bug#50538: [PATCH] 28.0.50; electric-pair-mode fails to pair
 double quotes in some cases in CC mode
To: Eli Zaretskii <eliz@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 50538
Cc: Jim Porter <jporterbugs@HIDDEN>, Lars Ingebrigtsen <larsi@HIDDEN>,
 Alan Mackenzie <acm@HIDDEN>, 50538 <at> debbugs.gnu.org,
 Dmitry Gutov <dgutov@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On Thu, Sep 16, 2021 at 6:11 PM Eli Zaretskii <eliz@HIDDEN> wrote:
>
> > From: Jo=C3=A3o T=C3=A1vora <joaotavora@HIDDEN>
> > Cc: Dmitry Gutov <dgutov@HIDDEN>,  Eli Zaretskii <eliz@HIDDEN>,  Ji=
m
> >  Porter <jporterbugs@HIDDEN>,  50538 <at> debbugs.gnu.org,  Alan Mackenzi=
e
> >  <acm@HIDDEN>
> > Date: Thu, 16 Sep 2021 18:04:53 +0100
> >
> > Hope this helps.  I'm sorry I can't offer any better solutions.
>
> Thanks, but I'm not sure I understand what is your opinion about the
> proposed patch.  Are you saying we shouldn't install it?

That patch targets mainly cc-mode.el.  To have an opinion would
require me to understand it, interpret its meaning. That has many
implications...  I can't do that right now.  I can confirm that the small
change to electric-tests.el (which activates many tests for c-mode) is
indeed the way I wrote those tests originally.  Maybe Jim has
found a silver bullet?

Jo=C3=A3o




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#50538; Package emacs. Full text available.

Message received at 50538 <at> debbugs.gnu.org:


Received: (at 50538) by debbugs.gnu.org; 16 Sep 2021 17:30:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 16 13:30:11 2021
Received: from localhost ([127.0.0.1]:56471 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mQvCw-0000pm-Rd
	for submit <at> debbugs.gnu.org; Thu, 16 Sep 2021 13:30:11 -0400
Received: from mail-pl1-f172.google.com ([209.85.214.172]:42921)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jporterbugs@HIDDEN>) id 1mQvCv-0000pa-Dr
 for 50538 <at> debbugs.gnu.org; Thu, 16 Sep 2021 13:29:57 -0400
Received: by mail-pl1-f172.google.com with SMTP id n4so4316976plh.9
 for <50538 <at> debbugs.gnu.org>; Thu, 16 Sep 2021 10:29:57 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=subject:to:cc:references:from:message-id:date:mime-version
 :in-reply-to:content-language:content-transfer-encoding;
 bh=aH2s5Qj8Uzmt3jvjtkGMDFigDw6RU5ABCrRvGsP4upU=;
 b=pAShIusJqnWWlZD2uC0ulYxyZpqhRhrthXZbrUzoh8vYCyXWlQKEZK6rNXAWN6tPOU
 RviMfOqkUK3qG8MWJWnLBti03byICWjSJAf5aLPKOJXU3Cqnls41OrUgTNO6zYCLcLiJ
 qDtu2z6gU+7/+vQwjYRXTWIPas5eV5yr/lm55LHuV8O7E2ZaluoqV11ERiuMC5Q+onJj
 IZl25+lMNMSKVfpzIsawpk8UL/8J+SSloSrv3Sgfs2aLOitkGh5g0iIMCfhj9aw4/Dw+
 Fljp2FS1HOysT8et+LZv4mzNp74nY9F2i0K2IkML5hjadJbgpu9NfcTVvjQzV7VvEgpl
 kBKg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:subject:to:cc:references:from:message-id:date
 :mime-version:in-reply-to:content-language:content-transfer-encoding;
 bh=aH2s5Qj8Uzmt3jvjtkGMDFigDw6RU5ABCrRvGsP4upU=;
 b=6hJ9rhp0eMlUlLfPKEbP6TURcyOuomH97gTF1dT232w5jBSXLLWPuWerleoKF1+cgR
 UMMP1mIbeXBdqrxfftKDfZKwlaJGTe8t4sYf5HTYZBqysoClHftffuEEYQ3jtoIyTlzk
 3IWx38LUR7uBDltJVmvf5Ga4zFXa2ygLO9I2RF/ynB5ggQRmoApQYUuFr34dzSydElQN
 Za/Crk5inojN/rGp6OkZIjJ6sD+2P/Tm25VEvjSipmVnpUn+ScKwU5G0nLo3iNPkooFB
 oxR1ZOMQ0if48gt4wO78BPDc9WOugvd4Nc01JrevJX5IP5ogDc/wia3MieN8t2OfEBNE
 uEgA==
X-Gm-Message-State: AOAM531tFskRDMMOac0BQ7KNNB3c1bH5Kn5PakjtIl3XzC4D3wV/6rMw
 ii8iAZPLhgjxalzOgHK0e0k=
X-Google-Smtp-Source: ABdhPJwI6+XJMEplh1RIhf78y9mbqr5lkhal1H+L6xzYFhFan6E4cHABZxLIzO+3/4SCuEPeGs4m2Q==
X-Received: by 2002:a17:90a:de0f:: with SMTP id
 m15mr7523589pjv.114.1631813386933; 
 Thu, 16 Sep 2021 10:29:46 -0700 (PDT)
Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com.
 [76.168.148.233])
 by smtp.googlemail.com with ESMTPSA id e16sm3679275pfc.214.2021.09.16.10.29.45
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Thu, 16 Sep 2021 10:29:46 -0700 (PDT)
Subject: Re: bug#50538: [PATCH] 28.0.50; electric-pair-mode fails to pair
 double quotes in some cases in CC mode
To: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>,
 Lars Ingebrigtsen <larsi@HIDDEN>
References: <021853bf-0169-c158-ab3d-296b6c144e08@HIDDEN>
 <83r1dufgxu.fsf@HIDDEN> <94c7b4ec-813b-515f-d947-116c294dd74b@HIDDEN>
 <716194ea-817f-eaad-f9ce-7d600ad359b1@HIDDEN> <83k0jh9jn6.fsf@HIDDEN>
 <87o88s3d87.fsf@HIDDEN> <feb902af-1402-8936-89ca-c37d59ed27a4@HIDDEN>
 <871r5o3biv.fsf@HIDDEN> <87fsu4h2oa.fsf@HIDDEN>
From: Jim Porter <jporterbugs@HIDDEN>
Message-ID: <16202af0-9d66-1996-8756-b3d0ff28ac9a@HIDDEN>
Date: Thu, 16 Sep 2021 10:29:47 -0700
MIME-Version: 1.0
In-Reply-To: <87fsu4h2oa.fsf@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 50538
Cc: Alan Mackenzie <acm@HIDDEN>, 50538 <at> debbugs.gnu.org,
 Dmitry Gutov <dgutov@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On 9/16/2021 10:04 AM, JoĆ£o TĆ”vora wrote:
> 
> I couldn't understand the initial issue fully, but I can only confirm
> that the relationship between cc-mode and electric-pair-mode has been
> rocky.  I think the situation is similar with electric-layout-mode and
> with electric-indent-mode, to a certain degree (though I am not sure for
> this last one).

Hopefully the following summary will help. My patch is essentially an 
enhancement of the patch from bug#36474. In that bug, Alan Mackenzie 
describes the problem:

> 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.

The fix in that bug was to check if the just-inserted double-quote "is 
marked with a string fence syntax-table text property". That fixes the 
issue described in bug#36474, but it's not quite the right logic. CC 
Mode gives the *last* double-quote on a line the string fence property 
if a line has unbalanced quotes. Thus, the patch changes the behavior to 
check the last double-quote on the line, rather than the just-inserted 
double-quote.

The patch makes one other improvement as well: it doesn't check for the 
string fence property on a double-quote inside a comment. CC Mode 
doesn't apply string fence properties there, since it's not necessary. 
Therefore, inside a comment, `c-electric-pair-inhibit-predicate' just 
defers to the default value of `electric-pair-inhibit-predicate'.

As I mentioned earlier in the thread, this isn't quite perfect behavior, 
but it significantly improves the common case (`electric-pair-mode' with 
default or "default-like" settings). CC Mode's practice of closing 
strings at the end of a line - even without a closing quote - just 
doesn't play nicely with `electric-pair-mode', so barring some major 
changes to either CC Mode or `electric-pair-mode', I can't think of a 
way to improve this patch beyond where it's at now.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#50538; Package emacs. Full text available.

Message received at 50538 <at> debbugs.gnu.org:


Received: (at 50538) by debbugs.gnu.org; 16 Sep 2021 17:11:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 16 13:11:58 2021
Received: from localhost ([127.0.0.1]:56446 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mQuvW-0000Jw-Ax
	for submit <at> debbugs.gnu.org; Thu, 16 Sep 2021 13:11:58 -0400
Received: from eggs.gnu.org ([209.51.188.92]:48276)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1mQuvT-0000Je-6w
 for 50538 <at> debbugs.gnu.org; Thu, 16 Sep 2021 13:11:56 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:58552)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1mQuvM-0003hz-Sw; Thu, 16 Sep 2021 13:11:48 -0400
Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:3894
 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1mQuvM-0007yb-F5; Thu, 16 Sep 2021 13:11:48 -0400
Date: Thu, 16 Sep 2021 20:11:41 +0300
Message-Id: <83wnng8mya.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
In-Reply-To: <87fsu4h2oa.fsf@HIDDEN> (message from =?utf-8?B?Sm/Do28g?=
 =?utf-8?B?VMOhdm9yYQ==?= on Thu, 16 Sep 2021 18:04:53 +0100)
Subject: Re: bug#50538: [PATCH] 28.0.50; electric-pair-mode fails to pair
 double quotes in some cases in CC mode
References: <021853bf-0169-c158-ab3d-296b6c144e08@HIDDEN>
 <83r1dufgxu.fsf@HIDDEN>
 <94c7b4ec-813b-515f-d947-116c294dd74b@HIDDEN>
 <716194ea-817f-eaad-f9ce-7d600ad359b1@HIDDEN>
 <83k0jh9jn6.fsf@HIDDEN> <87o88s3d87.fsf@HIDDEN>
 <feb902af-1402-8936-89ca-c37d59ed27a4@HIDDEN>
 <871r5o3biv.fsf@HIDDEN> <87fsu4h2oa.fsf@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 50538
Cc: jporterbugs@HIDDEN, larsi@HIDDEN, acm@HIDDEN, 50538 <at> debbugs.gnu.org,
 dgutov@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: JoĆ£o TĆ”vora <joaotavora@HIDDEN>
> Cc: Dmitry Gutov <dgutov@HIDDEN>,  Eli Zaretskii <eliz@HIDDEN>,  Jim
>  Porter <jporterbugs@HIDDEN>,  50538 <at> debbugs.gnu.org,  Alan Mackenzie
>  <acm@HIDDEN>
> Date: Thu, 16 Sep 2021 18:04:53 +0100
> 
> Hope this helps.  I'm sorry I can't offer any better solutions.

Thanks, but I'm not sure I understand what is your opinion about the
proposed patch.  Are you saying we shouldn't install it?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#50538; Package emacs. Full text available.

Message received at 50538 <at> debbugs.gnu.org:


Received: (at 50538) by debbugs.gnu.org; 16 Sep 2021 17:05:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 16 13:05:05 2021
Received: from localhost ([127.0.0.1]:56442 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mQuor-00008W-Bj
	for submit <at> debbugs.gnu.org; Thu, 16 Sep 2021 13:05:05 -0400
Received: from mail-wr1-f51.google.com ([209.85.221.51]:33384)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joaotavora@HIDDEN>) id 1mQuon-00007s-2r
 for 50538 <at> debbugs.gnu.org; Thu, 16 Sep 2021 13:05:04 -0400
Received: by mail-wr1-f51.google.com with SMTP id t18so10683562wrb.0
 for <50538 <at> debbugs.gnu.org>; Thu, 16 Sep 2021 10:05:01 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version:content-transfer-encoding;
 bh=gFletwjxuVROGSbGzV6dxZu7RNhAemLD/sBAnVs9FGs=;
 b=H5rQbLGbSo+NAv24OoNTVI29VAA8DAJR5CvL156RpsI4yVFVaehRs/MTV7HOlCZ4Gb
 9cMU458uHUfzOFwOggjto6Jpnw9zzWRE7qoGeyko0W62DsZ51KpFFl4baU5ExgVwlSA1
 UHCdsElZr8qS/W8htyW7Ez3yDBjnvGLEzB21Vtg7dtVsY8qBepZpQ7hIcIQLlDuvyrOB
 HYDYlJMzPMh5V5mTgscU3j7/lVCA2Xm669/fADTXmA4geCqAdHKNkqLfsFLmmXR+2xbQ
 KFJ5hi2o8LaGcwrr6GzQgAgPjsmvAb6CXN0ecBZPmweogmoavlgo3pUsSu7JBmVwn9FV
 +N7w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version:content-transfer-encoding;
 bh=gFletwjxuVROGSbGzV6dxZu7RNhAemLD/sBAnVs9FGs=;
 b=XtHWaGn+RTxKZoTggoyd9j9R0mZ7WJ3MKlSPYJ+eeWwwTuqzOShTY2BLrXyxSDag7U
 xO6kN9AwSM705DfTxhbIpT/8SVFQmx6mJxL1UjqMozsIBn3nVPHt+sapRPe7PJfNsp9d
 GRV1UyWuDCB7jtZopKyfCeQ95+Lc9yEJeY6lC/0Px2/ylRACXJ+9yoA5V1AtWhq8eI9x
 9OE3uzKIPEdjYTMCYVsvJtVTpIRMN/ZmCKI72DeyrJ3u1xyMlrFHwdyUHDIm4ibixYw3
 bUCoB+2cXnSNqJ+qPAfOeL3whWDtBFeJRwJwIutw0E6V1GHDnt/h19wBqbj8QXjOlLxL
 pEYw==
X-Gm-Message-State: AOAM530l1VQzx/nWHrI/OodzLPVwco32Jafhft6Kif0duDGm6vNF/KX9
 qVi9Be7z3aLvLab710Qyoxo=
X-Google-Smtp-Source: ABdhPJwhbXZeMhqMTTU6vWYSy0ClYTGTTfxDW8wx/ipqdRnAIn78H703orz/bJhA+qE3Sp0cE866yw==
X-Received: by 2002:a05:6000:181:: with SMTP id
 p1mr7473117wrx.247.1631811895203; 
 Thu, 16 Sep 2021 10:04:55 -0700 (PDT)
Received: from krug ([62.48.174.238])
 by smtp.gmail.com with ESMTPSA id q19sm8193343wmq.29.2021.09.16.10.04.54
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 16 Sep 2021 10:04:54 -0700 (PDT)
From: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: Re: bug#50538: [PATCH] 28.0.50; electric-pair-mode fails to pair
 double quotes in some cases in CC mode
References: <021853bf-0169-c158-ab3d-296b6c144e08@HIDDEN>
 <83r1dufgxu.fsf@HIDDEN>
 <94c7b4ec-813b-515f-d947-116c294dd74b@HIDDEN>
 <716194ea-817f-eaad-f9ce-7d600ad359b1@HIDDEN>
 <83k0jh9jn6.fsf@HIDDEN> <87o88s3d87.fsf@HIDDEN>
 <feb902af-1402-8936-89ca-c37d59ed27a4@HIDDEN>
 <871r5o3biv.fsf@HIDDEN>
Date: Thu, 16 Sep 2021 18:04:53 +0100
In-Reply-To: <871r5o3biv.fsf@HIDDEN> (Lars Ingebrigtsen's message of "Thu,
 16 Sep 2021 15:17:28 +0200")
Message-ID: <87fsu4h2oa.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 50538
Cc: Jim Porter <jporterbugs@HIDDEN>, Eli Zaretskii <eliz@HIDDEN>,
 Alan Mackenzie <acm@HIDDEN>, 50538 <at> debbugs.gnu.org,
 Dmitry Gutov <dgutov@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Lars Ingebrigtsen <larsi@HIDDEN> writes:

> Dmitry Gutov <dgutov@HIDDEN> writes:
>
>>>> I don't use this minor mode, so I don't think my opinion on this
>>>> matters much.  I will defer to Lars and Alan here.
>>> I seldom use electric-pair-mode, and since this touches cc-mode, I'll
>>> defer to Alan.:-)
>>> Alan?
>>
>> At risk of reigniting an old disagreement, perhaps we should ask Joao?
>
> Sure; added to the CCs.  Jo=C3=A3o, do you have an opinion here?

I couldn't understand the initial issue fully, but I can only confirm
that the relationship between cc-mode and electric-pair-mode has been
rocky.  I think the situation is similar with electric-layout-mode and
with electric-indent-mode, to a certain degree (though I am not sure for
this last one).

I don't think there are any easy technical solutions for it. I certainly
cannot invest the effort in any of them right now.

It wasn't like this from the beginning: when I first created
electric-pair-mode it worked mostly if not fully fine with cc-mode, like
one expects e-p-m to work in other modes (ruby, python, js, elisp, rust,
perl, even non-programming modes).

At times, compatibility deteriorated as cc-mode added mechanisms for
solving electricity problems or related problems in an idiosyncratic
way.  Sometimes these changes broke e-p-m's tests and the solution was
-- incorrectly in my view --to disable the tests "temporarily".  I see
that for one of them at least, the test has been re-instated.  A good
sign, maybe.=20=20

Regardless of history and current state of affairs, my personal solution
to C in Emacs is to use a hand-rolled mode, a so-called plainer-cc-mode.
The goal is to make it behave like most other modes w.r.t
electric-pair-mode and keep the basic c syntax and indentation.  I've
used it reasonably successfully with C and C++.  Here it is in its
entirety.  I think I use something similar for c++-mode.

   (define-derived-mode plainer-c-mode c-mode "pC"
     "A plainer C-mode with no internal electric machinery."
     (c-toggle-electric-state -1)
     (setq-local electric-indent-local-mode-hook nil)
     (setq-local electric-indent-mode-hook nil)
     (electric-indent-local-mode 1)
     (dolist (key '(?\" ?\' ?\{ ?\} ?\( ?\) ?\[ ?\]))
       (local-set-key (vector key) 'self-insert-command)))

Among other simpler things, this makes the major mode not bind special
keys to special commands.  They are all bound to `self-insert-command`
like most major modes.  This simplifies electric-pair-mode, as far as I
remember.

The above is a hack, but not very dirty one.  The one below much more so.
It's a brute-force hack for solving electricity problems.  It simply
disables some cc internal functions.  May be out of date by now, YMMV,=20
warranty void, etc, as they say.

   (defun joaot/disable-some-cc-things ()
     (interactive)
     (dolist (name '(c-restore-string-fences
                     c-remove-string-fences
                     c-before-change-check-unbalanced-strings
                     c-after-change-mark-abnormal-strings
                     c-after-change-escape-NL-in-string))
       (advice-add name :override #'ignore '((name . joaot/remove-disable-s=
ome-cc-things)))
       (add-hook 'c-mode-common-hook
                 (lambda ()
                   (kill-local-variable 'electric-pair-inhibit-predicate)))=
))

On the C++/C editing-front, I am eagerly waiting for Treesitter to
arrive so that is it becomes possible to write a new major mode for c++
and c from scratch.  Reusing solid and efficient parsing logic based on
language grammars.  Another more closely available option, is to simply
use LSP for indentation and fontification.  Though that is almost
certainly slower and less confortable/portable/etc... Anyway, whatever
the solution, I'm quite confident that such a mode won't have these
characteristics that cc-mode has when used with `electric-pair-mode`.

If you're writing C, and not C++, my also try Stefan Monnier's aptly
named sm-c-mode, installable via M-x package-install RET sm-c-mode.
Works fine with electric-pair-mode, but seems to indent very oddly for
some reason.

Hope this helps.  I'm sorry I can't offer any better solutions.

Jo=C3=A3o




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#50538; Package emacs. Full text available.

Message received at 50538 <at> debbugs.gnu.org:


Received: (at 50538) by debbugs.gnu.org; 16 Sep 2021 13:17:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 16 09:17:41 2021
Received: from localhost ([127.0.0.1]:54122 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mQrGn-0007yt-4g
	for submit <at> debbugs.gnu.org; Thu, 16 Sep 2021 09:17:41 -0400
Received: from quimby.gnus.org ([95.216.78.240]:36338)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1mQrGk-0007yg-Cg
 for 50538 <at> debbugs.gnu.org; Thu, 16 Sep 2021 09:17:40 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID
 :In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe:
 List-Post:List-Owner:List-Archive;
 bh=ijj0muWjpKfMFpzIp3NVJ7rkaPU/lFqQb1E+b+JbRAw=; b=USs8TV1GJDqAMqzOtJcsogXjdg
 PBhiDJ1KowloRNq6DMCeu415FdGzEATKLt8K7U7knyRnJ8IduA2zGKFcsZR26UhwppgX4u7+oeqUQ
 Kbu15jQ/QbRihyNfd7R2lNasTNF97GULbq2LlYOeltHunDPyaJ6zKEgPoJsrhR+BFUOc=;
Received: from [84.212.220.105] (helo=elva)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1mQrGa-0003uw-Jd; Thu, 16 Sep 2021 15:17:31 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Dmitry Gutov <dgutov@HIDDEN>
Subject: Re: bug#50538: [PATCH] 28.0.50; electric-pair-mode fails to pair
 double quotes in some cases in CC mode
References: <021853bf-0169-c158-ab3d-296b6c144e08@HIDDEN>
 <83r1dufgxu.fsf@HIDDEN>
 <94c7b4ec-813b-515f-d947-116c294dd74b@HIDDEN>
 <716194ea-817f-eaad-f9ce-7d600ad359b1@HIDDEN>
 <83k0jh9jn6.fsf@HIDDEN> <87o88s3d87.fsf@HIDDEN>
 <feb902af-1402-8936-89ca-c37d59ed27a4@HIDDEN>
Date: Thu, 16 Sep 2021 15:17:28 +0200
In-Reply-To: <feb902af-1402-8936-89ca-c37d59ed27a4@HIDDEN> (Dmitry Gutov's
 message of "Thu, 16 Sep 2021 15:59:11 +0300")
Message-ID: <871r5o3biv.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Dmitry Gutov <dgutov@HIDDEN> writes: >>> I don't use this
 minor mode, so I don't think my opinion on this >>> matters much. I will
 defer to Lars and Alan here. >> I seldom use electric-pair-mode, and since
 this touches cc-mode, I'll >> d [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 50538
Cc: Jim Porter <jporterbugs@HIDDEN>, Eli Zaretskii <eliz@HIDDEN>,
 =?utf-8?B?Sm/Do28g?= =?utf-8?B?VMOhdm9yYQ==?= <joaotavora@HIDDEN>,
 50538 <at> debbugs.gnu.org, Alan Mackenzie <acm@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Dmitry Gutov <dgutov@HIDDEN> writes:

>>> I don't use this minor mode, so I don't think my opinion on this
>>> matters much.  I will defer to Lars and Alan here.
>> I seldom use electric-pair-mode, and since this touches cc-mode, I'll
>> defer to Alan.:-)
>> Alan?
>
> At risk of reigniting an old disagreement, perhaps we should ask Joao?

Sure; added to the CCs.  Jo=C3=A3o, do you have an opinion here?

--=20
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#50538; Package emacs. Full text available.

Message received at 50538 <at> debbugs.gnu.org:


Received: (at 50538) by debbugs.gnu.org; 16 Sep 2021 12:59:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 16 08:59:26 2021
Received: from localhost ([127.0.0.1]:54114 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mQqz8-0007XD-MD
	for submit <at> debbugs.gnu.org; Thu, 16 Sep 2021 08:59:26 -0400
Received: from mail-wm1-f50.google.com ([209.85.128.50]:51013)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raaahh@HIDDEN>) id 1mQqz3-0007Wx-Ff
 for 50538 <at> debbugs.gnu.org; Thu, 16 Sep 2021 08:59:26 -0400
Received: by mail-wm1-f50.google.com with SMTP id 140so4794467wma.0
 for <50538 <at> debbugs.gnu.org>; Thu, 16 Sep 2021 05:59:21 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=sender:subject:to:cc:references:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-language:content-transfer-encoding;
 bh=dkTuLNkk4yvPuYJWSTXLwV4dlLKkF7e4AdoHFMJl8kY=;
 b=oxijiDmIhmU4aKeRK1JX9RMHGY5paJcCJA3OCEgyIpOyfU77URIu+QmCTrKq5RH66X
 gegoZLOOveQ/F/PCZUIE1gofFUwMtOu7a34E2uCFfKqQPlOX1GRY3Wad7KyrqHVQDqIB
 3qrSSiy/4RmaLS5hVHMtkw8M1uV3fr6wlA3C2+2+y8BGGuLizffDO9FXYyB/htQIFMfI
 t9kyBz+ZbsZWk8vNZcODhGmFbfL6wuKrKcr/bHy2EJt9P4YndWs8rFRXrfTuGMYXfF49
 PUT+jF6ge4ZtG4atXRLbdsOHC0HSQvM9MmiQP4qe0kggxAxCOGN/gAQG4LtdyYJU2EiV
 KnyQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:sender:subject:to:cc:references:from:message-id
 :date:user-agent:mime-version:in-reply-to:content-language
 :content-transfer-encoding;
 bh=dkTuLNkk4yvPuYJWSTXLwV4dlLKkF7e4AdoHFMJl8kY=;
 b=TrIvO26hoY83DPg/CntglWEmzBsILoGqSV2v3NKB7FECG/38dRep8vhuJuDa6oiJPB
 G0Va1FC+PSXcQuMlIM1Rq9wt8r7ANBkHfqkqkDEQqEfoV1+a4WnAzMBi0pdQQJ1U7aJL
 heQik119WkgmQI/KoVH95gwgyGKQQeV6CzRR3RFToA08B/29MGIDDHPL+vDR78ReBD0/
 8ReQHuDE6fXzJo2ZM4Buh1y/qe3N3mTDJlyd2FK+3Ube2hVTtHLTdWOsclZ9yjNlCDqy
 Sa83mCfZyLFcatcaIGc64mVSwXNIBAKoqN6UKYP6hgqIRN7Z4dAwWs8dAyfhUEWYu12U
 njdg==
X-Gm-Message-State: AOAM532ptMjA/3L9K5pJXpA64PyOaBp83zEIVo/EFofrapZ7PU3P3XAH
 sbQ2Ql78y88Mx2RU6ww8qg4=
X-Google-Smtp-Source: ABdhPJxqFwqhGwx0zFsaYNF9mbnBg9M5OZHul4xZTe17JpwCJ8FS1J/myk8GYhDddsr6/vOf4YTokQ==
X-Received: by 2002:a1c:ac07:: with SMTP id v7mr9528359wme.160.1631797155636; 
 Thu, 16 Sep 2021 05:59:15 -0700 (PDT)
Received: from [192.168.0.6] ([46.251.119.176])
 by smtp.googlemail.com with ESMTPSA id l26sm7386217wmi.25.2021.09.16.05.59.13
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Thu, 16 Sep 2021 05:59:15 -0700 (PDT)
Subject: Re: bug#50538: [PATCH] 28.0.50; electric-pair-mode fails to pair
 double quotes in some cases in CC mode
To: Lars Ingebrigtsen <larsi@HIDDEN>, Eli Zaretskii <eliz@HIDDEN>
References: <021853bf-0169-c158-ab3d-296b6c144e08@HIDDEN>
 <83r1dufgxu.fsf@HIDDEN> <94c7b4ec-813b-515f-d947-116c294dd74b@HIDDEN>
 <716194ea-817f-eaad-f9ce-7d600ad359b1@HIDDEN> <83k0jh9jn6.fsf@HIDDEN>
 <87o88s3d87.fsf@HIDDEN>
From: Dmitry Gutov <dgutov@HIDDEN>
Message-ID: <feb902af-1402-8936-89ca-c37d59ed27a4@HIDDEN>
Date: Thu, 16 Sep 2021 15:59:11 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
 Thunderbird/78.13.0
MIME-Version: 1.0
In-Reply-To: <87o88s3d87.fsf@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.4 (/)
X-Debbugs-Envelope-To: 50538
Cc: Jim Porter <jporterbugs@HIDDEN>, 50538 <at> debbugs.gnu.org,
 Alan Mackenzie <acm@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.6 (/)

On 16.09.2021 15:40, Lars Ingebrigtsen wrote:
> Eli Zaretskii<eliz@HIDDEN>  writes:
> 
>> I don't use this minor mode, so I don't think my opinion on this
>> matters much.  I will defer to Lars and Alan here.
> I seldom use electric-pair-mode, and since this touches cc-mode, I'll
> defer to Alan.:-)
> 
> Alan?

At risk of reigniting an old disagreement, perhaps we should ask Joao?

IIUC, Alan doesn't really use electric-pair-mode.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#50538; Package emacs. Full text available.

Message received at 50538 <at> debbugs.gnu.org:


Received: (at 50538) by debbugs.gnu.org; 16 Sep 2021 12:40:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 16 08:40:54 2021
Received: from localhost ([127.0.0.1]:54071 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mQqhB-0004rf-Qw
	for submit <at> debbugs.gnu.org; Thu, 16 Sep 2021 08:40:54 -0400
Received: from quimby.gnus.org ([95.216.78.240]:35340)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1mQqh9-0004rR-KG
 for 50538 <at> debbugs.gnu.org; Thu, 16 Sep 2021 08:40:52 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=UsBIt2ysL6sxCEXypOVgBS4EtuDzNagyU05UmmV1/Uc=; b=q77eQ8CcMmp+St3SFi698GycSA
 AMGgqqOWanSN5b4Aeqo5B4YCM7OrRZJ/zmgKRW/6p1F84RD7P7dRUMziMMwg8x7qRWt9BwN3KxADW
 4YdSF1PXaUopzkzxXeFdXcwqxxbbZyKsaalS7q/EYikAuKBx3/ig4GWBzw2f65fl3j5Y=;
Received: from [84.212.220.105] (helo=elva)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1mQqgz-0002hE-EQ; Thu, 16 Sep 2021 14:40:44 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#50538: [PATCH] 28.0.50; electric-pair-mode fails to pair
 double quotes in some cases in CC mode
References: <021853bf-0169-c158-ab3d-296b6c144e08@HIDDEN>
 <83r1dufgxu.fsf@HIDDEN>
 <94c7b4ec-813b-515f-d947-116c294dd74b@HIDDEN>
 <716194ea-817f-eaad-f9ce-7d600ad359b1@HIDDEN>
 <83k0jh9jn6.fsf@HIDDEN>
Date: Thu, 16 Sep 2021 14:40:40 +0200
In-Reply-To: <83k0jh9jn6.fsf@HIDDEN> (Eli Zaretskii's message of "Thu, 16 Sep
 2021 08:25:33 +0300")
Message-ID: <87o88s3d87.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Eli Zaretskii <eliz@HIDDEN> writes: > I don't use this minor
 mode, so I don't think my opinion on this > matters much. I will defer to
 Lars and Alan here. I seldom use electric-pair-mode, and since this touches
 cc-mode, I'll defer to Alan. :-) 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 50538
Cc: Jim Porter <jporterbugs@HIDDEN>, 50538 <at> debbugs.gnu.org,
 Alan Mackenzie <acm@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Eli Zaretskii <eliz@HIDDEN> writes:

> I don't use this minor mode, so I don't think my opinion on this
> matters much.  I will defer to Lars and Alan here.

I seldom use electric-pair-mode, and since this touches cc-mode, I'll
defer to Alan.  :-)

Alan?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#50538; Package emacs. Full text available.

Message received at 50538 <at> debbugs.gnu.org:


Received: (at 50538) by debbugs.gnu.org; 16 Sep 2021 05:25:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 16 01:25:43 2021
Received: from localhost ([127.0.0.1]:53598 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mQju3-0005vC-E5
	for submit <at> debbugs.gnu.org; Thu, 16 Sep 2021 01:25:43 -0400
Received: from eggs.gnu.org ([209.51.188.92]:57504)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1mQju0-0005uy-2v
 for 50538 <at> debbugs.gnu.org; Thu, 16 Sep 2021 01:25:42 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:40044)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1mQjtt-0005Ly-Ad; Thu, 16 Sep 2021 01:25:34 -0400
Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:3821
 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1mQjts-0001se-Ua; Thu, 16 Sep 2021 01:25:33 -0400
Date: Thu, 16 Sep 2021 08:25:33 +0300
Message-Id: <83k0jh9jn6.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Jim Porter <jporterbugs@HIDDEN>,
 Lars Ingebrigtsen <larsi@HIDDEN>, Alan Mackenzie <acm@HIDDEN>
In-Reply-To: <716194ea-817f-eaad-f9ce-7d600ad359b1@HIDDEN> (message from
 Jim Porter on Wed, 15 Sep 2021 15:17:23 -0700)
Subject: Re: bug#50538: [PATCH] 28.0.50; electric-pair-mode fails to pair
 double quotes in some cases in CC mode
References: <021853bf-0169-c158-ab3d-296b6c144e08@HIDDEN>
 <83r1dufgxu.fsf@HIDDEN> <94c7b4ec-813b-515f-d947-116c294dd74b@HIDDEN>
 <716194ea-817f-eaad-f9ce-7d600ad359b1@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 50538
Cc: 50538 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Jim Porter <jporterbugs@HIDDEN>
> Cc: 50538 <at> debbugs.gnu.org
> Date: Wed, 15 Sep 2021 15:17:23 -0700
> 
> On 9/11/2021 8:58 PM, Jim Porter wrote:
>  > (Note: I've just updated my copyright assignment information, but
>  > haven't received confirmation that everything is in order, so this might
>  > need to wait until that's done for it to merge.)
> 
> I've gotten confirmation that my copyright assignment info is all 
> up-to-date, so once this patch passes muster, it should be ok to merge it.

Your copyright assignment is on file, so we are good in that
department.

> On 9/12/2021 11:05 AM, Jim Porter wrote:
> > Note however that this solution isn't perfect: it means a user's custom 
> > `electric-pair-inhibit-predicate' can only inhibit *more* than CC mode's 
> > default behavior, not less. I think that's a reasonable compromise 
> > though, and users who want more direct control can set 
> > `electric-pair-inhibit-predicate' inside `c-mode-common-hook'. A 
> > "perfect" solution here would probably require adding new customization 
> > points to `electric-pair-mode' (e.g. a way for major modes to override 
> > how the syntax is analyzed), and I'm not sure the added complexity would 
> > be worth it, especially since this code is already a bit tricky.
> 
> I'm not sure if someone has a better idea for how to do things, but for 
> my config[1], the patch works well and makes CC modes behave the same as 
> other programming modes. In my opinion, the worst thing 
> `electric-pair-mode' can do is to behave inconsistently, since that 
> forces the user to pay close attention to something that should be 
> almost invisible/automatic.

I don't use this minor mode, so I don't think my opinion on this
matters much.  I will defer to Lars and Alan here.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#50538; Package emacs. Full text available.

Message received at 50538 <at> debbugs.gnu.org:


Received: (at 50538) by debbugs.gnu.org; 15 Sep 2021 22:17:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 15 18:17:34 2021
Received: from localhost ([127.0.0.1]:53429 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mQdDi-0003rd-M6
	for submit <at> debbugs.gnu.org; Wed, 15 Sep 2021 18:17:34 -0400
Received: from mail-pj1-f46.google.com ([209.85.216.46]:37582)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jporterbugs@HIDDEN>) id 1mQdDf-0003rL-3m
 for 50538 <at> debbugs.gnu.org; Wed, 15 Sep 2021 18:17:33 -0400
Received: by mail-pj1-f46.google.com with SMTP id
 me5-20020a17090b17c500b0019af76b7bb4so5361382pjb.2
 for <50538 <at> debbugs.gnu.org>; Wed, 15 Sep 2021 15:17:31 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=subject:from:to:cc:references:message-id:date:mime-version
 :in-reply-to:content-language:content-transfer-encoding;
 bh=0NPzkMwgZ4SYmQk7gFUy/rRXYLLUNffBq3o25MaYRR4=;
 b=EPlQda/A+t3k6mYTtlAV0NNxZ6Zc9h3ku/OizRk4bOaAVGerwWacoHmWVWIe4wDcI9
 qxsZMd/2hbBYSKApJr1/2JRq5FiL2hnMe4u48keMf/AEYw6pv9diSFJkEAZxXKWU+C8j
 Pu7cUuO+jiovgtjAdZCd7iBy7YEwMHOlE9QUEgi9Gmz7F/h2JzTbv27BUTkV20AffsVe
 3pu2XmVPtbtxDy1re/D/sfnnf5QhxHAMXEIuIufeTc8C2OUZ0a9H8QbhblxLOaI+95SH
 uX6Q99Kua0WwxIoOg6TuYo+C5+jdnqzZr98BwrhRH6Qd5ZTHSMNh04LGnydPfTXhoNjt
 c16w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:subject:from:to:cc:references:message-id:date
 :mime-version:in-reply-to:content-language:content-transfer-encoding;
 bh=0NPzkMwgZ4SYmQk7gFUy/rRXYLLUNffBq3o25MaYRR4=;
 b=MrxdMO1U9JYTOcr/ABRDEZGmDO0gK7OvNWNMUBIK1lAuX07e6UcsgJ25H/dzLWkFN/
 lehj+yDqUENawJobx1iJkyoke/tdI4VF/a4FUyQ7Sxbov1EZQyrvgiyAWdDQ5h8iXdQD
 3f9VteFiS2qgD0rWjC+Lb2TP5qJ5RhbZJGPdHh41fn2l/dVUgb4a7JXop6mUEnUZ4OPA
 A5OYeDr8YSRY+on+B7qSkt4SqXrhGcsgqI1ZY3Pjf//shGQ1VZzJvlzV3/GEXGHKKCyi
 k4lbHuW0rWNoFxX4g9cpndOlrttDb0H1xcVVZl01EvQyK9aRSnw4uBgpNXAJxZ1bP9KW
 l+Bw==
X-Gm-Message-State: AOAM53011MlSZ4t+ZZd2zihOseRfOaI/afZmJUT1fPyTwjLxvdRTLJQ5
 ETMV7TZa/JX7wg7KC+MfvO+eEe9wbIk=
X-Google-Smtp-Source: ABdhPJwrCJvwj0mT4TyfudPX2l/RvuoCyjihPNu7dpkDdfvetnTyH0UwAEzocK2TY0d4qrp8kyTuJQ==
X-Received: by 2002:a17:902:c789:b0:13c:a112:6383 with SMTP id
 w9-20020a170902c78900b0013ca1126383mr538705pla.42.1631744245004; 
 Wed, 15 Sep 2021 15:17:25 -0700 (PDT)
Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com.
 [76.168.148.233])
 by smtp.googlemail.com with ESMTPSA id b16sm795649pfr.138.2021.09.15.15.17.24
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Wed, 15 Sep 2021 15:17:24 -0700 (PDT)
Subject: Re: bug#50538: [PATCH] 28.0.50; electric-pair-mode fails to pair
 double quotes in some cases in CC mode
From: Jim Porter <jporterbugs@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
References: <021853bf-0169-c158-ab3d-296b6c144e08@HIDDEN>
 <83r1dufgxu.fsf@HIDDEN> <94c7b4ec-813b-515f-d947-116c294dd74b@HIDDEN>
Message-ID: <716194ea-817f-eaad-f9ce-7d600ad359b1@HIDDEN>
Date: Wed, 15 Sep 2021 15:17:23 -0700
MIME-Version: 1.0
In-Reply-To: <94c7b4ec-813b-515f-d947-116c294dd74b@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 50538
Cc: 50538 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On 9/11/2021 8:58 PM, Jim Porter wrote:
 > (Note: I've just updated my copyright assignment information, but
 > haven't received confirmation that everything is in order, so this might
 > need to wait until that's done for it to merge.)

I've gotten confirmation that my copyright assignment info is all 
up-to-date, so once this patch passes muster, it should be ok to merge it.

On 9/12/2021 11:05 AM, Jim Porter wrote:
> Note however that this solution isn't perfect: it means a user's custom 
> `electric-pair-inhibit-predicate' can only inhibit *more* than CC mode's 
> default behavior, not less. I think that's a reasonable compromise 
> though, and users who want more direct control can set 
> `electric-pair-inhibit-predicate' inside `c-mode-common-hook'. A 
> "perfect" solution here would probably require adding new customization 
> points to `electric-pair-mode' (e.g. a way for major modes to override 
> how the syntax is analyzed), and I'm not sure the added complexity would 
> be worth it, especially since this code is already a bit tricky.

I'm not sure if someone has a better idea for how to do things, but for 
my config[1], the patch works well and makes CC modes behave the same as 
other programming modes. In my opinion, the worst thing 
`electric-pair-mode' can do is to behave inconsistently, since that 
forces the user to pay close attention to something that should be 
almost invisible/automatic.

[1] I customize `electric-pair-inhibit-predicate' to disable 
electric-pairing in strings/comments, and this patch interacts correctly 
with that customization.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#50538; Package emacs. Full text available.

Message received at 50538 <at> debbugs.gnu.org:


Received: (at 50538) by debbugs.gnu.org; 12 Sep 2021 18:05:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 12 14:05:27 2021
Received: from localhost ([127.0.0.1]:43536 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mPTr5-0004gw-4x
	for submit <at> debbugs.gnu.org; Sun, 12 Sep 2021 14:05:27 -0400
Received: from mail-pj1-f42.google.com ([209.85.216.42]:38844)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jporterbugs@HIDDEN>) id 1mPTr1-0004gb-Br
 for 50538 <at> debbugs.gnu.org; Sun, 12 Sep 2021 14:05:25 -0400
Received: by mail-pj1-f42.google.com with SMTP id
 g13-20020a17090a3c8d00b00196286963b9so4986596pjc.3
 for <50538 <at> debbugs.gnu.org>; Sun, 12 Sep 2021 11:05:23 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=subject:to:cc:references:from:message-id:date:mime-version
 :in-reply-to:content-language;
 bh=9MKAPc0YM8xaJ48ytt5QDNZ5k4SAfJJZbubQDNH1NKU=;
 b=iSk6Tyq6dtpODX6pQ1+vVjqd7Jcwxha7YAQhSJAnqMRWgTmJ35hzzfOp5de/EuJg1f
 C0wr26j9uD6LuONW34iVpj3Ph34QOXeabqwq3bgKD9LPW2zLaQJHa0U5j90oF22ARirx
 +aHcU99UAP/FLvX+V4Q4goQiRVRifCvaNU9SnjY/gLdlKQPLV/iuctyGjIB/KHno2ySt
 f0nEdz9h4VNXF5/Ov7EKFFMVJ4Ajrhdl9HcDsB+LLgfVnzh4J6WMPn2gcGlZqcOa90RF
 GE0uuHrb60prDYmfu+yWGxXk8QNBW0HW9ngZNDsT9XhR4RwnkKzNmJk3vXhBhkzs4Io1
 JKiw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:subject:to:cc:references:from:message-id:date
 :mime-version:in-reply-to:content-language;
 bh=9MKAPc0YM8xaJ48ytt5QDNZ5k4SAfJJZbubQDNH1NKU=;
 b=DsWGTsM7hsN13frucIqAd7BUlbXgLvnALaZNTRqmWzV4wK9tn/LiNrK4HSFVeiD2ZZ
 miC2VZsKfV0izd3jO77cncWDsHn/pq//A44dOcla0qTbQnElTIkUCP1Xx+W6UnuZQD8Q
 e+RFq0LNKm2TV+8D1USPj//gWHVTFpuDDWKkw0UTSu/Gnic3jBlxqLnEW+0Sp//Apwt2
 jvplGWjXlZ/3rkqqTu3WyMxzJFZeWeYO3zsMWiB2F2ecuUybmcnvfktNkLATtfNd/J+L
 rBwKHRFHrEdA1lqpWQJ5lkOshtiDjf8TDwg00Aqr12pTG52uoIhxk1A7sKAwo9wT+oGN
 keAA==
X-Gm-Message-State: AOAM53312Ohi66BEYfgzF+ISZoDXnwWqSlDdEyyfV/vT8KStAZh4Bw98
 HCHDaeQut7s28BI7vWfmLUZSwzyyZOg=
X-Google-Smtp-Source: ABdhPJy+518/PLkibt5CI/+UQgTlKTIyQTFUNIL+1Vt8EPlTPp+5FD64MInUUctm+mabzRwuO6YA0w==
X-Received: by 2002:a17:90b:a4a:: with SMTP id
 gw10mr8678291pjb.245.1631469917074; 
 Sun, 12 Sep 2021 11:05:17 -0700 (PDT)
Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com.
 [76.168.148.233])
 by smtp.googlemail.com with ESMTPSA id w8sm1179984pfc.93.2021.09.12.11.05.15
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Sun, 12 Sep 2021 11:05:16 -0700 (PDT)
Subject: Re: bug#50538: [PATCH] 28.0.50; electric-pair-mode fails to pair
 double quotes in some cases in CC mode
To: Eli Zaretskii <eliz@HIDDEN>
References: <021853bf-0169-c158-ab3d-296b6c144e08@HIDDEN>
 <83r1dufgxu.fsf@HIDDEN>
From: Jim Porter <jporterbugs@HIDDEN>
Message-ID: <94c7b4ec-813b-515f-d947-116c294dd74b@HIDDEN>
Date: Sun, 12 Sep 2021 11:05:17 -0700
MIME-Version: 1.0
In-Reply-To: <83r1dufgxu.fsf@HIDDEN>
Content-Type: multipart/mixed; boundary="------------BE38C65897CECAEF07E54E0E"
Content-Language: en-US
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 50538
Cc: 50538 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

This is a multi-part message in MIME format.
--------------BE38C65897CECAEF07E54E0E
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit

On 9/11/2021 11:26 PM, Eli Zaretskii wrote:
>> From: Jim Porter <jporterbugs@HIDDEN>
>> Date: Sat, 11 Sep 2021 20:58:47 -0700
>>
>> There are a few related issues with pairing double quotes in CC mode
>> while using `electric-pair-mode'. Hopefully the steps to reproduce below
>> will explain the issues. In all the cases, I'd expect
>> `electric-pair-mode' to insert a closing quote, but it doesn't.
> 
> Your expected results seem to expect Emacs to assume that a new string
> will be inserted, but is that an assumption that is always true?

In these cases, I believe that's true (with the default 
`electric-pair-mode' settings, that is). More broadly, the goal of the 
patch is to ensure that pairing of double quotes works the same in CC 
mode as it does in other modes (`ruby-mode', `python-mode', `js-mode', 
`emacs-lisp-mode', etc), which is why I added `c-mode' to the list of 
modes to test in `test/lisp/electric-tests.el'.

That said, there's one potential case I didn't account for (mostly 
because it wasn't accounted for in the patch for bug#36474): if a user 
customizes `electric-pair-inhibit-predicate' to inhibit cases like (2) 
or (3) in my original message, that won't work right in CC modes, since 
the default value of `electric-pair-inhibit-predicate' (set by the user) 
won't be called.

Attached is an updated patch that changes the logic of 
`c-electric-pair-inhibit-predicate' to either a) inhibit insertion of 
the closing quote, or b) call the default-value of 
`electric-pair-inhibit-predicate' to determine what to do. This should 
give users more consistent behavior when customizing 
`electric-pair-inhibit-predicate'.

The tests still pass, although I wasn't able to figure out a good way to 
add a test for setting `electric-pair-inhibit-predicate' that works with 
how CC mode overrides it (using `:bindings' in 
`define-electric-pair-test' didn't work, since the binding is set too 
late). Hopefully that's ok; if not, I can try and see about making some 
more extensive changes to the tests to account for this.

Note however that this solution isn't perfect: it means a user's custom 
`electric-pair-inhibit-predicate' can only inhibit *more* than CC mode's 
default behavior, not less. I think that's a reasonable compromise 
though, and users who want more direct control can set 
`electric-pair-inhibit-predicate' inside `c-mode-common-hook'. A 
"perfect" solution here would probably require adding new customization 
points to `electric-pair-mode' (e.g. a way for major modes to override 
how the syntax is analyzed), and I'm not sure the added complexity would 
be worth it, especially since this code is already a bit tricky.

--------------BE38C65897CECAEF07E54E0E
Content-Type: text/plain; charset=UTF-8;
 name="0001-Improve-behavior-of-electric-pair-mode-in-cc-mode.patch"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename*0="0001-Improve-behavior-of-electric-pair-mode-in-cc-mode.patch"

RnJvbSAwYjAzOGVmODY4YThjNTU4ZTY2ZDQyMGI5MzgwYjc5MmI0MDllMzg4IE1vbiBTZXAg
MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBKaW0gUG9ydGVyIDxqcG9ydGVyYnVnc0BnbWFpbC5j
b20+CkRhdGU6IFN1biwgMTIgU2VwIDIwMjEgMTA6NDQ6NTUgLTA3MDAKU3ViamVjdDogW1BB
VENIXSBJbXByb3ZlIGJlaGF2aW9yIG9mICdlbGVjdHJpYy1wYWlyLW1vZGUnIGluICdjYy1t
b2RlJwoKVGhpcyBlbnN1cmVzIHRoYXQgcXVvdGVzIGFyZSBwYWlyZWQgY29ycmVjdGx5IHdp
dGhpbiBjb21tZW50cywgYWxsb3dzIGZvcgppbnNlcnRpb24gb2YgcXVvdGUgcGFpcnMgaW1t
ZWRpYXRlbHkgYmVmb3JlIGFub3RoZXIgcXVvdGUsIGFuZCBhbGxvd3MKaW5zZXJ0aW5nIHF1
b3RlIHBhaXJzIHdpdGhpbiBhIHN0cmluZyAodGh1cyBzcGxpdHRpbmcgdGhlIHN0cmluZyBp
biB0d28pLgoKKiBsaXNwL3Byb2dtb2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zYXZlZC1lbGVjdHJpYy1tb2RlcyAoZm4pCiAgIChsZXQgKChz
YXZlZC1lbGVjdHJpYyAoaWYgZWxlY3RyaWMtcGFpci1tb2RlIDEgLTEpKQogICAgICAgICAo
c2F2ZWQtbGF5b3V0IChpZiBlbGVjdHJpYy1sYXlvdXQtbW9kZSAxIC0xKSkKQEAgLTE3Myw3
ICsxNzYsNyBAQCBkZWZpbmUtZWxlY3RyaWMtcGFpci10ZXN0CiAgICAgICAgICAgZXhwZWN0
ZWQtc3RyaW5nCiAgICAgICAgICAgZXhwZWN0ZWQtcG9pbnQKICAgICAgICAgICBiaW5kaW5n
cwotICAgICAgICAgIChtb2RlcyAnKHF1b3RlIChydWJ5LW1vZGUganMtbW9kZSkpKQorICAg
ICAgICAgIChtb2RlcyAnKHF1b3RlIChydWJ5LW1vZGUganMtbW9kZSBjLW1vZGUpKSkKICAg
ICAgICAgICAodGVzdC1pbi1jb21tZW50cyB0KQogICAgICAgICAgICh0ZXN0LWluLXN0cmlu
Z3MgdCkKICAgICAgICAgICAodGVzdC1pbi1jb2RlIHQpCi0tIAoyLjI1LjEKCg==
--------------BE38C65897CECAEF07E54E0E--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#50538; Package emacs. Full text available.

Message received at 50538 <at> debbugs.gnu.org:


Received: (at 50538) by debbugs.gnu.org; 12 Sep 2021 06:26:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 12 02:26:24 2021
Received: from localhost ([127.0.0.1]:41887 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mPIwa-0002TZ-Db
	for submit <at> debbugs.gnu.org; Sun, 12 Sep 2021 02:26:24 -0400
Received: from eggs.gnu.org ([209.51.188.92]:35332)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1mPIwZ-0002TN-3G
 for 50538 <at> debbugs.gnu.org; Sun, 12 Sep 2021 02:26:23 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:51830)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1mPIwT-0007T3-Nf; Sun, 12 Sep 2021 02:26:17 -0400
Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:1730
 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1mPIwT-0002pK-Al; Sun, 12 Sep 2021 02:26:17 -0400
Date: Sun, 12 Sep 2021 09:26:05 +0300
Message-Id: <83r1dufgxu.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Jim Porter <jporterbugs@HIDDEN>
In-Reply-To: <021853bf-0169-c158-ab3d-296b6c144e08@HIDDEN> (message from
 Jim Porter on Sat, 11 Sep 2021 20:58:47 -0700)
Subject: Re: bug#50538: [PATCH] 28.0.50;
 electric-pair-mode fails to pair double quotes in some cases in CC
 mode
References: <021853bf-0169-c158-ab3d-296b6c144e08@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 50538
Cc: 50538 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Jim Porter <jporterbugs@HIDDEN>
> Date: Sat, 11 Sep 2021 20:58:47 -0700
> 
> There are a few related issues with pairing double quotes in CC mode 
> while using `electric-pair-mode'. Hopefully the steps to reproduce below 
> will explain the issues. In all the cases, I'd expect 
> `electric-pair-mode' to insert a closing quote, but it doesn't.

Your expected results seem to expect Emacs to assume that a new string
will be inserted, but is that an assumption that is always true?  It
could be that the user wants to modify the existing string instead, in
which case your suggested patches will require the user to delete more
quotes than previously.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#50538; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 12 Sep 2021 03:58:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 11 23:58:54 2021
Received: from localhost ([127.0.0.1]:41845 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mPGdq-0006wB-Ez
	for submit <at> debbugs.gnu.org; Sat, 11 Sep 2021 23:58:54 -0400
Received: from lists.gnu.org ([209.51.188.17]:58774)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jporterbugs@HIDDEN>) id 1mPGdp-0006w4-9I
 for submit <at> debbugs.gnu.org; Sat, 11 Sep 2021 23:58:53 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:42510)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <jporterbugs@HIDDEN>)
 id 1mPGdo-0004w9-Uh
 for bug-gnu-emacs@HIDDEN; Sat, 11 Sep 2021 23:58:52 -0400
Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]:45605)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <jporterbugs@HIDDEN>)
 id 1mPGdm-0001fF-TO
 for bug-gnu-emacs@HIDDEN; Sat, 11 Sep 2021 23:58:52 -0400
Received: by mail-pl1-x62e.google.com with SMTP id d17so3665870plr.12
 for <bug-gnu-emacs@HIDDEN>; Sat, 11 Sep 2021 20:58:49 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=from:subject:to:message-id:date:mime-version:content-language;
 bh=meTzmysNbydRUqa2kUJfRR6+3A0Kqj+rVkVZZyDnf40=;
 b=WYbU1PIVGe++zu6fgUDakwXILOAREqyTtj57k8VQzL86zWTMILY0RugDtdX+Gh5DeF
 nKL/417Uv+W9EitC0xSop4vlL3YRrIkWPQNp+oivy/4PF39C91TvWQEYepUHktqLADsw
 pSpYT4L+vseilhWAfsapwkmiZ+lZhjFYlVDOy8TTaGKe6OHFizjRxUVOaiekiUkqAaEX
 lQJW4N+odKM6Gu4k9JQcoINlP97/1ABaiIH/nuuoS/lHblIwh/VtxAzlq5erwhIAu3/q
 0WbrdqQWA8pd8WZLjaCC0bw+pTSauJpZObJ9XkcfC4q/NSiaRn3aPqZaJGaH+NQMS1ze
 VD6Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:from:subject:to:message-id:date:mime-version
 :content-language;
 bh=meTzmysNbydRUqa2kUJfRR6+3A0Kqj+rVkVZZyDnf40=;
 b=D18L63bNfuFPVoiyEQj1ja+EkCwNN+x7yelJ2RQdIVpYbZuWYgKrVBSsFpUlz76loM
 jeGNGv3lY4k7uULA8ZJoxfcsp9YD/o+Q9+643DjijJpdo7JOKf43VbF6Kg2xuNvhCxBS
 2HojoQ/XZDe2hjwX6JIImvb1JKtRTIgxtpB/NlDBH/Yc8ZiCvsjqo7lZx+Kd2b7XevpS
 k26udDlevCpAp6n0QxF1jh3gXV31mL7L2e0Ecgdv973nFXW1hkdhxKJ1D/uyf3iHN1Qr
 s6G1KIkkQpjmKgYkcOYPIFiQM4gCVRBm1zUY+8Ym5Y2F77WEp+GMTj8wvwWEYU8iIZyK
 ZPBQ==
X-Gm-Message-State: AOAM530CdbfaPYigtEg9PAUTp+TfCcbJbCj9Tix7vAAbqTVDcuwkyPZV
 SUmiY5PLFtbjKwGi25ssQykIYMHSeY4=
X-Google-Smtp-Source: ABdhPJxBOppqlMSoCMDZJ+VHDRkuW9Ygf2oiMZ+KBJlUKdCKI4ySZkwL+yNUCVgx00vHARJdJabOIA==
X-Received: by 2002:a17:90b:3a91:: with SMTP id
 om17mr5822266pjb.7.1631419128575; 
 Sat, 11 Sep 2021 20:58:48 -0700 (PDT)
Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com.
 [76.168.148.233])
 by smtp.googlemail.com with ESMTPSA id e16sm3186915pfj.90.2021.09.11.20.58.47
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Sat, 11 Sep 2021 20:58:47 -0700 (PDT)
From: Jim Porter <jporterbugs@HIDDEN>
Subject: [PATCH] 28.0.50; electric-pair-mode fails to pair double quotes in
 some cases in CC mode
To: bug-gnu-emacs@HIDDEN
Message-ID: <021853bf-0169-c158-ab3d-296b6c144e08@HIDDEN>
Date: Sat, 11 Sep 2021 20:58:47 -0700
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------75E1D06C54734075675BA122"
Content-Language: en-US
Received-SPF: pass client-ip=2607:f8b0:4864:20::62e;
 envelope-from=jporterbugs@HIDDEN; helo=mail-pl1-x62e.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

This is a multi-part message in MIME format.
--------------75E1D06C54734075675BA122
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit

(Note: I've just updated my copyright assignment information, but 
haven't received confirmation that everything is in order, so this might 
need to wait until that's done for it to merge.)

There are a few related issues with pairing double quotes in CC mode 
while using `electric-pair-mode'. Hopefully the steps to reproduce below 
will explain the issues. In all the cases, I'd expect 
`electric-pair-mode' to insert a closing quote, but it doesn't. You can 
try similar steps in a `ruby-mode' buffer to see how it should work.

----------------------------------------

Common setup
------------

   $ cat foo.c
   "foobar"

   $ emacs -Q foo.c
   M-x electric-pair-mode

Note that | represents the point below.

1. Quote pairing in comments
----------------------------

   C-o   ;; to make a blank line
   // "  ;; type this

Expected: line 1 is // "|"
Actual:   line 1 is // "|

2. Inserting quote pairs before existing string
-----------------------------------------------

   "  ;; type this (point is at beginning of buffer, before "foobar")

Expected: line 1 is "|""foobar"
Actual:   line 1 is "|"foobar"

3. Splitting strings into two
-----------------------------

   "foo|bar"  ;; move point here
   "          ;; type this

Expected: line 1 is "foo"|"bar"
Actual:   line 1 is "foo"|bar"

----------------------------------------

This is because the logic in the patch for bug#36474 isn't quite right. 
Currently, `c-electric-pair-inhibit-predicate' checks if the 
newly-inserted quotation mark has "a string fence syntax-table text 
property" (i.e. if it's the start of a string literal not terminated on 
that line[1]). However, this fails in all three cases above: in (1) 
because we're in a comment, not a string literal; and in (2) and (3) 
because it's the *last* quotation mark on the line that's unterminated, 
not the one before point.

The attached patch fixes this by taking those cases into account. I also 
added `c-mode' to the list of modes to check in 
`test/lisp/electric-tests.el'. This required setting single-line 
comments as the default in those tests, since the tests expect 
single-line comments (I tried testing under `c++-mode', but the tests 
failed, I think due to <> being paren-like in C++).

[1] I think this is what it means, at least (or close to it).

--------------75E1D06C54734075675BA122
Content-Type: text/plain; charset=UTF-8;
 name="0001-Improve-behavior-of-electric-pair-mode-in-cc-mode.patch"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename*0="0001-Improve-behavior-of-electric-pair-mode-in-cc-mode.patch"

RnJvbSBkOWM4ODc5YjMwODJhNDAzNzU1NTJkZGI2MjljODNhMGQ5NDFiZmY5IE1vbiBTZXAg
MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBKaW0gUG9ydGVyIDxqcG9ydGVyYnVnc0BnbWFpbC5j
b20+CkRhdGU6IFN1biwgMjkgQXVnIDIwMjEgMTI6NDA6MjYgLTA3MDAKU3ViamVjdDogW1BB
VENIXSBJbXByb3ZlIGJlaGF2aW9yIG9mICdlbGVjdHJpYy1wYWlyLW1vZGUnIGluICdjYy1t
b2RlJwoKVGhpcyBlbnN1cmVzIHRoYXQgcXVvdGVzIGFyZSBwYWlyZWQgY29ycmVjdGx5IHdp
dGhpbiBjb21tZW50cywgYWxsb3dzIGZvcgppbnNlcnRpb24gb2YgcX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hvb2sgKGxhbWJkYSAoKSAoYy10b2dnbGUtY29tbWVudC1zdHls
ZSAtMSkpKQorCiAoZGVmdW4gY2FsbC13aXRoLXNhdmVkLWVsZWN0cmljLW1vZGVzIChmbikK
ICAgKGxldCAoKHNhdmVkLWVsZWN0cmljIChpZiBlbGVjdHJpYy1wYWlyLW1vZGUgMSAtMSkp
CiAgICAgICAgIChzYXZlZC1sYXlvdXQgKGlmIGVsZWN0cmljLWxheW91dC1tb2RlIDEgLTEp
KQpAQCAtMTczLDcgKzE3Niw3IEBAIGRlZmluZS1lbGVjdHJpYy1wYWlyLXRlc3QKICAgICAg
ICAgICBleHBlY3RlZC1zdHJpbmcKICAgICAgICAgICBleHBlY3RlZC1wb2ludAogICAgICAg
ICAgIGJpbmRpbmdzCi0gICAgICAgICAgKG1vZGVzICcocXVvdGUgKHJ1YnktbW9kZSBqcy1t
b2RlKSkpCisgICAgICAgICAgKG1vZGVzICcocXVvdGUgKHJ1YnktbW9kZSBqcy1tb2RlIGMt
bW9kZSkpKQogICAgICAgICAgICh0ZXN0LWluLWNvbW1lbnRzIHQpCiAgICAgICAgICAgKHRl
c3QtaW4tc3RyaW5ncyB0KQogICAgICAgICAgICh0ZXN0LWluLWNvZGUgdCkKLS0gCjIuMjUu
MQoK
--------------75E1D06C54734075675BA122--




Acknowledgement sent to Jim Porter <jporterbugs@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#50538; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 17 Sep 2021 17:15:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.