From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Marc Soda Newsgroups: gmane.emacs.bugs Subject: bug#73688: [PATCH] electric-pair-mode - preserve balance in conservative mode Date: Sat, 12 Oct 2024 20:43:27 +0000 Message-ID: References: <86iktxwlyv.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18175"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , 73688@debbugs.gnu.org To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Oct 12 22:44:11 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sziyA-0004aF-Nc for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 12 Oct 2024 22:44:10 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1szixq-0007Wm-TM; Sat, 12 Oct 2024 16:43:50 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1szixo-0007WY-7N for bug-gnu-emacs@gnu.org; Sat, 12 Oct 2024 16:43:48 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1szixn-0004B5-VK for bug-gnu-emacs@gnu.org; Sat, 12 Oct 2024 16:43:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:From:Date:To:Subject; bh=K3v3CHK6VOYSIHNPLqfNhniMTdiOXMt0Do1CiaMO4OE=; b=b4N2WDhegNVzIo3xbzLPZ5LwRtIOa5mlR2MY/khmDph4vsxPraQE1hnHs7pc3w5W2ONXKiGvCtEFi008bOizL2BpVTrodRs8bdlbEDCBbPSJKC8hyFEBWbVP4hwAVpsdp0aLrbitQkcecZzAyxn/X4bPC8ZG28D+W6XxLCBVs3cm+raJZi28SXbmD1ltSc/XhgZcrl7TByggGqKKQoaw2SqlG9eHBC28Fj/yyEzhHIAR4tC/ZThB3BVEssBvXfbveK9AJtoqxzW4vocYRhVbh7PwZB09J9/upCsoUrZxLf8Cr83iyuCHg8Nj6s55BryOSocaYkI7R7Z8onWFTxeHlw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sziy2-0002F2-DG for bug-gnu-emacs@gnu.org; Sat, 12 Oct 2024 16:44:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Marc Soda Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 12 Oct 2024 20:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73688 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 73688-submit@debbugs.gnu.org id=B73688.17287658348585 (code B ref 73688); Sat, 12 Oct 2024 20:44:02 +0000 Original-Received: (at 73688) by debbugs.gnu.org; 12 Oct 2024 20:43:54 +0000 Original-Received: from localhost ([127.0.0.1]:34465 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1szixu-0002EO-64 for submit@debbugs.gnu.org; Sat, 12 Oct 2024 16:43:54 -0400 Original-Received: from mail-4018.proton.ch ([185.70.40.18]:36789) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1szixr-0002E4-6x for 73688@debbugs.gnu.org; Sat, 12 Oct 2024 16:43:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soda.fm; s=protonmail; t=1728765810; x=1729025010; bh=K3v3CHK6VOYSIHNPLqfNhniMTdiOXMt0Do1CiaMO4OE=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=YLAgqatYnZXAuc8xR05FrezwB3NpIVFLJA2MVd5xOFmwdFSEaMyVZG2trm70SuHJL qt1TvikOo5ei2QL2L3av3DfmX5w6acJkI41zCKrryfGAI4nzxKs6JiTwMTgWSwHXxp 7jm1ZmH06f3DDkXJ7VPrqTx+LRwWo2yKDy3QzQwo= In-Reply-To: Feedback-ID: 9188694:user:proton X-Pm-Message-ID: 569d197c5b4b1aae846de0835e84d81bcbe30376 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:293480 Archived-At: Sorry, this is my first emacs bug report, I should have been more clear. >From emacs -Q: (electric-pair-mode t) (setq electric-pair-inhibit-predicate 'electric-pair-conservative-inhibit) Evaluate those two lines and then type: f o o C-a " C-e " and you will be left with "foo"" Marc On Saturday, October 12th, 2024 at 4:35 PM, Jo=C3=A3o T=C3=A1vora wrote: >=20 >=20 > On Sat, Oct 12, 2024 at 1:21=E2=80=AFPM Eli Zaretskii eliz@gnu.org wrote: >=20 > > > Date: Tue, 08 Oct 2024 03:10:54 +0000 > > > From: Marc Soda marc@soda.fm > > >=20 > > > When using electric-pair-mode, electric-pair-conservative-inhibit > > > doesn't respect electric-pair-preserve-balance. For example, type out= a > > > string, go to the beginning of the line, type ", go to the end of the > > > line, and type ". You are left with "foo"". (Exact keys from the star= t > > > of a line are fooC-a"C-e", if that's more clear.) I would expect to b= e > > > left with "foo" instead. > > >=20 > > > This is easy to resolve in your init file (after some digging), but I > > > think the current behavior is non-intuitive. > > >=20 > > > Please consider the attached patch. > >=20 > > Jo=C3=A3o, do you have any comments? >=20 >=20 > This is not reproducible here, but then again this isn't an > Emacs -Q recipe. What major-mode? In my scratch buffer, if > I type >=20 > f o o C-a " C-e " >=20 > , as Marc seems to suggest, I am left with >=20 > ""foo"" >=20 > as the contents, which is a balanced situation. I do not expect > to have: >=20 > "foo" >=20 > To get that, I would need to have typed " with the region active. >=20 > Jo=C3=A3o