GNU bug report logs - #78053
[PATCH] Support strings for electric-pairs.

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: Elijah Gabe Pérez <eg642616@HIDDEN>; Keywords: patch; dated Fri, 25 Apr 2025 00:31:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

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


Received: (at 78053) by debbugs.gnu.org; 16 Jun 2025 09:40:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 16 05:40:34 2025
Received: from localhost ([127.0.0.1]:42323 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uR6KP-0004sn-PV
	for submit <at> debbugs.gnu.org; Mon, 16 Jun 2025 05:40:34 -0400
Received: from fout-a2-smtp.messagingengine.com ([103.168.172.145]:42207)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <rudi@HIDDEN>)
 id 1uR6KN-0004sF-Eq
 for 78053 <at> debbugs.gnu.org; Mon, 16 Jun 2025 05:40:31 -0400
Received: from phl-compute-10.internal (phl-compute-10.phl.internal
 [10.202.2.50])
 by mailfout.phl.internal (Postfix) with ESMTP id 25FE013804E2;
 Mon, 16 Jun 2025 05:40:26 -0400 (EDT)
Received: from phl-mailfrontend-01 ([10.202.2.162])
 by phl-compute-10.internal (MEProxy); Mon, 16 Jun 2025 05:40:26 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=constantly.at;
 h=cc:content-transfer-encoding:content-type:content-type:date
 :date:from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:subject:subject:to:to; s=fm2; t=1750066826;
 x=1750153226; bh=pWu9Tl893HdJN1yvDlqW0RJlymktXSDOhsJsHpZw+7M=; b=
 mY9/1z1tPclMKamgcMVdZ9vVlr7JJkiEtARKDj4Q3pYGy7enHJZlVlF3mXJ9gqGG
 uTPUqvEtt6Nn6/jxb6tEN+uJHZ8Paa90dyL2zZYrylYFkm/qYfxEtu6T5XmkQWZc
 tjMGZk6Vnqax4we9rVgxq7UVRMYuYy6JFP5hXMpcMsaqqxtA4GI4ewXCp8ibqOQo
 Q1yIbeFasgAqD+kAq/ZB2JsNHaqEkbWq/exjNd0c8H6Ikj1ocfQiK6Ff9bAsCore
 XALm+R7uJmjrvMA3wkHvSB4ROoca98/Kc5TIyGqwQiWPIRmI+Lbe9asD9OWgXs23
 o2jx94Ci6Ikg/gUB8Kudkw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:content-transfer-encoding:content-type
 :content-type:date:date:feedback-id:feedback-id:from:from
 :in-reply-to:in-reply-to:message-id:mime-version:references
 :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender
 :x-me-sender:x-sasl-enc; s=fm1; t=1750066826; x=1750153226; bh=p
 Wu9Tl893HdJN1yvDlqW0RJlymktXSDOhsJsHpZw+7M=; b=Q2anAHUjlFtkw0oUF
 aA6FxSGxBFmrSJd19zn+Hxi8qdA3PQu4pHJYdhvz9IDqT+Mu1KAL08V9BQ8LglE6
 Vx1MJ4z0ORn1NnJ7rUEbXYLZwjImUI43pMBYdWnvxrqCJHKr1+f1Fib6BuhJ6wz2
 vwkXuu98Vry3cY4KJka6ymT7SYqixLN5s+fwad7n5UBJwHfz+FM9d2K5J2SCyB+B
 h1ocLvW4Bo9z7hX/BloVteHl2tHUlVsNCgb5cr+LRtis/LR+LS4W50/BlHX5Ewsj
 VPbUmDO4k4La7KTGsQOVO1V1eZBAuBYRHsHt3Q7LDdRse55m7bnX7JnSkhYhoH10
 EfnQA==
X-ME-Sender: <xms:ieZPaPxvWt-eBtfhSxAmKGfNx66tiIVAUf9VBNKZIMFFMM1SdvUgTA>
 <xme:ieZPaHQyZGbuID7bGlaO94NaUZo7NGR5WyUwDW4JsvTy-AwLBPlzV7Z4pJWJYtC2M
 ezTNH4uYbMEGgjKKg>
X-ME-Received: <xmr:ieZPaJULTrBo3a12bSaK1mp2IPL_Cr9oQIl1ustbUhjfyuRbqBjaYyIfPdI8h6G6_eZ7veI4Af6LXKKQBkB7Ij67M8O7Nm2DD85MGEuriOL0>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddugddviedvgecutefuodetggdotefrod
 ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp
 uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg
 hnthhsucdlqddutddtmdenucfjughrpegtggfuhfgjfffgkfhfvffosehtqhhmtdhhtdej
 necuhfhrohhmpeftuhguihcuufgthhhlrghtthgvuceorhhuughisegtohhnshhtrghnth
 hlhidrrghtqeenucggtffrrghtthgvrhhnpeetheeijefhudegffejfffftdffkeelgfej
 heejtdegieduudefteefieduuefgudenucffohhmrghinhepghhithhhuhgsrdgtohhmne
 cuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprhhuughi
 segtohhnshhtrghnthhlhidrrghtpdhnsggprhgtphhtthhopeefpdhmohguvgepshhmth
 hpohhuthdprhgtphhtthhopegvlhhiiiesghhnuhdrohhrghdprhgtphhtthhopeejkedt
 heefseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtoheprhhuughisegtohhnsh
 htrghnthhlhidrrght
X-ME-Proxy: <xmx:ieZPaJg44lfcROrqGo-tgBvdlJZwZRDLVjS6XLpPTZyF9Z9a6dZbFg>
 <xmx:ieZPaBBtjuLPwdqmtxlXSAY1akvK6bXxQHZiF6qpQHL3lQ50EHHk7g>
 <xmx:ieZPaCJsR1jAJeYER07mY0fE3NFZb6dLr__G4aPxy5Cz1RxGYLvqFg>
 <xmx:ieZPaAAohV_56O1YGwx6KUZmSSr41iYVVkQ_VHV2rgp7Y-8Yv6G21w>
 <xmx:iuZPaOhRrNLbzuqdwNq3t14XVxOKQQ7A0esVU-tvfbskX2KMBPyzU3j2>
Feedback-ID: i5b4840b3:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon,
 16 Jun 2025 05:40:24 -0400 (EDT)
Content-Type: text/plain;
	charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.600.51.1.1\))
Subject: Re: bug#78053: [PATCH] Support strings for electric-pairs.
From: Rudi Schlatte <rudi@HIDDEN>
In-Reply-To: <867c1coxf6.fsf@HIDDEN>
Date: Mon, 16 Jun 2025 11:40:12 +0200
Content-Transfer-Encoding: quoted-printable
Message-Id: <8AF1B279-B554-4249-8410-A6690AB48863@HIDDEN>
References: <877c39f5gt.fsf@HIDDEN> <jwvplfw96n3.fsf-monnier+emacs@HIDDEN>
 <87wma4dvcn.fsf@HIDDEN> <jwvy0ujpdoy.fsf-monnier+emacs@HIDDEN>
 <86y0u4hrn1.fsf@HIDDEN> <8734cam6py.fsf@HIDDEN>
 <86v7p1fm4y.fsf@HIDDEN>
 <87jz5dzkoh.fsf@HIDDEN> <868qltr1rd.fsf@HIDDEN>
 <87bjqoaigk.fsf@HIDDEN> <m11prktf0u.fsf@HIDDEN>
 <867c1coxf6.fsf@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>,
 78053 <at> debbugs.gnu.org
X-Mailer: Apple Mail (2.3826.600.51.1.1)
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 78053
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.7 (-)



> On 16 Jun 2025, at 11:20, Eli Zaretskii <eliz@HIDDEN> wrote:
>=20
>> From: Rudolf Schlatte <rudi@HIDDEN>
>> Date: Mon, 16 Jun 2025 07:46:25 +0200
>>=20
>>> Thus, if electric-pair-pairs is set like this:
>>> (setq electric-pair-pairs '(("/*" " */" t)))
>>>=20
>>> After the pair start was typed it expands to this:
>>> /* | */
>>>   ^ cursor
>>=20
>> Instead of hard-coding the extra space, how about allowing the third
>> element to also be a string, with that string being inserted after =
the
>> pair start?  In java-mode, I'd then add an element ("\"\"\"" "\"\"\""
>> "\n") since Java-style multi-line strings start with a mandatory
>> linebreak after the opening triple-quote.
>=20
> If that the Java style, then comment-start should include the newline,
> no?

That would also work, yes, just a little less =E2=80=9Celectrical=E2=80=9D=
:  If the auto-insert string after the opening sequence can=E2=80=99t be =
configured, I=E2=80=99d use an entry ("\"\"\"" "\"\"\=E2=80=9D" NIL) for =
Java mode.  This is how smartparens =
(https://github.com/Fuco1/smartparens) currently works: after three =
quotation marks you immediately get the matching closing quotation mark =
triple but have to press RETURN afterwards.

Anyway it=E2=80=99s not a big deal; please don=E2=80=99t let me block =
the patch going in.  I=E2=80=99m looking forward to having =
multi-character electric pairs built in!





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

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


Received: (at 78053) by debbugs.gnu.org; 16 Jun 2025 09:26:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 16 05:26:52 2025
Received: from localhost ([127.0.0.1]:42141 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uR67A-0003Ze-BF
	for submit <at> debbugs.gnu.org; Mon, 16 Jun 2025 05:26:52 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:44304)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1uR677-0003Yt-6j
 for 78053 <at> debbugs.gnu.org; Mon, 16 Jun 2025 05:26:50 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1uR670-0006lz-Cv; Mon, 16 Jun 2025 05:26:43 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=xkyKzGcZw/HVTfZQYtXuTlStDCBC7QRj+Z720nJVHoM=; b=ZkDSupnO02MVqItjEJZ8
 AcoFqLC0RbTOoVs2qMB7eI8FhxCDBPbdLChOoz1chaGpCeVRIqdzKXfXYgmxduGiEh4iyb+9cNkMj
 zEPnkIyWj6RnRjjuQiplGGtkH5nr23/t06Sebt5TYTnyzeBeNg3BSmztncIHCxHxhz7VfZ6dR8Ttw
 CnATQGOua9z0uvjgxYp7YF3gybPfQffTPBPf1KhxGPpPl5GDifh5mMzaBy9K2SuRYD/0zHcUuRxa4
 IT200R0oTnzMEXAg2e8tt7mCaLGjASybPi8Xy3yHgyMBtr8ZSCmeyqY1NXgxytE1i1eXhlopSVx8a
 crheXfCaRI86VA==;
Date: Mon, 16 Jun 2025 12:26:38 +0300
Message-Id: <865xgwox4h.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Elijah Gabe =?iso-8859-1?Q?P=E9rez?= <eg642616@HIDDEN>
In-Reply-To: <87bjqoaigk.fsf@HIDDEN> (message from Elijah Gabe
 =?iso-8859-1?Q?P=E9rez?= on Sun, 15 Jun 2025 13:54:51 -0600)
Subject: Re: bug#78053: [PATCH] Support strings for electric-pairs.
References: <877c39f5gt.fsf@HIDDEN> <jwvplfw96n3.fsf-monnier+emacs@HIDDEN>
 <87wma4dvcn.fsf@HIDDEN> <jwvy0ujpdoy.fsf-monnier+emacs@HIDDEN>
 <86y0u4hrn1.fsf@HIDDEN> <8734cam6py.fsf@HIDDEN>
 <86v7p1fm4y.fsf@HIDDEN> <87jz5dzkoh.fsf@HIDDEN>
 <868qltr1rd.fsf@HIDDEN> <87bjqoaigk.fsf@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 78053
Cc: 78053 <at> debbugs.gnu.org, monnier@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: Elijah Gabe Pérez <eg642616@HIDDEN>
> Cc: 78053 <at> debbugs.gnu.org,  monnier@HIDDEN
> Date: Sun, 15 Jun 2025 13:54:51 -0600
> 
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> >> This is a kind of property for pairs (only for strings pairs), that
> >> tells to `electric-pairs` to insert a space before the first pair.
> >> 
> >> I couldn't find a better way to document this in that limited-size tag.
> >
> > If you explain to me what it does, I can try finding more clear
> > wording.
> 
> That must be a list of 3 elements where specifies: pair start, pair end,
> and a non-nil value which specifies to insert an extra space after `pair
> start` was typed.
> 
> Thus, if electric-pair-pairs is set like this:
> (setq electric-pair-pairs '(("/*" " */" t)))
> 
> After the pair start was typed it expands to this:
> /* | */
>    ^ cursor

OK, but this should be first described in the doc string, which should
include the full documentation of the supported forms of the value.

As for the :tag text how about the below?

  "Strings, plus insert SPC after first string"




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

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


Received: (at 78053) by debbugs.gnu.org; 16 Jun 2025 09:20:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 16 05:20:49 2025
Received: from localhost ([127.0.0.1]:42092 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uR61J-00033v-0U
	for submit <at> debbugs.gnu.org; Mon, 16 Jun 2025 05:20:49 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:45916)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1uR61H-00033C-0C
 for 78053 <at> debbugs.gnu.org; Mon, 16 Jun 2025 05:20:47 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1uR61A-0004tU-FN; Mon, 16 Jun 2025 05:20:41 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=WlW6bJFUyiLgMv/L4mKfpEyJhysiDmXcBG/CqlLfdyA=; b=QM2PzRiByssf
 Ks2+EJGh7yhTKKWirt4eIh1P2TYBbDTqWp3zrTBYhZNuJwUpWHpoKxpGe+FlRkMLL8q/HGDrCoToS
 4vkfPED1EvgBeUG/W9OPAzKnksPNYmgur5XnO26RdaeE4K9ZCVFCcShKX1FrXsmZgvHhyzeOcugrY
 CXjIzXyV1gYl85Oenbr1z30IsobkZcjmuc4iuPNt5RPOiFb4EGEK/HQeSlJ05yGjr80T4Zv7srwJ+
 +XlGzcgy+sG++Hhis6htzlMKG/va/Zhby2U/N3uizI834+2KCYfQwoYduH/Fi52v16c2PmhO3z/qX
 bXESOfpXxW1QSNzN2u/BqA==;
Date: Mon, 16 Jun 2025 12:20:13 +0300
Message-Id: <867c1coxf6.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Rudolf Schlatte <rudi@HIDDEN>
In-Reply-To: <m11prktf0u.fsf@HIDDEN> (message from Rudolf Schlatte on
 Mon, 16 Jun 2025 07:46:25 +0200)
Subject: Re: bug#78053: [PATCH] Support strings for electric-pairs.
References: <877c39f5gt.fsf@HIDDEN> <jwvplfw96n3.fsf-monnier+emacs@HIDDEN>
 <87wma4dvcn.fsf@HIDDEN> <jwvy0ujpdoy.fsf-monnier+emacs@HIDDEN>
 <86y0u4hrn1.fsf@HIDDEN> <8734cam6py.fsf@HIDDEN>
 <86v7p1fm4y.fsf@HIDDEN> <87jz5dzkoh.fsf@HIDDEN>
 <868qltr1rd.fsf@HIDDEN> <87bjqoaigk.fsf@HIDDEN>
 <m11prktf0u.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 78053
Cc: 78053 <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: Rudolf Schlatte <rudi@HIDDEN>
> Date: Mon, 16 Jun 2025 07:46:25 +0200
> 
> > Thus, if electric-pair-pairs is set like this:
> > (setq electric-pair-pairs '(("/*" " */" t)))
> >
> > After the pair start was typed it expands to this:
> > /* | */
> >    ^ cursor
> 
> Instead of hard-coding the extra space, how about allowing the third
> element to also be a string, with that string being inserted after the
> pair start?  In java-mode, I'd then add an element ("\"\"\"" "\"\"\""
> "\n") since Java-style multi-line strings start with a mandatory
> linebreak after the opening triple-quote.

If that the Java style, then comment-start should include the newline,
no?




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

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


Received: (at submit) by debbugs.gnu.org; 16 Jun 2025 05:46:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 16 01:46:54 2025
Received: from localhost ([127.0.0.1]:39676 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uR2gI-0000lN-6b
	for submit <at> debbugs.gnu.org; Mon, 16 Jun 2025 01:46:54 -0400
Received: from lists.gnu.org ([2001:470:142::17]:37082)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <geb-bug-gnu-emacs@HIDDEN>)
 id 1uR2gF-0000kg-5G
 for submit <at> debbugs.gnu.org; Mon, 16 Jun 2025 01:46:51 -0400
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 <geb-bug-gnu-emacs@HIDDEN>)
 id 1uR2g8-0002OP-OJ
 for bug-gnu-emacs@HIDDEN; Mon, 16 Jun 2025 01:46:44 -0400
Received: from ciao.gmane.io ([116.202.254.214])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <geb-bug-gnu-emacs@HIDDEN>)
 id 1uR2g6-0007v9-L2
 for bug-gnu-emacs@HIDDEN; Mon, 16 Jun 2025 01:46:44 -0400
Received: from list by ciao.gmane.io with local (Exim 4.92)
 (envelope-from <geb-bug-gnu-emacs@HIDDEN>)
 id 1uR2fu-0005EY-Fd
 for bug-gnu-emacs@HIDDEN; Mon, 16 Jun 2025 07:46:30 +0200
X-Injected-Via-Gmane: http://gmane.org/
To: bug-gnu-emacs@HIDDEN
From: Rudolf Schlatte <rudi@HIDDEN>
Subject: Re: bug#78053: [PATCH] Support strings for electric-pairs.
Date: Mon, 16 Jun 2025 07:46:25 +0200
Message-ID: <m11prktf0u.fsf@HIDDEN>
References: <877c39f5gt.fsf@HIDDEN> <jwvplfw96n3.fsf-monnier+emacs@HIDDEN>
 <87wma4dvcn.fsf@HIDDEN> <jwvy0ujpdoy.fsf-monnier+emacs@HIDDEN>
 <86y0u4hrn1.fsf@HIDDEN> <8734cam6py.fsf@HIDDEN>
 <86v7p1fm4y.fsf@HIDDEN> <87jz5dzkoh.fsf@HIDDEN>
 <868qltr1rd.fsf@HIDDEN> <87bjqoaigk.fsf@HIDDEN>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:vcHXkR9QhyTzvzypnU3smyuM7pk=
Received-SPF: pass client-ip=116.202.254.214;
 envelope-from=geb-bug-gnu-emacs@HIDDEN; helo=ciao.gmane.io
X-Spam_score_int: -17
X-Spam_score: -1.8
X-Spam_bar: -
X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9,
 HEADER_FROM_DIFFERENT_DOMAINS=0.097, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,
 RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=no autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.1 (/)
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: -0.9 (/)

Elijah Gabe Pérez <eg642616@HIDDEN> writes:

> Eli Zaretskii <eliz@HIDDEN> writes:
>
>>> This is a kind of property for pairs (only for strings pairs), that
>>> tells to `electric-pairs` to insert a space before the first pair.
>>> 
>>> I couldn't find a better way to document this in that limited-size tag.
>>
>> If you explain to me what it does, I can try finding more clear
>> wording.
>
> That must be a list of 3 elements where specifies: pair start, pair end,
> and a non-nil value which specifies to insert an extra space after `pair
> start` was typed.
>
> Thus, if electric-pair-pairs is set like this:
> (setq electric-pair-pairs '(("/*" " */" t)))
>
> After the pair start was typed it expands to this:
> /* | */
>    ^ cursor

Instead of hard-coding the extra space, how about allowing the third
element to also be a string, with that string being inserted after the
pair start?  In java-mode, I'd then add an element ("\"\"\"" "\"\"\""
"\n") since Java-style multi-line strings start with a mandatory
linebreak after the opening triple-quote.





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

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


Received: (at 78053) by debbugs.gnu.org; 15 Jun 2025 19:55:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 15 15:55:03 2025
Received: from localhost ([127.0.0.1]:32920 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uQtRW-0008EF-TR
	for submit <at> debbugs.gnu.org; Sun, 15 Jun 2025 15:55:03 -0400
Received: from mail-oo1-xc43.google.com ([2607:f8b0:4864:20::c43]:44108)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <eg642616@HIDDEN>)
 id 1uQtRT-0008Cq-R4
 for 78053 <at> debbugs.gnu.org; Sun, 15 Jun 2025 15:55:00 -0400
Received: by mail-oo1-xc43.google.com with SMTP id
 006d021491bc7-60d6303a11eso2121208eaf.0
 for <78053 <at> debbugs.gnu.org>; Sun, 15 Jun 2025 12:54:59 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1750017294; x=1750622094; darn=debbugs.gnu.org;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=R/WewcYTObcSfC775HejKCYuE5cbvQF1D6UFmDQ6KWQ=;
 b=YxqRgEY5pZDen99hZiXKpFkJGzea3A1nT7E6FlzeOXyJwwPFOV6HABXs3j26EN+0k+
 rkvup8BxcR2yANYkGWEBXw6q7xu3t2e4ighROfPNv8DpLlq5rah8Rpfz1Dzzw2Jv2Jsv
 9VsWliE1r7G3AfBhdyh/DIisDiD26Zr+BEfPwzO1WlVV9chRd0cCV2QkpOXf1LPYULoz
 nuTCIcDxdwjHqhOs0gN/kMcAPLjeT88ESdOc+LvfgGhLLiXcgAoLr6H3XcOnzrvhpbDv
 rWeOwCqorDR27oHbqjuG6iQQtMFTcF28ZOx/5JLQ4fFOsOxX9z1zhLhX0gjKelpBAbOd
 sBdA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1750017294; x=1750622094;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=R/WewcYTObcSfC775HejKCYuE5cbvQF1D6UFmDQ6KWQ=;
 b=E0lMW7xSqMyopbCNceXEKQ9fF/dU3rbK2k3OsC+xmaV8uo5OTDSEyaz54bXqOa73F2
 taaa3396V0zBLq1cNUltXWHBtlWPjvf9wClcEAX0FyCd0YFfcqL7xwgdf8Ybxyt6hvLL
 tvLWeFEUs8CiFnwoWlFyDTVobSVG31HskzvtcR6e61yz3N29qHxM3OAra4s0GWS0nh6n
 xITfkq4Ps2+xUb5V18AntJ56ClK8Gaokry1rRJJ4BbGxEQ1bhWVzW/LzOgOzOux3o5/A
 tWLtwdQx7wLeOFrU4W8EqBv4NP9jDKEFnsSFH6T6dT/VuzVSeVnSPQziT6GsjS0QcTMv
 ybFA==
X-Gm-Message-State: AOJu0YxQtkghg2lfzP3RetZWqtotPXwc2FSxk+MQ6a+xPsXty/RF7CPp
 9DjOYOmqoYB9lL3zYVA3OdawnmeOPqXnfx8dSKOpvR60VKJdO91es2MD
X-Gm-Gg: ASbGnct9JD3wPldacYao65D4kl/AQb3nmzI2ApvDTwxNBNqOLznc2k9/6Dl6Uc+0y2I
 Dd2z+O04PWifP0MSgUr5RU1luRuXkR6m8nzwwA27avSagqz+H+3762chDfmI7Kbgp3wW4+K0PwF
 rZt2E4b5HnHrtO9zEGDWqmtxDXwzcx7WxITRoMbIimBoTYb5tnhUuMhliLP/3ubcrC+DKKOhSdD
 urgm9/74V3xtblxBmVszQhMin1jsUgaPtPFYU/St7JDYsREMfYFLMA9vsR5izDEISWMwPjt9AlL
 g0vjQxJ645W+8H3usUQtDj3F7c2NiNAxWfCDm65O
X-Google-Smtp-Source: AGHT+IHJnbo2SGRaqoOVme83f9srwMdv2u4pj5A5QAh2kJcOum9Pppx2+oVG4gJzhtHOr8M/9tHhBw==
X-Received: by 2002:a05:6870:9d09:b0:2d5:4b92:a2fc with SMTP id
 586e51a60fabf-2eaf0837216mr3679931fac.3.1750017293814; 
 Sun, 15 Jun 2025 12:54:53 -0700 (PDT)
Received: from fedora ([2806:10ae:e:8d2b::1]) by smtp.gmail.com with ESMTPSA id
 586e51a60fabf-2eab88aece2sm1596357fac.7.2025.06.15.12.54.52
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 15 Jun 2025 12:54:53 -0700 (PDT)
From: =?utf-8?Q?Elijah_Gabe_P=C3=A9rez?= <eg642616@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#78053: [PATCH] Support strings for electric-pairs.
In-Reply-To: <868qltr1rd.fsf@HIDDEN>
References: <877c39f5gt.fsf@HIDDEN> <jwvplfw96n3.fsf-monnier+emacs@HIDDEN>
 <87wma4dvcn.fsf@HIDDEN> <jwvy0ujpdoy.fsf-monnier+emacs@HIDDEN>
 <86y0u4hrn1.fsf@HIDDEN> <8734cam6py.fsf@HIDDEN>
 <86v7p1fm4y.fsf@HIDDEN> <87jz5dzkoh.fsf@HIDDEN>
 <868qltr1rd.fsf@HIDDEN>
Date: Sun, 15 Jun 2025 13:54:51 -0600
Message-ID: <87bjqoaigk.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 78053
Cc: 78053 <at> debbugs.gnu.org, monnier@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.7 (/)

Eli Zaretskii <eliz@HIDDEN> writes:

>> This is a kind of property for pairs (only for strings pairs), that
>> tells to `electric-pairs` to insert a space before the first pair.
>> 
>> I couldn't find a better way to document this in that limited-size tag.
>
> If you explain to me what it does, I can try finding more clear
> wording.

That must be a list of 3 elements where specifies: pair start, pair end,
and a non-nil value which specifies to insert an extra space after `pair
start` was typed.

Thus, if electric-pair-pairs is set like this:
(setq electric-pair-pairs '(("/*" " */" t)))

After the pair start was typed it expands to this:
/* | */
   ^ cursor

-- 
                                          - E.G via GNU Emacs and Org.




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

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


Received: (at 78053) by debbugs.gnu.org; 15 Jun 2025 05:51:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 15 01:51:39 2025
Received: from localhost ([127.0.0.1]:52236 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uQgHK-0006zh-Ld
	for submit <at> debbugs.gnu.org; Sun, 15 Jun 2025 01:51:38 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:37024)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1uQgHH-0006zD-Mw
 for 78053 <at> debbugs.gnu.org; Sun, 15 Jun 2025 01:51:36 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1uQgHC-0004Uc-2Y; Sun, 15 Jun 2025 01:51:30 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=KZx5MJ3bkpxe7sWERTGrtq60W6QP2Ox6mXGGuCGBeAM=; b=AE0a0+YlwRg3Ctvn5HbC
 Meh00+2XnnqXU8FtLx8cu4wa/b7aPP+YKBrccziFIPW/ZVvNlmq3F8XxnlndYz3r62+2qzn2h5Jr0
 Cae6+X0cxhRlcanlxwO4s92chD2JJzXdnJSQFgYG1qvVSVEmuIBoyROgJt8UQ4jKM2dRAkIM4GjGi
 xQF93fDqh+N8g9muSXvPblWIuSsolM9TsIv7m3JQRCsGW9d5tHz0A8+qFwrLP15JC3e+80HbyySH3
 y4yArfcbg7wFPVj6updvqUdBxWrgxQZVlXSbhG6QMXsyK94n8wW2qmXdf078ooOyTSEwx7hhpJ0hu
 rpmGjVdtOIF2Eg==;
Date: Sun, 15 Jun 2025 08:51:18 +0300
Message-Id: <868qltr1rd.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Elijah Gabe =?iso-8859-1?Q?P=E9rez?= <eg642616@HIDDEN>
In-Reply-To: <87jz5dzkoh.fsf@HIDDEN> (message from Elijah Gabe
 =?iso-8859-1?Q?P=E9rez?= on Sat, 14 Jun 2025 22:35:26 -0600)
Subject: Re: bug#78053: [PATCH] Support strings for electric-pairs.
References: <877c39f5gt.fsf@HIDDEN> <jwvplfw96n3.fsf-monnier+emacs@HIDDEN>
 <87wma4dvcn.fsf@HIDDEN> <jwvy0ujpdoy.fsf-monnier+emacs@HIDDEN>
 <86y0u4hrn1.fsf@HIDDEN> <8734cam6py.fsf@HIDDEN>
 <86v7p1fm4y.fsf@HIDDEN> <87jz5dzkoh.fsf@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 78053
Cc: 78053 <at> debbugs.gnu.org, monnier@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: Elijah Gabe Pérez <eg642616@HIDDEN>
> Cc: 78053 <at> debbugs.gnu.org,  monnier@HIDDEN
> Date: Sat, 14 Jun 2025 22:35:26 -0600
> 
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> >>  See also the variable `electric-pair-text-pairs'."
> >>    :version "24.1"
> >>    :group 'electricity
> >> -  :type '(repeat (cons character character)))
> >> +  :type '(repeat
> >> +          (choice (cons :tag "Characters" character character)
> >> +                  (cons :tag "Strings" string string)
> >> +                  (list :tag "Strings and insert space in pairs"
> >> +                        string string boolean))))
> >
> > What does "Strings and insert space in pairs" mean?  This tag is IMO
> > unclear, and we should clarify it.
> 
> This is a kind of property for pairs (only for strings pairs), that
> tells to `electric-pairs` to insert a space before the first pair.
> 
> I couldn't find a better way to document this in that limited-size tag.

If you explain to me what it does, I can try finding more clear
wording.




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

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


Received: (at 78053) by debbugs.gnu.org; 15 Jun 2025 04:46:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 15 00:46:41 2025
Received: from localhost ([127.0.0.1]:51741 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uQfGS-000779-HH
	for submit <at> debbugs.gnu.org; Sun, 15 Jun 2025 00:46:41 -0400
Received: from mail-oa1-x35.google.com ([2001:4860:4864:20::35]:47435)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <eg642616@HIDDEN>)
 id 1uQfGP-000764-Ch
 for 78053 <at> debbugs.gnu.org; Sun, 15 Jun 2025 00:46:38 -0400
Received: by mail-oa1-x35.google.com with SMTP id
 586e51a60fabf-2e95f0b6cb7so845472fac.3
 for <78053 <at> debbugs.gnu.org>; Sat, 14 Jun 2025 21:46:37 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1749962791; x=1750567591; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=i7rE4BQ72DPl0uR+GhYN1anryjgP98346BLvrf6q9wc=;
 b=Gd3OKlD/F5c9KRXuPUdWVXZd4f8I8531MpPl+eebfB3Shs93XUCT7f8keR+ntBQ7OK
 3O9Zwurn7xWPeZBjUO5PfKGjLBXrtFDu4n5EdAq+Z6Civ/LuX9TGg3JC2qk0eWpgosmF
 l7qSZSOQlvLDs5zqUWgh943fr8o+0Edf4drXtZVXvIJ1ryxz3C37tIxFWsjsPgvYVNtk
 9F4eoo5zscZjEinKcAAtu56LnW9VpeB+ZsIW45EOpDJfjZUaqs67jjOYXTRUOgEc29tz
 Du8F2BppcmGcJaveIUrCO3BViN2gBD85Cc2DaipFIcgghM3unG4ASbzF63LJD80s9m3b
 /T0g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1749962791; x=1750567591;
 h=content-transfer-encoding:mime-version:user-agent:message-id:date
 :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=i7rE4BQ72DPl0uR+GhYN1anryjgP98346BLvrf6q9wc=;
 b=GJ6j8GRYuUTL5bNHoAWRYXTeoM4SUz5qChcgd9egF8wTxZQCTvbX25FpbJPD123xYQ
 bZQlPBFKtMrHWHlGuj+2fyLsLMuZuJhU6gQsjpHeQSxL8VrJwzNmEzbZVXKDVlxFRFwq
 jUIWhJkTUeUPy/M++wtNf8xkdA7AmiK7jT4GT+OhskOuioel0cwgi6AqAhgVOYF/Z3+k
 I8UGZVzOkQCxUVLyZPBBaSLuSddnqbVs+U9HsATaqy/cE6iIu8UmRke841fc+9G/NBoY
 EC/y19EDEZ3qAq2PbeAflmpvgKXH0vnP1/szC2ZYv65UaH/hs7AXYd387UAKGaNphQLP
 PFZw==
X-Gm-Message-State: AOJu0YwgjeddCLVJQW+hjcrHVAAtdukKS2kWkRSYSYN3ss8vm3OEwwO5
 PBdEtOYPHj2r8ssDEG5Ojt8/FlxPsCPqGvJEyJrT9jNTOS+vYLdg3bqS
X-Gm-Gg: ASbGncso0A5qNJrOz/jIzT0YDV5qepMnKeVTgQyzumAu5utQ7mRXWlWLE5kWYhluHCv
 TZyP0vk+FJ0TnCnUuWHsRsSSCBFq71itRuZMDT6tC4f4WyBXcdyWrP/XhmETzhCJ14KSSEeGGGQ
 DsU4JhOESJufddnd2D2GcrTeg4rcWlP6lhzLgQv/EGofzs8oCw9FNFp3nO8Dk1g8Tenr9r0Mvgi
 brSuqr+7tdpR1jJ18ku+aSvrvppXxeC0c305lAQH8kwlYKA4h5y4nlAhylPul7T9EM0Xtba7f4M
 G/9ort6L5LHOgISHgpImD+WkvI7MYw==
X-Google-Smtp-Source: AGHT+IFr/M+Ew8S1ZWODtNaqFmPNoTCY6SJTBzTWU/GrqAXoudmYXV1RXyRXg/AP2bt+93VjLX0ZeQ==
X-Received: by 2002:a05:6870:6284:b0:2e9:8f0c:e322 with SMTP id
 586e51a60fabf-2eaf08370c1mr3020730fac.6.1749962791372; 
 Sat, 14 Jun 2025 21:46:31 -0700 (PDT)
Received: from fedora ([2806:10ae:e:8d2b::1]) by smtp.gmail.com with ESMTPSA id
 586e51a60fabf-2eab8f47ccesm1401510fac.50.2025.06.14.21.46.30
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 14 Jun 2025 21:46:30 -0700 (PDT)
From: =?utf-8?Q?Elijah_Gabe_P=C3=A9rez?= <eg642616@HIDDEN>
To: eg642616@HIDDEN
Subject: Re: bug#78053: [PATCH] Support strings for electric-pairs.
In-Reply-To: <87jz5dzkoh.fsf@HIDDEN>
References: <877c39f5gt.fsf@HIDDEN> <jwvplfw96n3.fsf-monnier+emacs@HIDDEN>
 <87wma4dvcn.fsf@HIDDEN> <jwvy0ujpdoy.fsf-monnier+emacs@HIDDEN>
 <86y0u4hrn1.fsf@HIDDEN> <8734cam6py.fsf@HIDDEN>
 <86v7p1fm4y.fsf@HIDDEN> <87jz5dzkoh.fsf@HIDDEN>
Date: Sat, 14 Jun 2025 22:46:29 -0600
Message-ID: <874iwhlihm.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 78053
Cc: eliz@HIDDEN, 78053 <at> debbugs.gnu.org, monnier@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.7 (/)

Elijah Gabe P=C3=A9rez <eg642616@HIDDEN> writes:

> This is a kind of property for pairs (only for strings pairs), that
> tells to `electric-pairs` to insert a space before the first pair.
                                              ^^^^^^
                                              Sorry, i meant after.

--=20
                                          - E.G via GNU Emacs and Org.




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

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


Received: (at 78053) by debbugs.gnu.org; 15 Jun 2025 04:42:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 15 00:42:08 2025
Received: from localhost ([127.0.0.1]:51710 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uQfC2-0006UY-G1
	for submit <at> debbugs.gnu.org; Sun, 15 Jun 2025 00:42:08 -0400
Received: from mail-oa1-x43.google.com ([2001:4860:4864:20::43]:56597)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <eg642616@HIDDEN>)
 id 1uQfBy-0006T7-Da
 for 78053 <at> debbugs.gnu.org; Sun, 15 Jun 2025 00:42:04 -0400
Received: by mail-oa1-x43.google.com with SMTP id
 586e51a60fabf-2ea0086338eso1793833fac.1
 for <78053 <at> debbugs.gnu.org>; Sat, 14 Jun 2025 21:42:02 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1749962516; x=1750567316; darn=debbugs.gnu.org;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=SR5c0pVMCh8ssxv1Q3A8qRgo22EYIWWckt5IZWA/5Do=;
 b=c78s44dtGEL17Y7PLiQR6LmDhRxMA356ZeJr8xz9gN/CFq+VFpHUm3fYwPIkqvH+QM
 3R6jx2RFjYYBof12y+kATbUOR+DfJqLqElDLcGAKsSrRalsZzu1OTofn5kBrkXUCCVf6
 kGVxOM+flzYtnYOHHHq1SBziIOeEe4krzRT5kL9FHCvVgXN/D6WnotZm/Ct65NXH8Zrq
 jQFP1OXTjIML4ubThbb+tV/ArS5sTiNpzIMpa9V1aiOEIOCIuqR7rAEw26GSxrjL4VsX
 qG20Mbt1Gl5wAxsgM4Lsyt6pYuth5b7zgJMWFer3YnznOq08jlaejBjd9QjFONdKIa22
 4wiA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1749962516; x=1750567316;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=SR5c0pVMCh8ssxv1Q3A8qRgo22EYIWWckt5IZWA/5Do=;
 b=vQIMilBEol+Pw5c97E4sAeXXXrDn1NbjP8XcQPjz5p44e1D+Spa5bMFsV2k/y5WG3L
 rDFYH45Tp7ETMPQB6sYzOma0wy0nj8SOoNYd19pqI1/GQvn+tAE0GokgvkCEzVSc2XJt
 BkixNeIYxXc0zyuSPxe62jTs1BHY4g2wyD+ZSpfPAb596n0Hy8UFYmLwMlUJlC3XfiK0
 OSmTXAqXPIhiUjpUxzgHwszuZsX6pUO8bF19xiCVZi5OhNu7ertqRvM+F1uTvKqbo4jW
 elNHjl8+hngvTeyVT2ZWzHOZY8Y3NjWOzlZbLaLWBL8pHKn37DaCIGeNg7vURIQrikZB
 mLgA==
X-Gm-Message-State: AOJu0Yw9NjXONeqR7Gz7AfcBFVcT/hFFKNoTfwBjm3T+jhDDRjRKo6u2
 97zXqJkN8c4rm6d+Qo/qto724Gy4/1IbzDkVdZNQ942nqaDtHOIAO1J1
X-Gm-Gg: ASbGncto2AQczfnIRUCZkqN6xcRMw6rYRdKK50yBDqu3vwZbDkfo7BqObDxjos2LyOH
 w8WkXkI6Es2eCE3hxqgxn4iP0im1eQLEGUWtlM+Nv+emSV9d61SzfZtGAJ77nZrLWS0skWhiNiX
 bT8yFqvwuggGbXf0LMlpqePdWy3e7dHk4sImMPT4j21r0/fpUF5Grw6tIiOJBHSaz6d3bUZ0dD7
 QMQHDFTdBnmN99vXHDrzUoGirq6xlTgtOFcEykfNr0u8fFjr6/jXnHCWYFzEBmmkM7kjlFYgE/A
 M08Q+Qh+mNHxjOIOe9T+Q2J+RjFUZw==
X-Google-Smtp-Source: AGHT+IG0J1YEqMDjU//CMWBYYRAROKkP/9tFzXw8bL/MhKC01/naNTIzwNyr9XyuOJMWc+aG+siu/w==
X-Received: by 2002:a05:6870:a70c:b0:2ea:7d72:23f7 with SMTP id
 586e51a60fabf-2eaf06932c5mr3035343fac.16.1749962516031; 
 Sat, 14 Jun 2025 21:41:56 -0700 (PDT)
Received: from fedora ([2806:10ae:e:8d2b::1]) by smtp.gmail.com with ESMTPSA id
 586e51a60fabf-2eab8de6b6bsm1403370fac.29.2025.06.14.21.41.54
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 14 Jun 2025 21:41:55 -0700 (PDT)
From: =?utf-8?Q?Elijah_Gabe_P=C3=A9rez?= <eg642616@HIDDEN>
To: Rudolf Schlatte <rudi@HIDDEN>
Subject: Re: bug#78053: [PATCH] Support strings for electric-pairs.
In-Reply-To: <m1v7p1s8os.fsf@HIDDEN>
References: <877c39f5gt.fsf@HIDDEN> <jwvplfw96n3.fsf-monnier+emacs@HIDDEN>
 <87wma4dvcn.fsf@HIDDEN> <jwvy0ujpdoy.fsf-monnier+emacs@HIDDEN>
 <86y0u4hrn1.fsf@HIDDEN> <8734cam6py.fsf@HIDDEN>
 <86v7p1fm4y.fsf@HIDDEN> <m1v7p1s8os.fsf@HIDDEN>
Date: Sat, 14 Jun 2025 22:41:54 -0600
Message-ID: <87frg1zkdp.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 78053
Cc: eliz@HIDDEN, 78053 <at> debbugs.gnu.org, monnier@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.7 (/)

Rudolf Schlatte <rudi@HIDDEN> writes:

> FWIW, I'd love to have this customizable instead of being a hard-coded
> space character.  The use case is the multi-line strings of recent Java
> versions, which start with three quotation marks (") and a mandatory
> line break, and end with three quotation marks.
>
> String exampleString = """
>       This is a muli-line Java string.  The shortest sequence of leading
>       white space (4 spaces in this case) will be ignored.
>       """;
>
> It would be nice if, in java-mode, after typing three quotation marks
> the buffer would end up like this (with "|" denoting the cursor
> position):
>
> String exampleString = """
>     |"""

In my tests that behavior is possible.

Ofc, this kind of pairs is limited to comparasion of characters one
(this only inserts), but I think it's more than enough for most cases.

-- 
                                          - E.G via GNU Emacs and Org.




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

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


Received: (at 78053) by debbugs.gnu.org; 15 Jun 2025 04:35:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 15 00:35:39 2025
Received: from localhost ([127.0.0.1]:51666 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uQf5m-0005hW-L6
	for submit <at> debbugs.gnu.org; Sun, 15 Jun 2025 00:35:39 -0400
Received: from mail-oo1-xc41.google.com ([2607:f8b0:4864:20::c41]:57799)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <eg642616@HIDDEN>)
 id 1uQf5j-0005gs-7z
 for 78053 <at> debbugs.gnu.org; Sun, 15 Jun 2025 00:35:35 -0400
Received: by mail-oo1-xc41.google.com with SMTP id
 006d021491bc7-60ef07eb7f4so1757357eaf.3
 for <78053 <at> debbugs.gnu.org>; Sat, 14 Jun 2025 21:35:35 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1749962129; x=1750566929; darn=debbugs.gnu.org;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=LwwFWSustzlwFGSUkYkMVfmGMFsAEzl54I9KsWskqpU=;
 b=O6F+ZyBm1D6WFGZqpcu0dLSSrvqu7zf2NcJPKKGEfugbVfJk+Ds8Q7tJIy/QJ4uunz
 IEqwvu2B8meH/RW4wAFg0ea18FWTlwKEfwjG3forP4pUz897IYOgK/m7Pd75yqvnM34Z
 rdl+n7wHNSWrXY/3b6X+S1h3eF+SOkDnUiSy1hWbllZuqOhAFvZroiYZzXJ2Q+17NXvU
 EjBKNZa+GnE/UX5OZpbaButl/1cEDL9lFFfESYRyfJTf/arPoE64Shzu0RMzwaYNEazH
 cakSICZTfDpXHni8nWxclEoxzwI9X5DKWRIl3Ds3JyPFIc9yXYh6BjltU/THTWCL7R/b
 Q3fA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1749962129; x=1750566929;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=LwwFWSustzlwFGSUkYkMVfmGMFsAEzl54I9KsWskqpU=;
 b=kT+0ri0H5xPnoD1hwSIhT6irKpSe8E0NxRgypS09kqD+4D2vTI9A0s8ZFRuYwARjdD
 t7zW9FRpSEphdY3EfN1g47PA42qPosr2LMHOnkxa32rR8r3R440E0M0kNmFH0A7HQJnP
 TKcZu2K5dBa5sFUsAM+31uZQERFVQo3unCbFyn43Z9jdbzy8hQoouKSkNdjcBAs3H8sj
 QzQEi75U8wCf0ZXBmONHvjgzNNPSNgB5myMziPwnB2XctqsxhFrpMiky0SvgCPYg/ALd
 G+9q0AAmbWbhhkR3AfvIJjvEXOypt6J8ODRT0JeLHj3hoIs1z9qAURr+EyZb0wc/Erll
 tvRQ==
X-Gm-Message-State: AOJu0Ywza6i/4NLsd4GuLS2Y1agFIO5SLL8PLa5yQ3qIuLe1YzEY1bpa
 48JuPQkqfOqDy+0qzxQRbta2OP7SjAZvb/nUyxf9VHrzd89lZ8+AdjjL
X-Gm-Gg: ASbGncshKvGYFAQLIu1V8+gCT0y2lU92UO3uLx/1SIC+TjYJxdB1BETA5d9cJVJ+z7d
 vWvjssAvK9ci5/sxRUHT4kgAOBMhYYuKlyrNccK8N1SfYAi6s0AdiDykDe8D0a8LYVm2wlYXMpP
 w9QingR2wErR4H5dsEU1hyums09WQJOiD41dDtnV9zrwN4sHrkpJRJw5K17skQRF4RbCzf+sy0U
 FCZibZ+jCLAdu0feAG+sLBJPBahxuf9p5iyTuP2eZpqJbNbPjUv1SYhbk/Y+B2lAmt9AI0a7zi3
 jYTcWKoYPtv5RNHgZUsEgkoHWDtA7w==
X-Google-Smtp-Source: AGHT+IGoq2OIBSvyhu4a8jnXSnxgZtjrcRcb/OPLPziOKIqMOSYGGcTgjuND+Me1y5ksF13jMs329A==
X-Received: by 2002:a05:6820:222a:b0:610:e959:7db8 with SMTP id
 006d021491bc7-61111009cecmr3160274eaf.8.1749962129209; 
 Sat, 14 Jun 2025 21:35:29 -0700 (PDT)
Received: from fedora ([2806:10ae:e:8d2b::1]) by smtp.gmail.com with ESMTPSA id
 006d021491bc7-61108da5494sm569336eaf.9.2025.06.14.21.35.27
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 14 Jun 2025 21:35:28 -0700 (PDT)
From: =?utf-8?Q?Elijah_Gabe_P=C3=A9rez?= <eg642616@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#78053: [PATCH] Support strings for electric-pairs.
In-Reply-To: <86v7p1fm4y.fsf@HIDDEN>
References: <877c39f5gt.fsf@HIDDEN> <jwvplfw96n3.fsf-monnier+emacs@HIDDEN>
 <87wma4dvcn.fsf@HIDDEN> <jwvy0ujpdoy.fsf-monnier+emacs@HIDDEN>
 <86y0u4hrn1.fsf@HIDDEN> <8734cam6py.fsf@HIDDEN>
 <86v7p1fm4y.fsf@HIDDEN>
Date: Sat, 14 Jun 2025 22:35:26 -0600
Message-ID: <87jz5dzkoh.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 78053
Cc: 78053 <at> debbugs.gnu.org, monnier@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.7 (/)

Eli Zaretskii <eliz@HIDDEN> writes:

>>  See also the variable `electric-pair-text-pairs'."
>>    :version "24.1"
>>    :group 'electricity
>> -  :type '(repeat (cons character character)))
>> +  :type '(repeat
>> +          (choice (cons :tag "Characters" character character)
>> +                  (cons :tag "Strings" string string)
>> +                  (list :tag "Strings and insert space in pairs"
>> +                        string string boolean))))
>
> What does "Strings and insert space in pairs" mean?  This tag is IMO
> unclear, and we should clarify it.

This is a kind of property for pairs (only for strings pairs), that
tells to `electric-pairs` to insert a space before the first pair.

I couldn't find a better way to document this in that limited-size tag.

-- 
                                          - E.G via GNU Emacs and Org.




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

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


Received: (at submit) by debbugs.gnu.org; 12 Jun 2025 07:47:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jun 12 03:47:39 2025
Received: from localhost ([127.0.0.1]:55890 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uPcew-0002fJ-Pn
	for submit <at> debbugs.gnu.org; Thu, 12 Jun 2025 03:47:39 -0400
Received: from lists.gnu.org ([2001:470:142::17]:59108)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <geb-bug-gnu-emacs@HIDDEN>)
 id 1uPceu-0002eW-Fz
 for submit <at> debbugs.gnu.org; Thu, 12 Jun 2025 03:47:37 -0400
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 <geb-bug-gnu-emacs@HIDDEN>)
 id 1uPceo-0000An-Fl
 for bug-gnu-emacs@HIDDEN; Thu, 12 Jun 2025 03:47:30 -0400
Received: from ciao.gmane.io ([116.202.254.214])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <geb-bug-gnu-emacs@HIDDEN>)
 id 1uPcej-0007Zm-Gq
 for bug-gnu-emacs@HIDDEN; Thu, 12 Jun 2025 03:47:29 -0400
Received: from list by ciao.gmane.io with local (Exim 4.92)
 (envelope-from <geb-bug-gnu-emacs@HIDDEN>)
 id 1uPcee-0003yn-Lo
 for bug-gnu-emacs@HIDDEN; Thu, 12 Jun 2025 09:47:20 +0200
X-Injected-Via-Gmane: http://gmane.org/
To: bug-gnu-emacs@HIDDEN
From: Rudolf Schlatte <rudi@HIDDEN>
Subject: Re: bug#78053: [PATCH] Support strings for electric-pairs.
Date: Thu, 12 Jun 2025 09:47:15 +0200
Message-ID: <m1v7p1s8os.fsf@HIDDEN>
References: <877c39f5gt.fsf@HIDDEN> <jwvplfw96n3.fsf-monnier+emacs@HIDDEN>
 <87wma4dvcn.fsf@HIDDEN> <jwvy0ujpdoy.fsf-monnier+emacs@HIDDEN>
 <86y0u4hrn1.fsf@HIDDEN> <8734cam6py.fsf@HIDDEN>
 <86v7p1fm4y.fsf@HIDDEN>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:rHb/8jOWIZ0QANaaHB6xoAkepks=
Received-SPF: pass client-ip=116.202.254.214;
 envelope-from=geb-bug-gnu-emacs@HIDDEN; helo=ciao.gmane.io
X-Spam_score_int: -17
X-Spam_score: -1.8
X-Spam_bar: -
X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9,
 HEADER_FROM_DIFFERENT_DOMAINS=0.097, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,
 RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=no autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.1 (/)
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: -0.9 (/)

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: Elijah Gabe Pérez <eg642616@HIDDEN>
>> Cc: Stefan Monnier <monnier@HIDDEN>,  78053 <at> debbugs.gnu.org,
>>   joaotavora@HIDDEN
>> Date: Sun, 08 Jun 2025 12:24:57 -0600
>> 
>> Eli Zaretskii <eliz@HIDDEN> writes:
>> 
>> > Is the last patch okay to install?  If not, Elijah, would you please
>> > submit an updated patch?
>> 
>> Sure, I'm sending here a better version.
>> 
>> I made a few minor changes since I found several bugs.
>> If there are no objections, the patch is ready to be installed.
>
> Thanks, a few further minor comments:
>
>> +---
>> +** Electric pair mode now supports multi-character paired delimiters.
>> +This is done by supporting strings in electric-pair-pairs.
>
> the last sentence should be rewritten to tell users how to use this
> feature instead of how it was implemented.  For example:
>
>   To use this, customize 'electric-pair-pairs' to include the
>   delimiter strings.
>
> (Note that this also quotes symbols, like we do in NEWS.)
>
>>  See also the variable `electric-pair-text-pairs'."
>>    :version "24.1"
>>    :group 'electricity
>> -  :type '(repeat (cons character character)))
>> +  :type '(repeat
>> +          (choice (cons :tag "Characters" character character)
>> +                  (cons :tag "Strings" string string)
>> +                  (list :tag "Strings and insert space in pairs"
>> +                        string string boolean))))
>
> What does "Strings and insert space in pairs" mean?  This tag is IMO
> unclear, and we should clarify it.

FWIW, I'd love to have this customizable instead of being a hard-coded
space character.  The use case is the multi-line strings of recent Java
versions, which start with three quotation marks (") and a mandatory
line break, and end with three quotation marks.

String exampleString = """
      This is a muli-line Java string.  The shortest sequence of leading
      white space (4 spaces in this case) will be ignored.
      """;

It would be nice if, in java-mode, after typing three quotation marks
the buffer would end up like this (with "|" denoting the cursor
position):

String exampleString = """
    |"""





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

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


Received: (at 78053) by debbugs.gnu.org; 12 Jun 2025 07:35:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jun 12 03:35:22 2025
Received: from localhost ([127.0.0.1]:55749 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uPcT3-0001qN-Fx
	for submit <at> debbugs.gnu.org; Thu, 12 Jun 2025 03:35:22 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:57700)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1uPcT0-0001pw-Su
 for 78053 <at> debbugs.gnu.org; Thu, 12 Jun 2025 03:35:19 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1uPcSv-00062B-7H; Thu, 12 Jun 2025 03:35:13 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=lH3kZiAMTwqx8tmxQ0xi4gwkaH1fJEKd9LHs6Fq9M8Y=; b=O4XaKUizmxTtWJvx813j
 q55edOzbzNxTmA/XMH82OyoEtmCPCvAZp8Azy5fTZXfWeDl+/Im1pY8g+bmCuS5UYbe5IYDN47OpX
 hhypq9WQWcRyJzVZvbei10wHc+KazX9+zs4UXLd5jS1sLUW6UXUWZ4/p9sACpLvnQ4lbfZYL5I5Ij
 5aNAVVlJ396pE2w8GG5Z/xH5ir5DLRszvjV9E8//d2uhEVw68GX7X8ROKg+0RkE6ll2E1PM+8FhmB
 AGJzm5IFuF5KUerJHitgmS9rBEZK1VarftUscj6MPULU22IiHVNGCdqMSfTvwBve7lY5umEluT3Np
 V34TnmhKQArE2w==;
Date: Thu, 12 Jun 2025 10:35:09 +0300
Message-Id: <86v7p1fm4y.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Elijah Gabe =?iso-8859-1?Q?P=E9rez?= <eg642616@HIDDEN>
In-Reply-To: <8734cam6py.fsf@HIDDEN> (message from Elijah Gabe
 =?iso-8859-1?Q?P=E9rez?= on Sun, 08 Jun 2025 12:24:57 -0600)
Subject: Re: bug#78053: [PATCH] Support strings for electric-pairs.
References: <877c39f5gt.fsf@HIDDEN> <jwvplfw96n3.fsf-monnier+emacs@HIDDEN>
 <87wma4dvcn.fsf@HIDDEN> <jwvy0ujpdoy.fsf-monnier+emacs@HIDDEN>
 <86y0u4hrn1.fsf@HIDDEN> <8734cam6py.fsf@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 78053
Cc: 78053 <at> debbugs.gnu.org, monnier@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: Elijah Gabe Pérez <eg642616@HIDDEN>
> Cc: Stefan Monnier <monnier@HIDDEN>,  78053 <at> debbugs.gnu.org,
>   joaotavora@HIDDEN
> Date: Sun, 08 Jun 2025 12:24:57 -0600
> 
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> > Is the last patch okay to install?  If not, Elijah, would you please
> > submit an updated patch?
> 
> Sure, I'm sending here a better version.
> 
> I made a few minor changes since I found several bugs.
> If there are no objections, the patch is ready to be installed.

Thanks, a few further minor comments:

> +---
> +** Electric pair mode now supports multi-character paired delimiters.
> +This is done by supporting strings in electric-pair-pairs.

the last sentence should be rewritten to tell users how to use this
feature instead of how it was implemented.  For example:

  To use this, customize 'electric-pair-pairs' to include the
  delimiter strings.

(Note that this also quotes symbols, like we do in NEWS.)

>  See also the variable `electric-pair-text-pairs'."
>    :version "24.1"
>    :group 'electricity
> -  :type '(repeat (cons character character)))
> +  :type '(repeat
> +          (choice (cons :tag "Characters" character character)
> +                  (cons :tag "Strings" string string)
> +                  (list :tag "Strings and insert space in pairs"
> +                        string string boolean))))

What does "Strings and insert space in pairs" mean?  This tag is IMO
unclear, and we should clarify it.

> @@ -51,10 +57,16 @@ electric-pair-text-pairs
>  
>  Pairs of delimiters in this list are a fallback in case they have
>  no syntax relevant to `electric-pair-mode' in the syntax table
> -defined in `electric-pair-text-syntax-table'."
> +defined in `electric-pair-text-syntax-table'.
> +
> +NOTE: In string pairs, the first pair is a regular expression."
>    :version "24.4"
>    :group 'electricity
> -  :type '(repeat (cons character character)))
> +  :type '(repeat
> +          (choice (cons :tag "Characters" character character)
> +                  (cons :tag "Strings" string string)
> +                  (list :tag "Strings and insert space in pairs"
> +                        string string boolean))))

Likewise here.




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

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


Received: (at 78053) by debbugs.gnu.org; 8 Jun 2025 18:25:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 08 14:25:08 2025
Received: from localhost ([127.0.0.1]:52875 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uOKhf-0004SL-SQ
	for submit <at> debbugs.gnu.org; Sun, 08 Jun 2025 14:25:08 -0400
Received: from mail-ot1-x344.google.com ([2607:f8b0:4864:20::344]:54507)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <eg642616@HIDDEN>)
 id 1uOKhd-0004Ri-LK
 for 78053 <at> debbugs.gnu.org; Sun, 08 Jun 2025 14:25:06 -0400
Received: by mail-ot1-x344.google.com with SMTP id
 46e09a7af769-735a8be4ea9so905047a34.0
 for <78053 <at> debbugs.gnu.org>; Sun, 08 Jun 2025 11:25:05 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1749407099; x=1750011899; darn=debbugs.gnu.org;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=zv3+QmSpxqus9AoOqukFKBWQP+m6DF7ceZpk8lAAIaY=;
 b=DHhWQluhBj2oxNw13FTHs27nnU3M57Ax9vGQ7VGabK25wvtCl4GuQ7p6SAW4KVmxM/
 7M+0Cb3Vx3a7Chj6OWKm6oXTiavRG5CXwicNuivakcgB9DuNaUlhbXJkR0Hap5Hzl7um
 6ohpKLwyCIuXTJlCg7QvThqJp3eU5C6AnmMDVuoTBhqDz+FpMgkH+B6PQAnPLlmqfD4I
 KrjhoscZ16sYfFdYNCUCHyqxkvCIzQHHgN796Yt5G0HVH0UqEZwI1PxP0hgeleYbcU+o
 +bAnUK9ZtY4N0t065Q1A3OKDqyIIAjxHh90NOLifSlS9OIVuqBlC92Eqq0NJzSW7SrOq
 vZPw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1749407099; x=1750011899;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=zv3+QmSpxqus9AoOqukFKBWQP+m6DF7ceZpk8lAAIaY=;
 b=jcxVZ007/Zl4jf+3TLFQLpesVG7GbaRo2thsoINNHcHrGSkrPZ81QL5PpDIA26+kKy
 ynHo2INoPed3ngMV919yxuAuQQWceMcWu16fy6de5INm7pKX+3M2ncPsJaph/OCM4tpl
 E/1Fw8BZf6dUXQDYzFejfU6eIbiFVI23TPQNHkxKOZClxGaaNjHwCMlkohCVj7uvl9t1
 ob25ajkEjjeaNGTPoBslfiZJwtZnslzWm0115mRjVC9Na0X1DNNyDt8Ln+Dp9D9SGRiW
 droP0Lp9zHA3wlt+xk3r1Ur92EgK9QhX4zSunA1SX7tlrjpYiV7+bHD80L+6vFacSqoV
 dtoQ==
X-Forwarded-Encrypted: i=1;
 AJvYcCXJn0o1x83V5uZW0BYV7B6h5S6xnsHBKaOCGEnU5fgJFLDbU2kEVanSU4J/gJNVQJ3tdTKWMQ==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YxjIf5lkq2o4JA6uQkHvUznsZV37KECMEWjJXfFh31poGnxRGr2
 +4pIQ2CZywClS8KQOOY5Ly33H3plN31JnDt5F/aTOsKfk9FlBEsA0kdj
X-Gm-Gg: ASbGncugmwUt3Qon/jeb51y3RU4hix1ntpaTuVgPxpu7G25L8IG7FZZtIXiAWlK44pk
 vZtcYBu4FRhBTm+rRhMzO5XmAIuBNZESLNhT35IcgrsLW5l6CZdwWerMb+3wuiPD6R+ZZzLKRhy
 FuewhWslGKnSvh0sMmzu9AmEUuNR5LfmgbdFfDT/08fbsgCfm59LtRmz1MmhdxYTanChj1a1c1o
 dZxMrE+6iz4dGbnAvnL7cgRlF2t4CvrBGdVONWJ/CMJUDiEg2wjBn7PeamWN4XngWOMv9RyBR0s
 BZIrcALFOo2/6el0Jfudt6NSrXitRA==
X-Google-Smtp-Source: AGHT+IGGNgA9mzva5Do+BGwyiXa1d/fGUKtZ2nuK3E5n6RjMxIOHGIxDD/pLZt2EqTs/LWpzAG7CVg==
X-Received: by 2002:a05:6830:6588:b0:727:3957:8522 with SMTP id
 46e09a7af769-73888ed9eacmr7914237a34.20.1749407099513; 
 Sun, 08 Jun 2025 11:24:59 -0700 (PDT)
Received: from fedora ([2806:10ae:e:8825::1]) by smtp.gmail.com with ESMTPSA id
 46e09a7af769-73889f5a1a1sm1252777a34.17.2025.06.08.11.24.58
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 08 Jun 2025 11:24:58 -0700 (PDT)
From: =?utf-8?Q?Elijah_Gabe_P=C3=A9rez?= <eg642616@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#78053: [PATCH] Support strings for electric-pairs.
In-Reply-To: <86y0u4hrn1.fsf@HIDDEN>
References: <877c39f5gt.fsf@HIDDEN> <jwvplfw96n3.fsf-monnier+emacs@HIDDEN>
 <87wma4dvcn.fsf@HIDDEN> <jwvy0ujpdoy.fsf-monnier+emacs@HIDDEN>
 <86y0u4hrn1.fsf@HIDDEN>
Date: Sun, 08 Jun 2025 12:24:57 -0600
Message-ID: <8734cam6py.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 78053
Cc: 78053 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>,
 joaotavora@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.7 (/)

--=-=-=
Content-Type: text/plain

Eli Zaretskii <eliz@HIDDEN> writes:

> Is the last patch okay to install?  If not, Elijah, would you please
> submit an updated patch?

Sure, I'm sending here a better version.

I made a few minor changes since I found several bugs.
If there are no objections, the patch is ready to be installed.


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-Support-strings-for-electric-pairs.-Bug-78053.patch

From c4454a65b48ec33a1a22186ab4c3767d1496e618 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?El=C3=ADas=20Gabriel=20P=C3=A9rez?= <eg642616@HIDDEN>
Date: Thu, 24 Apr 2025 17:34:58 -0600
Subject: [PATCH] Support strings for electric-pairs.  (Bug#78053)

This add support for string pairs in electric-pairs-mode.  For
example, typing '/*' in c-mode and derived will auto insert
' */', or in sh-mode 'case ' inserts 'esac'.

* lisp/elec-pair.el (electric-pair-pairs): Add new defcustom
types.
(electric-pair-syntax-info)
(electric-pair-post-self-insert-function): Add support for
strings.
* etc/NEWS: Announce changes.
---
 etc/NEWS          |  4 ++++
 lisp/elec-pair.el | 42 ++++++++++++++++++++++++++++++++++++++----
 2 files changed, 42 insertions(+), 4 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index ade5abc43fc..bd514b110d8 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -527,6 +527,10 @@ You can now insert or wrap text with multiple sets of parentheses and
 other matching delimiters at once with Electric Pair mode, by providing
 a prefix argument when inserting one of the delimiters.
 
+---
+** Electric pair mode now supports multi-character paired delimiters.
+This is done by supporting strings in electric-pair-pairs.
+
 +++
 ** You can now use 'M-~' during 'C-x s' ('save-some-buffers').
 Typing 'M-~' while saving some buffers means not to save the buffer and
diff --git a/lisp/elec-pair.el b/lisp/elec-pair.el
index aa2577300fd..0481d0d467b 100644
--- a/lisp/elec-pair.el
+++ b/lisp/elec-pair.el
@@ -38,10 +38,16 @@ electric-pair-pairs
 no syntax relevant to `electric-pair-mode' in the mode's syntax
 table.
 
+NOTE: In string pairs, the first pair is a regular expression.
+
 See also the variable `electric-pair-text-pairs'."
   :version "24.1"
   :group 'electricity
-  :type '(repeat (cons character character)))
+  :type '(repeat
+          (choice (cons :tag "Characters" character character)
+                  (cons :tag "Strings" string string)
+                  (list :tag "Strings and insert space in pairs"
+                        string string boolean))))
 
 (defcustom electric-pair-text-pairs
   `((?\" . ?\")
@@ -51,10 +57,16 @@ electric-pair-text-pairs
 
 Pairs of delimiters in this list are a fallback in case they have
 no syntax relevant to `electric-pair-mode' in the syntax table
-defined in `electric-pair-text-syntax-table'."
+defined in `electric-pair-text-syntax-table'.
+
+NOTE: In string pairs, the first pair is a regular expression."
   :version "24.4"
   :group 'electricity
-  :type '(repeat (cons character character)))
+  :type '(repeat
+          (choice (cons :tag "Characters" character character)
+                  (cons :tag "Strings" string string)
+                  (list :tag "Strings and insert space in pairs"
+                        string string boolean))))
 
 (defcustom electric-pair-skip-self #'electric-pair-default-skip-self
   "If non-nil, skip char instead of inserting a second closing paren.
@@ -252,6 +264,22 @@ electric-pair-syntax-info
          (direct (assq command-event fallback))
          (reverse (rassq command-event fallback)))
     (cond
+     ((cl-loop
+       for pairs in fallback
+       if (and
+	   (stringp (car pairs))
+	   (looking-back (car pairs) (pos-bol)))
+         return (list
+                 'str
+                 ;; Get pair ender
+                 (if (proper-list-p pairs)
+                     (nth 1 pairs)
+                   (cdr pairs))
+                 nil
+                 ;; Check if pairs have to insert a space after
+                 ;; first pair was inserted.
+                 (if (proper-list-p pairs)
+                     (nth 2 pairs)))))
      ((memq (car table-syntax-and-pair)
             '(?\" ?\( ?\) ?\$))
       (append table-syntax-and-pair (list nil string-or-comment)))
@@ -533,7 +561,7 @@ electric-pair-post-self-insert-function
          (beg (when num (- pos num)))
          (skip-whitespace-info))
     (pcase (electric-pair-syntax-info last-command-event)
-      (`(,syntax ,pair ,unconditional ,_)
+      (`(,syntax ,pair ,unconditional ,space)
        (cond
         ((null pos) nil)
         ((zerop num) nil)
@@ -591,6 +619,12 @@ electric-pair-post-self-insert-function
                               pos))
          (forward-char num))
         ;; Insert matching pair.
+        ;; String pairs
+        ((and (eq syntax 'str) (not overwrite-mode))
+         (if space (insert " "))
+         (save-excursion
+           (insert pair)))
+        ;; Char pairs
         ((and (memq syntax '(?\( ?\" ?\$))
               (not overwrite-mode)
               (or unconditional
-- 
2.49.0


--=-=-=
Content-Type: text/plain


-- 
                                          - E.G via GNU Emacs and Org.

--=-=-=--




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

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


Received: (at 78053) by debbugs.gnu.org; 7 Jun 2025 08:40:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jun 07 04:40:00 2025
Received: from localhost ([127.0.0.1]:46807 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uNp5s-0005a7-54
	for submit <at> debbugs.gnu.org; Sat, 07 Jun 2025 04:40:00 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:41008)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1uNp5p-0005Zp-DS
 for 78053 <at> debbugs.gnu.org; Sat, 07 Jun 2025 04:39:57 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1uNp5j-000594-Tr; Sat, 07 Jun 2025 04:39:51 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=rYGnGAZ8unyRF+Zyb1LDwMkgT6fwKXTsdkmRWsV7Ku4=; b=TUTBdDlSS5Gfh2GaJt/X
 FK0w9KBoha/M7J5ASNbMbbgobyOyjV+DpzZKUJ2y1/EHlXH7G9FOXZJVc7WKbAFFgbvkU5aPqdJdf
 PjEmPPolytVruh2/r5rvrsRwuf+KBujKKZEkSkzBU2zmvRVQuzztPe8l6b7gZUDuOv/xdXWBtxLaT
 WlIqRf5Nz3OKVNE1fvkWKLU3/SGP/mJmSi52P3TeeC6ieZh6/nd+6OXq9pw8o7pGJbXCqQ7MBYlOY
 Ip29FojIhZtcF6GrvQpRwWEYARtXEBwI0fGBXP8two16dhyUsa3Ld+J2201tOpovsCnnABPdJSYZU
 fVGDT9glYkNiAQ==;
Date: Sat, 07 Jun 2025 11:39:46 +0300
Message-Id: <86y0u4hrn1.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: eg642616@HIDDEN, Stefan Monnier <monnier@HIDDEN>
In-Reply-To: <jwvy0ujpdoy.fsf-monnier+emacs@HIDDEN> (bug-gnu-emacs@HIDDEN)
Subject: Re: bug#78053: [PATCH] Support strings for electric-pairs.
References: <877c39f5gt.fsf@HIDDEN> <jwvplfw96n3.fsf-monnier+emacs@HIDDEN>
 <87wma4dvcn.fsf@HIDDEN> <jwvy0ujpdoy.fsf-monnier+emacs@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: 78053
Cc: 78053 <at> debbugs.gnu.org, joaotavora@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 (---)

> Cc: 78053 <at> debbugs.gnu.org,
>  João Távora <joaotavora@HIDDEN>
> Date: Mon, 26 May 2025 12:03:00 -0400
> From:  Stefan Monnier via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
> 
> >>> +     ((if-let* ((str-pair
> >>> +		 (cl-loop for pairs in fallback
> >>> +			  do
> >>> +			  (if (and
> >>> +			       (stringp (car pairs))
> >>> +			       (looking-back
> >>> +				(regexp-quote (car pairs))
> >>> +				(- (point) (length (car pairs)))))
> >>> +			      (cl-return (cdr pairs))))))
> >>> +	  (list 'str str-pair nil nil))))))
> >>
> >> BTW, here you could use `compare-buffer-substrings`.
> >
> > Thanks, Can you explain how to use it in this case?  AFAIK
> > `compare-buffer-substrings' needs 2 strings in the buffer for the
> > comparison.
> 
> Duh, you're right, it can't be used here.
> We should probably extend `compare-strings` to accept buffer arguments
> and then obsolete `compare-buffer-substrings'.
> 
> >>>  (defun electric-pair--insert (char times)
> >>>    (let ((last-command-event char)
> >>> @@ -591,6 +604,11 @@ electric-pair-post-self-insert-function
> >>>                                pos))
> >>>           (forward-char num))
> >>>          ;; Insert matching pair.
> >>> +        ;; String pairs
> >>> +        ((and (eq syntax 'str) (not overwrite-mode))
> >>> +         (insert " ")
> >>> +         (save-excursion (insert " " pair)))
> >>> +        ;; Char pairs
> >>>          ((and (memq syntax '(?\( ?\" ?\$))
> >>>                (not overwrite-mode)
> >>>                (or unconditional
> >>
> >> I can imagine some multi-char delimiters which don't call for spaces
> >> inside of them (e.g. LaTeX's ``...''), so maybe the entries in
> >> `electric-pair-pairs` should have some extra info about it.
> >> I suggest we replace the (STRING . STRING) format with
> >> (STRING STRING ...) so we can put extra info in the `...`.
> >
> > Are you sure it's good idea to replace the cons cell form with a list?
> 
> We need to keep supporting the (CHAR . CHAR) form, of course, but yes,
> I think using (STRING STRING . PROPERTIES) is a better option than
> (STRING . STRING) and there is no backward compatibility need to
> support (STRING . STRING).

Is the last patch okay to install?  If not, Elijah, would you please
submit an updated patch?




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

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


Received: (at 78053) by debbugs.gnu.org; 26 May 2025 16:03:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 26 12:03:16 2025
Received: from localhost ([127.0.0.1]:58472 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uJaIF-0002qr-RI
	for submit <at> debbugs.gnu.org; Mon, 26 May 2025 12:03:16 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:6212)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <monnier@HIDDEN>)
 id 1uJaIC-0002qO-QP
 for 78053 <at> debbugs.gnu.org; Mon, 26 May 2025 12:03:13 -0400
Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 82DC94415E1;
 Mon, 26 May 2025 12:03:06 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1748275381;
 bh=OrYLCLuvNKahF7bSfEqQdRqTN7ip9jrJDBTRhH8MLJ0=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=RlUSAMegR6+goxjqMJfX2pW01pdSsBJkpEjFNAuMG5Y3hvIe8NhthD35hy+qVbuQZ
 Tv0pZdSfvgsmKv2Gf1kMLLapN8ZgP390mRpdmIaQWQOWvz0IlyTZVIE/mWX4+NGCFb
 i8ji9Upm4Y0mhF4HEeUgvAaInD7euXW4/yTkG9sJWHEGRZBFeyzCjz556fFryNITPT
 z3OsBgV9ANKw78N76qZXzFvvqnegUATX8Q/ieCJL/3NhAu7T7dkcvd9XV7eRROgM6Z
 BBRwvkzagMKQjw21X67K3gMD2fB4W1Miwk2HdDq6/LCxcA3+z7TyhcmpQt0yOVp4d8
 qkUafVDcvueKA==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 41C784415D5;
 Mon, 26 May 2025 12:03:01 -0400 (EDT)
Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 340EE12058B;
 Mon, 26 May 2025 12:03:01 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Elijah Gabe =?windows-1252?Q?P=E9rez?= <eg642616@HIDDEN>
Subject: Re: bug#78053: [PATCH] Support strings for electric-pairs.
In-Reply-To: <87wma4dvcn.fsf@HIDDEN>
Message-ID: <jwvy0ujpdoy.fsf-monnier+emacs@HIDDEN>
References: <877c39f5gt.fsf@HIDDEN> <jwvplfw96n3.fsf-monnier+emacs@HIDDEN>
 <87wma4dvcn.fsf@HIDDEN>
Date: Mon, 26 May 2025 12:03:00 -0400
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL 0.162 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
 DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 78053
Cc: 78053 <at> debbugs.gnu.org,
 =?windows-1252?B?Sm/jbyBU4XZvcmE=?= <joaotavora@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 (---)

>>> +     ((if-let* ((str-pair
>>> +		 (cl-loop for pairs in fallback
>>> +			  do
>>> +			  (if (and
>>> +			       (stringp (car pairs))
>>> +			       (looking-back
>>> +				(regexp-quote (car pairs))
>>> +				(- (point) (length (car pairs)))))
>>> +			      (cl-return (cdr pairs))))))
>>> +	  (list 'str str-pair nil nil))))))
>>
>> BTW, here you could use `compare-buffer-substrings`.
>
> Thanks, Can you explain how to use it in this case?  AFAIK
> `compare-buffer-substrings' needs 2 strings in the buffer for the
> comparison.

Duh, you're right, it can't be used here.
We should probably extend `compare-strings` to accept buffer arguments
and then obsolete `compare-buffer-substrings'.

>>>  (defun electric-pair--insert (char times)
>>>    (let ((last-command-event char)
>>> @@ -591,6 +604,11 @@ electric-pair-post-self-insert-function
>>>                                pos))
>>>           (forward-char num))
>>>          ;; Insert matching pair.
>>> +        ;; String pairs
>>> +        ((and (eq syntax 'str) (not overwrite-mode))
>>> +         (insert " ")
>>> +         (save-excursion (insert " " pair)))
>>> +        ;; Char pairs
>>>          ((and (memq syntax '(?\( ?\" ?\$))
>>>                (not overwrite-mode)
>>>                (or unconditional
>>
>> I can imagine some multi-char delimiters which don't call for spaces
>> inside of them (e.g. LaTeX's ``...''), so maybe the entries in
>> `electric-pair-pairs` should have some extra info about it.
>> I suggest we replace the (STRING . STRING) format with
>> (STRING STRING ...) so we can put extra info in the `...`.
>
> Are you sure it's good idea to replace the cons cell form with a list?

We need to keep supporting the (CHAR . CHAR) form, of course, but yes,
I think using (STRING STRING . PROPERTIES) is a better option than
(STRING . STRING) and there is no backward compatibility need to
support (STRING . STRING).


        Stefan





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

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


Received: (at 78053) by debbugs.gnu.org; 26 May 2025 01:17:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 25 21:17:11 2025
Received: from localhost ([127.0.0.1]:51011 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uJMSk-00084J-Sf
	for submit <at> debbugs.gnu.org; Sun, 25 May 2025 21:17:11 -0400
Received: from mail-ot1-x343.google.com ([2607:f8b0:4864:20::343]:51689)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <eg642616@HIDDEN>)
 id 1uJMSf-00082o-QG
 for 78053 <at> debbugs.gnu.org; Sun, 25 May 2025 21:17:07 -0400
Received: by mail-ot1-x343.google.com with SMTP id
 46e09a7af769-72c40235c34so408321a34.3
 for <78053 <at> debbugs.gnu.org>; Sun, 25 May 2025 18:17:05 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1748222220; x=1748827020; darn=debbugs.gnu.org;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=LSCKyYrnF9lfrNyDXzCSt3C1GNnQGC3MX4Vg5Vq8Zk0=;
 b=GGOy8yGqZ2fu2wkOi0EMvM56UVqgpTGwLlMXb33Of/ey7y/XELswuUQ/IPerSUpfuL
 0fJ+2ayX058vRL3jyR2lGmpoDrMr8nZ82BH0mNyXo+iimUKPNNHCMaMzokeAycZiCkmw
 gLEfJ6U6+21Oxqnmbk23/1R75H12mbmklIgCqmMjs43+JBDW44knnhTGO9aQmY9HYsm0
 n+fYmKgNB03zNIhbhGZhIkakrFUJPoqf5l9Bg1OSM2SKuy7oF6k1mAeodkKjmXnL4Cgu
 kU38aXg0h5omWMNWJuwtSBlaxAQW6gQlTKDFfeclVCAMV/9i21B5IjLI7+ngqd1/uifX
 ia/A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1748222220; x=1748827020;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=LSCKyYrnF9lfrNyDXzCSt3C1GNnQGC3MX4Vg5Vq8Zk0=;
 b=OR113QY6rmcL1S6OIXf9IYxZRwOvPqRJr8ex6iSnxgJ8RwRAzWQQW2oN3fmrPLVaev
 EOrFIBGpNpIMfb9B5VD44ApPDfrQBk0EGVylmHeJ05fZ39v6NvPWZo+xcYE7P3TLTM4+
 qJXxUvGlnD8r1+dQnMzzVXau5kGmbWBgcKypCihhyFVuZBsAfjKNACgElMW6kX7qr1M6
 U6VFr1Z0fzUFxOXAtxl0R5gS7B0eh22DPPS3eNMae8X/cOXfqwq88f3DcwaMm8/wCO5n
 0DMCkFGfbWMI9CFYHeOxL0YVsIi1N+LTMQX8Ol1eDOykFIMTVnNDUGVXy8WtM5uA5vvT
 u1bQ==
X-Forwarded-Encrypted: i=1;
 AJvYcCWuf0pqAxBPTl+j3h+wgIljoufFcqe4tNfZsV7UBfdJLMcFKesr78YRiKsdOPp4eDYqV4hAjQ==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YwIkD3Ap3YrMuwrjTP6+tf7HxG8IfdgqxpA0C5RUAzU6xLZULua
 phndcRXYGAq08IF4gBuUcKaw1nrrdxhtcq3ZdJa0aGv35aS0WrffiQSX
X-Gm-Gg: ASbGnct+f8s7F3/AAokkYLUGd/FpptwfW2Bp7C0PGFaYSYy6P+I5DsFcCeBS57bFoUX
 0ZXkNFcDD1rU++fIeN3oWtH6tSZyrG2wPmD9zILbvhKUz4fnFYW9xVTYDMoPPaRqy4QFCxaGK84
 KrlsTixQvg74kqTqHxQI5TplScHdr6PJkFF3+6Xs1X0g1pOjr239aQyf+bESF5cugGPes30O5JD
 spEL9ADjqiqJDQNORUV5DjSDmwUnXkp3yidepUbSEyNjVQv7+l4KmFUbOxWDIGusrRKixwdbyOq
 RT9y55+/hdCLzLED5zw=
X-Google-Smtp-Source: AGHT+IFRorQnd8F0K/xxV5eDtMIR0quejkNt8Oq48bS1YPlAnEv9bEdERNzF/dW8KaJmOi46M5CmIA==
X-Received: by 2002:a05:6808:2289:b0:3f6:a476:f7d3 with SMTP id
 5614622812f47-4064682de2bmr4229115b6e.9.1748222219520; 
 Sun, 25 May 2025 18:16:59 -0700 (PDT)
Received: from fedora ([2806:10ae:e:635c::1]) by smtp.gmail.com with ESMTPSA id
 006d021491bc7-60b8376cbf7sm1927636eaf.32.2025.05.25.18.16.57
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 25 May 2025 18:16:58 -0700 (PDT)
From: =?utf-8?Q?Elijah_Gabe_P=C3=A9rez?= <eg642616@HIDDEN>
To: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
 text editors" <bug-gnu-emacs@HIDDEN>
Subject: Re: bug#78053: [PATCH] Support strings for electric-pairs.
In-Reply-To: <jwvplfw96n3.fsf-monnier+emacs@HIDDEN>
References: <877c39f5gt.fsf@HIDDEN> <jwvplfw96n3.fsf-monnier+emacs@HIDDEN>
Date: Sun, 25 May 2025 19:16:56 -0600
Message-ID: <87wma4dvcn.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 78053
Cc: 78053 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>,
 =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@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.7 (/)

--=-=-=
Content-Type: text/plain

Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@HIDDEN> writes:

>> @@ -41,7 +41,9 @@ electric-pair-pairs
>>  See also the variable `electric-pair-text-pairs'."
>>    :version "24.1"
>>    :group 'electricity
>> -  :type '(repeat (cons character character)))
>> +  :type '(repeat
>> +          (choice (cons character character)
>> +                  (cons string string))))
>
> We want to do the same for `electric-pair-text-pairs`, no?
>

Yes, I forgot it.

>> @@ -258,7 +260,18 @@ electric-pair-syntax-info
>>       (direct (if (eq (car direct) (cdr direct))
>>                   (list ?\" command-event t string-or-comment)
>>                 (list ?\( (cdr direct) t string-or-comment)))
>> -     (reverse (list ?\) (car reverse) t string-or-comment)))))
>> +     (reverse (list ?\) (car reverse) t string-or-comment))
>> +     ;; The if-let here is for avoid unnecessary looking-back computation
>> +     ((if-let* ((str-pair
>> +		 (cl-loop for pairs in fallback
>> +			  do
>> +			  (if (and
>> +			       (stringp (car pairs))
>> +			       (looking-back
>> +				(regexp-quote (car pairs))
>> +				(- (point) (length (car pairs)))))
>> +			      (cl-return (cdr pairs))))))
>> +	  (list 'str str-pair nil nil))))))
>
> BTW, here you could use `compare-buffer-substrings`.

Thanks, Can you explain how to use it in this case?  AFAIK
`compare-buffer-substrings' needs 2 strings in the buffer for the
comparison.

>>  (defun electric-pair--insert (char times)
>>    (let ((last-command-event char)
>> @@ -591,6 +604,11 @@ electric-pair-post-self-insert-function
>>                                pos))
>>           (forward-char num))
>>          ;; Insert matching pair.
>> +        ;; String pairs
>> +        ((and (eq syntax 'str) (not overwrite-mode))
>> +         (insert " ")
>> +         (save-excursion (insert " " pair)))
>> +        ;; Char pairs
>>          ((and (memq syntax '(?\( ?\" ?\$))
>>                (not overwrite-mode)
>>                (or unconditional
>
> I can imagine some multi-char delimiters which don't call for spaces
> inside of them (e.g. LaTeX's ``...''), so maybe the entries in
> `electric-pair-pairs` should have some extra info about it.
> I suggest we replace the (STRING . STRING) format with
> (STRING STRING ...) so we can put extra info in the `...`.

Are you sure it's good idea to replace the cons cell form with a list?
I've added the list form, but it coexists with the cons cell to avoid
any future bug.


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-Support-strings-for-electric-pairs.-bug-78053.patch

From cf6971e3061926bd12705b40b43f59d290dbdd5b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?El=C3=ADas=20Gabriel=20P=C3=A9rez?= <eg642616@HIDDEN>
Date: Thu, 24 Apr 2025 17:34:58 -0600
Subject: [PATCH] Support strings for electric-pairs.  (bug#78053)

This add support for string pairs in electric-pairs-mode.  For
example, typing `/*' in c-mode and derived it auto insert ` */',
or in sh-mode `case ' inserts `esac'.

* lisp/elec-pair.el (electric-pair-pairs): Add string :type
in defcustom.
(electric-pair-syntax-info)
(electric-pair-post-self-insert-function): Add support for
strings.
* etc/NEWS: Announce changes.
---
 etc/NEWS          |  4 ++++
 lisp/elec-pair.el | 37 ++++++++++++++++++++++++++++++++++---
 2 files changed, 38 insertions(+), 3 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index ade5abc43fc..bd514b110d8 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -527,6 +527,10 @@ You can now insert or wrap text with multiple sets of parentheses and
 other matching delimiters at once with Electric Pair mode, by providing
 a prefix argument when inserting one of the delimiters.
 
+---
+** Electric pair mode now supports multi-character paired delimiters.
+This is done by supporting strings in electric-pair-pairs.
+
 +++
 ** You can now use 'M-~' during 'C-x s' ('save-some-buffers').
 Typing 'M-~' while saving some buffers means not to save the buffer and
diff --git a/lisp/elec-pair.el b/lisp/elec-pair.el
index aa2577300fd..28459037699 100644
--- a/lisp/elec-pair.el
+++ b/lisp/elec-pair.el
@@ -41,7 +41,10 @@ electric-pair-pairs
 See also the variable `electric-pair-text-pairs'."
   :version "24.1"
   :group 'electricity
-  :type '(repeat (cons character character)))
+  :type '(repeat
+          (choice (cons :tag "Characters" character character)
+                  (cons :tag "Strings" string string)
+                  (list :tag "" string string boolean))))
 
 (defcustom electric-pair-text-pairs
   `((?\" . ?\")
@@ -54,7 +57,10 @@ electric-pair-text-pairs
 defined in `electric-pair-text-syntax-table'."
   :version "24.4"
   :group 'electricity
-  :type '(repeat (cons character character)))
+  :type '(repeat
+          (choice (cons :tag "Characters" character character)
+                  (cons :tag "Strings" string string)
+                  (list :tag "" string string boolean))))
 
 (defcustom electric-pair-skip-self #'electric-pair-default-skip-self
   "If non-nil, skip char instead of inserting a second closing paren.
@@ -252,6 +258,24 @@ electric-pair-syntax-info
          (direct (assq command-event fallback))
          (reverse (rassq command-event fallback)))
     (cond
+     ((cl-loop
+       for pairs in fallback
+       if (and
+	   (stringp (car pairs))
+	   (looking-back
+	    (car pairs)
+	    (- (point) (length (car pairs)))))
+         return (list
+                 'str
+                 ;; Get pair ender
+                 (if (proper-list-p pairs)
+                     (nth 1 pairs)
+                   (cdr pairs))
+                 ;; Get if pairs have to insert a space after
+                 ;; first pair was inserted.
+                 nil
+                 (if (proper-list-p pairs)
+                     (nth 2 pairs)))))
      ((memq (car table-syntax-and-pair)
             '(?\" ?\( ?\) ?\$))
       (append table-syntax-and-pair (list nil string-or-comment)))
@@ -533,7 +557,7 @@ electric-pair-post-self-insert-function
          (beg (when num (- pos num)))
          (skip-whitespace-info))
     (pcase (electric-pair-syntax-info last-command-event)
-      (`(,syntax ,pair ,unconditional ,_)
+      (`(,syntax ,pair ,unconditional ,space)
        (cond
         ((null pos) nil)
         ((zerop num) nil)
@@ -591,6 +615,12 @@ electric-pair-post-self-insert-function
                               pos))
          (forward-char num))
         ;; Insert matching pair.
+        ;; String pairs
+        ((and (eq syntax 'str) (not overwrite-mode))
+         (if space (insert " "))
+         (save-excursion
+           (insert pair)))
+        ;; Char pairs
         ((and (memq syntax '(?\( ?\" ?\$))
               (not overwrite-mode)
               (or unconditional
@@ -628,6 +658,7 @@ electric-pair-delete-pair
   (delete-char arg)
   (backward-delete-char-untabify arg killp))
 
+;; TODO: Add support for string pairs here.
 (defvar electric-pair-mode-map
   (let ((map (make-sparse-keymap)))
     (define-key map "\177"
-- 
2.49.0


--=-=-=
Content-Type: text/plain

-- 
                                          - E.G via GNU Emacs and Org.

--=-=-=--




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

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


Received: (at submit) by debbugs.gnu.org; 26 May 2025 01:17:48 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 25 21:17:48 2025
Received: from localhost ([127.0.0.1]:51025 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uJMTK-000873-UE
	for submit <at> debbugs.gnu.org; Sun, 25 May 2025 21:17:47 -0400
Received: from lists.gnu.org ([2001:470:142::17]:53986)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eg642616@HIDDEN>)
 id 1uJMSp-00083V-PG
 for submit <at> debbugs.gnu.org; Sun, 25 May 2025 21:17:16 -0400
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 <eg642616@HIDDEN>)
 id 1uJMSe-0005IC-Ll
 for bug-gnu-emacs@HIDDEN; Sun, 25 May 2025 21:17:04 -0400
Received: from mail-ot1-x341.google.com ([2607:f8b0:4864:20::341])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <eg642616@HIDDEN>)
 id 1uJMSc-0007N5-Ii
 for bug-gnu-emacs@HIDDEN; Sun, 25 May 2025 21:17:04 -0400
Received: by mail-ot1-x341.google.com with SMTP id
 46e09a7af769-72c14138668so441062a34.2
 for <bug-gnu-emacs@HIDDEN>; Sun, 25 May 2025 18:17:00 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1748222220; x=1748827020; darn=gnu.org;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=LSCKyYrnF9lfrNyDXzCSt3C1GNnQGC3MX4Vg5Vq8Zk0=;
 b=SdXtGr1HlxGufJTnKAm245zn7O3RpLqbBrd95v5+JKW7lqkTpcysxxbmChwwZKSqOL
 2Pev//wlPyYRH0TRkd4EfptomDtVauubT65I2xsDIJSShh9aGAJQmaGXyEsyj/N3EknU
 7Cmzf6AriMii/Z+V2NPwW7X+1K6JBcIHyGvSD0y0cFOa1d50gdyLKsy4lc5lzt+OQWfX
 WewTzC9pPQxGtPIctPpfpy4Lk9CCIvdKgc/S4+C6tbuWDnlogo68CeITbi1n/nD+EHSL
 RJIGlFdgeQeSav4VV0JR6FtlhfzfL7mCqKFEgoAFsX7XQzL0kWrfnwYlgNNtz1TD3v5T
 H+hg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1748222220; x=1748827020;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=LSCKyYrnF9lfrNyDXzCSt3C1GNnQGC3MX4Vg5Vq8Zk0=;
 b=vkTkal0kLkFkPqjLimB5ghXVvWXufj1cD6P5NbnuA5fKToG+itJc34jmJbg8jW5u2z
 6Glog5LG6faJolYySKXzF1/GATSAJOnlKNM0jsNruX4ZChkL0nX9MMHj1R829APak3Yj
 /caaIKDS8nStnyyArVp02TvtFNbvtUx5w2/KM3lTmp/MP358ERtHmZCZsESzlvEu2i4H
 s/W2yXdSjbP3PQZ4W/e5Q3x9hn+yIRXMEVPTELT9WifR8r4ay68RMykjxbt3JNG4opxz
 BniI3S0AzkTQJnzo/HFjfCzu6f29zUWr2I8Z7PxMIlhM/dzcpLrb1t4dQQx/1GaNawCv
 d5iw==
X-Gm-Message-State: AOJu0YwrlyeaURaNVHEBkWarftD883mwFmntjZ3mad1nrvF9nGweDjUW
 lHYC/+b3VSbH5f5NRCVJHe+V2lRetHV5qJN4t5Vt0/bJsG+XEuEoMr2q
X-Gm-Gg: ASbGncu+9yqsfxd9AmEDZI81uIA/Xdxws3Y1LMefhIu5Tkj2mVMWgVV7JjpbrxOctzM
 V6EAqKKhvjYjUoikggGGTwo3nTjpxyS3g85hYti2wfKu4VxUyCStCA3CmPX4y8g/1BFWqYllFLQ
 f2oqk/kDmjmqmoWPCFojY5n0zZDLIpWFosPISXDflneEb1GiYRcyiNzUI6vn0uxK1llA+tzEnX9
 Adh/D4M7xgtSwHSQlgTym1fqCdm7JfcPjX35OcUdHCkdhojhTgTw+dWL+MFVyV6sR55IEnzuhqT
 Ih3oudx+YT7+7AASmKU=
X-Google-Smtp-Source: AGHT+IFRorQnd8F0K/xxV5eDtMIR0quejkNt8Oq48bS1YPlAnEv9bEdERNzF/dW8KaJmOi46M5CmIA==
X-Received: by 2002:a05:6808:2289:b0:3f6:a476:f7d3 with SMTP id
 5614622812f47-4064682de2bmr4229115b6e.9.1748222219520; 
 Sun, 25 May 2025 18:16:59 -0700 (PDT)
Received: from fedora ([2806:10ae:e:635c::1]) by smtp.gmail.com with ESMTPSA id
 006d021491bc7-60b8376cbf7sm1927636eaf.32.2025.05.25.18.16.57
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 25 May 2025 18:16:58 -0700 (PDT)
From: =?utf-8?Q?Elijah_Gabe_P=C3=A9rez?= <eg642616@HIDDEN>
To: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
 text editors" <bug-gnu-emacs@HIDDEN>
Subject: Re: bug#78053: [PATCH] Support strings for electric-pairs.
In-Reply-To: <jwvplfw96n3.fsf-monnier+emacs@HIDDEN>
References: <877c39f5gt.fsf@HIDDEN> <jwvplfw96n3.fsf-monnier+emacs@HIDDEN>
Date: Sun, 25 May 2025 19:16:56 -0600
Message-ID: <87wma4dvcn.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=2607:f8b0:4864:20::341;
 envelope-from=eg642616@HIDDEN; helo=mail-ot1-x341.google.com
X-Spam_score_int: -17
X-Spam_score: -1.8
X-Spam_bar: -
X-Spam_report: (-1.8 / 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_ENVFROM_END_DIGIT=0.25, 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.2 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.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
 the administrator of that system for details.
 Content preview:  Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army
 knife of text editors" writes: >> @@ -41,7 +41,9 @@ electric-pair-pairs >>
 See also the variable `electric-pair-text-pairs'." >> :version "24.1" >>
 :group 'electricity >> - :type '(repeat (cons character character))) >> +
 :type '(r [...] 
 Content analysis details:   (1.2 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
 no trust [2001:470:142:0:0:0:0:17 listed in] [list.dnswl.org]
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
 1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
 0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
 provider (eg642616[at]gmail.com)
 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends
 in digit (eg642616[at]gmail.com)
X-Debbugs-Envelope-To: submit
Cc: 78053 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>,
 =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@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.2 (/)

--=-=-=
Content-Type: text/plain

Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@HIDDEN> writes:

>> @@ -41,7 +41,9 @@ electric-pair-pairs
>>  See also the variable `electric-pair-text-pairs'."
>>    :version "24.1"
>>    :group 'electricity
>> -  :type '(repeat (cons character character)))
>> +  :type '(repeat
>> +          (choice (cons character character)
>> +                  (cons string string))))
>
> We want to do the same for `electric-pair-text-pairs`, no?
>

Yes, I forgot it.

>> @@ -258,7 +260,18 @@ electric-pair-syntax-info
>>       (direct (if (eq (car direct) (cdr direct))
>>                   (list ?\" command-event t string-or-comment)
>>                 (list ?\( (cdr direct) t string-or-comment)))
>> -     (reverse (list ?\) (car reverse) t string-or-comment)))))
>> +     (reverse (list ?\) (car reverse) t string-or-comment))
>> +     ;; The if-let here is for avoid unnecessary looking-back computation
>> +     ((if-let* ((str-pair
>> +		 (cl-loop for pairs in fallback
>> +			  do
>> +			  (if (and
>> +			       (stringp (car pairs))
>> +			       (looking-back
>> +				(regexp-quote (car pairs))
>> +				(- (point) (length (car pairs)))))
>> +			      (cl-return (cdr pairs))))))
>> +	  (list 'str str-pair nil nil))))))
>
> BTW, here you could use `compare-buffer-substrings`.

Thanks, Can you explain how to use it in this case?  AFAIK
`compare-buffer-substrings' needs 2 strings in the buffer for the
comparison.

>>  (defun electric-pair--insert (char times)
>>    (let ((last-command-event char)
>> @@ -591,6 +604,11 @@ electric-pair-post-self-insert-function
>>                                pos))
>>           (forward-char num))
>>          ;; Insert matching pair.
>> +        ;; String pairs
>> +        ((and (eq syntax 'str) (not overwrite-mode))
>> +         (insert " ")
>> +         (save-excursion (insert " " pair)))
>> +        ;; Char pairs
>>          ((and (memq syntax '(?\( ?\" ?\$))
>>                (not overwrite-mode)
>>                (or unconditional
>
> I can imagine some multi-char delimiters which don't call for spaces
> inside of them (e.g. LaTeX's ``...''), so maybe the entries in
> `electric-pair-pairs` should have some extra info about it.
> I suggest we replace the (STRING . STRING) format with
> (STRING STRING ...) so we can put extra info in the `...`.

Are you sure it's good idea to replace the cons cell form with a list?
I've added the list form, but it coexists with the cons cell to avoid
any future bug.


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-Support-strings-for-electric-pairs.-bug-78053.patch

From cf6971e3061926bd12705b40b43f59d290dbdd5b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?El=C3=ADas=20Gabriel=20P=C3=A9rez?= <eg642616@HIDDEN>
Date: Thu, 24 Apr 2025 17:34:58 -0600
Subject: [PATCH] Support strings for electric-pairs.  (bug#78053)

This add support for string pairs in electric-pairs-mode.  For
example, typing `/*' in c-mode and derived it auto insert ` */',
or in sh-mode `case ' inserts `esac'.

* lisp/elec-pair.el (electric-pair-pairs): Add string :type
in defcustom.
(electric-pair-syntax-info)
(electric-pair-post-self-insert-function): Add support for
strings.
* etc/NEWS: Announce changes.
---
 etc/NEWS          |  4 ++++
 lisp/elec-pair.el | 37 ++++++++++++++++++++++++++++++++++---
 2 files changed, 38 insertions(+), 3 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index ade5abc43fc..bd514b110d8 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -527,6 +527,10 @@ You can now insert or wrap text with multiple sets of parentheses and
 other matching delimiters at once with Electric Pair mode, by providing
 a prefix argument when inserting one of the delimiters.
 
+---
+** Electric pair mode now supports multi-character paired delimiters.
+This is done by supporting strings in electric-pair-pairs.
+
 +++
 ** You can now use 'M-~' during 'C-x s' ('save-some-buffers').
 Typing 'M-~' while saving some buffers means not to save the buffer and
diff --git a/lisp/elec-pair.el b/lisp/elec-pair.el
index aa2577300fd..28459037699 100644
--- a/lisp/elec-pair.el
+++ b/lisp/elec-pair.el
@@ -41,7 +41,10 @@ electric-pair-pairs
 See also the variable `electric-pair-text-pairs'."
   :version "24.1"
   :group 'electricity
-  :type '(repeat (cons character character)))
+  :type '(repeat
+          (choice (cons :tag "Characters" character character)
+                  (cons :tag "Strings" string string)
+                  (list :tag "" string string boolean))))
 
 (defcustom electric-pair-text-pairs
   `((?\" . ?\")
@@ -54,7 +57,10 @@ electric-pair-text-pairs
 defined in `electric-pair-text-syntax-table'."
   :version "24.4"
   :group 'electricity
-  :type '(repeat (cons character character)))
+  :type '(repeat
+          (choice (cons :tag "Characters" character character)
+                  (cons :tag "Strings" string string)
+                  (list :tag "" string string boolean))))
 
 (defcustom electric-pair-skip-self #'electric-pair-default-skip-self
   "If non-nil, skip char instead of inserting a second closing paren.
@@ -252,6 +258,24 @@ electric-pair-syntax-info
          (direct (assq command-event fallback))
          (reverse (rassq command-event fallback)))
     (cond
+     ((cl-loop
+       for pairs in fallback
+       if (and
+	   (stringp (car pairs))
+	   (looking-back
+	    (car pairs)
+	    (- (point) (length (car pairs)))))
+         return (list
+                 'str
+                 ;; Get pair ender
+                 (if (proper-list-p pairs)
+                     (nth 1 pairs)
+                   (cdr pairs))
+                 ;; Get if pairs have to insert a space after
+                 ;; first pair was inserted.
+                 nil
+                 (if (proper-list-p pairs)
+                     (nth 2 pairs)))))
      ((memq (car table-syntax-and-pair)
             '(?\" ?\( ?\) ?\$))
       (append table-syntax-and-pair (list nil string-or-comment)))
@@ -533,7 +557,7 @@ electric-pair-post-self-insert-function
          (beg (when num (- pos num)))
          (skip-whitespace-info))
     (pcase (electric-pair-syntax-info last-command-event)
-      (`(,syntax ,pair ,unconditional ,_)
+      (`(,syntax ,pair ,unconditional ,space)
        (cond
         ((null pos) nil)
         ((zerop num) nil)
@@ -591,6 +615,12 @@ electric-pair-post-self-insert-function
                               pos))
          (forward-char num))
         ;; Insert matching pair.
+        ;; String pairs
+        ((and (eq syntax 'str) (not overwrite-mode))
+         (if space (insert " "))
+         (save-excursion
+           (insert pair)))
+        ;; Char pairs
         ((and (memq syntax '(?\( ?\" ?\$))
               (not overwrite-mode)
               (or unconditional
@@ -628,6 +658,7 @@ electric-pair-delete-pair
   (delete-char arg)
   (backward-delete-char-untabify arg killp))
 
+;; TODO: Add support for string pairs here.
 (defvar electric-pair-mode-map
   (let ((map (make-sparse-keymap)))
     (define-key map "\177"
-- 
2.49.0


--=-=-=
Content-Type: text/plain

-- 
                                          - E.G via GNU Emacs and Org.

--=-=-=--




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

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


Received: (at submit) by debbugs.gnu.org; 25 May 2025 17:20:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 25 13:20:31 2025
Received: from localhost ([127.0.0.1]:47970 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uJF1S-0004Ra-JS
	for submit <at> debbugs.gnu.org; Sun, 25 May 2025 13:20:31 -0400
Received: from lists.gnu.org ([2001:470:142::17]:60348)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <geb-bug-gnu-emacs@HIDDEN>)
 id 1uJF1P-0004R7-Fu
 for submit <at> debbugs.gnu.org; Sun, 25 May 2025 13:20:28 -0400
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 <geb-bug-gnu-emacs@HIDDEN>)
 id 1uJF1J-0001iq-Rc
 for bug-gnu-emacs@HIDDEN; Sun, 25 May 2025 13:20:21 -0400
Received: from ciao.gmane.io ([116.202.254.214])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <geb-bug-gnu-emacs@HIDDEN>)
 id 1uJF1H-0003Bo-DN
 for bug-gnu-emacs@HIDDEN; Sun, 25 May 2025 13:20:21 -0400
Received: from list by ciao.gmane.io with local (Exim 4.92)
 (envelope-from <geb-bug-gnu-emacs@HIDDEN>)
 id 1uJF1E-0002bE-BP
 for bug-gnu-emacs@HIDDEN; Sun, 25 May 2025 19:20:16 +0200
X-Injected-Via-Gmane: http://gmane.org/
To: bug-gnu-emacs@HIDDEN
From: Rudolf Schlatte <rudi@HIDDEN>
Subject: Re: bug#78053: [PATCH] Support strings for electric-pairs.
Date: Sun, 25 May 2025 19:20:08 +0200
Message-ID: <m1v7povc8n.fsf@HIDDEN>
References: <877c39f5gt.fsf@HIDDEN> <jwvplfw96n3.fsf-monnier+emacs@HIDDEN>
Mime-Version: 1.0
Content-Type: text/plain
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:CuJDP3DDz8ejrdWGhqIgSO5pfFU=
Received-SPF: pass client-ip=116.202.254.214;
 envelope-from=geb-bug-gnu-emacs@HIDDEN; helo=ciao.gmane.io
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9,
 HEADER_FROM_DIFFERENT_DOMAINS=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001,
 RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.0 (/)
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: -1.0 (-)

Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@HIDDEN> writes:

>>  (defun electric-pair--insert (char times)
>>    (let ((last-command-event char)
>> @@ -591,6 +604,11 @@ electric-pair-post-self-insert-function
>>                                pos))
>>           (forward-char num))
>>          ;; Insert matching pair.
>> +        ;; String pairs
>> +        ((and (eq syntax 'str) (not overwrite-mode))
>> +         (insert " ")
>> +         (save-excursion (insert " " pair)))
>> +        ;; Char pairs
>>          ((and (memq syntax '(?\( ?\" ?\$))
>>                (not overwrite-mode)
>>                (or unconditional
>
> I can imagine some multi-char delimiters which don't call for spaces
> inside of them (e.g. LaTeX's ``...''), so maybe the entries in
> `electric-pair-pairs` should have some extra info about it.
> I suggest we replace the (STRING . STRING) format with
> (STRING STRING ...) so we can put extra info in the `...`.

See for example Java's text blocks:

    The opening delimiter is a sequence of three double quote characters
    (""") followed by zero or more white spaces followed by a line
    terminator. The content begins at the first character after the line
    terminator of the opening delimiter.

    The closing delimiter is a sequence of three double quote
    characters. The content ends at the last character before the first
    double quote of the closing delimiter.

(https://openjdk.org/jeps/378) -- it would be nifty if the mandatory
linebreak was inserted automatically.





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

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


Received: (at 78053) by debbugs.gnu.org; 25 May 2025 13:44:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 25 09:44:58 2025
Received: from localhost ([127.0.0.1]:44523 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uJBer-00052z-Hy
	for submit <at> debbugs.gnu.org; Sun, 25 May 2025 09:44:57 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:16583)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <monnier@HIDDEN>)
 id 1uJBeo-000523-AY
 for 78053 <at> debbugs.gnu.org; Sun, 25 May 2025 09:44:55 -0400
Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id B1697440829;
 Sun, 25 May 2025 09:44:47 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1748180686;
 bh=Tt3SozkUdLSLOiWUydklBcIanEST6mCf4bumGXYpKxk=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=gHDSCk8gs279CLS6zvpSgjNupT0nr8EHtVfhSFmwfIpMOTDbnTI26x61DbnPjhZ16
 28xlcAH6aqW5batmBlYQ7xg8FIthHhd3KZ8+C3dto5TrN+5Zx3lAjymoWBHfgOQX46
 2ONqoheS8KZJzXjRcZRniYt6JsKvZVlGHjOVav0+WhOKkaCh394PBWQat64EuzA30v
 eaSrscYa+GgWBxGBI5c71SD0FZp2PS5TcMEgSH4FWfdxrQExDir4Ino/7xPsa/1IRZ
 5SHznH0yRNKTvWbsGST5Dv4kXz+yQ7oH4VdOannm8J6wEDo70slpemBdwtLCXna1q+
 6pedrNVWjZwdw==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 597EB4407A5;
 Sun, 25 May 2025 09:44:46 -0400 (EDT)
Received: from alfajor (unknown [104.247.225.139])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 20ED11203A5;
 Sun, 25 May 2025 09:44:46 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Elijah Gabe =?windows-1252?Q?P=E9rez?= <eg642616@HIDDEN>
Subject: Re: bug#78053: [PATCH] Support strings for electric-pairs.
In-Reply-To: <877c39f5gt.fsf@HIDDEN>
Message-ID: <jwvplfw96n3.fsf-monnier+emacs@HIDDEN>
References: <877c39f5gt.fsf@HIDDEN>
Date: Sun, 25 May 2025 09:44:45 -0400
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.353 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
 DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 78053
Cc: 78053 <at> debbugs.gnu.org,
 =?windows-1252?B?Sm/jbyBU4XZvcmE=?= <joaotavora@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 (---)

> As discussed in bug#77823, this feature bring support for
> using strings as pairs in `electric-pair-mode',

Thank you for looking into it.  I think this would be a nice addition to
`electric-pair-mode`.

> +---
> +** Electric pair mode now supports using strings as pairs.
> +Now 'electric-pair-mode' can use strings as pairs,
> +TODO: I don't know what to put here

The second line just repeats the first, so you can just remove it.
In general, this seems sufficient, tho maybe we should clarify the
"meaning" of using strings there.  IOW, I'd say something like:

    ** Electric pair mode supports multicharacter paired delimiters.
    This is done by supporting strings in 'electric-pair-pairs'.

> @@ -41,7 +41,9 @@ electric-pair-pairs
>  See also the variable `electric-pair-text-pairs'."
>    :version "24.1"
>    :group 'electricity
> -  :type '(repeat (cons character character)))
> +  :type '(repeat
> +          (choice (cons character character)
> +                  (cons string string))))

We want to do the same for `electric-pair-text-pairs`, no?

> @@ -258,7 +260,18 @@ electric-pair-syntax-info
>       (direct (if (eq (car direct) (cdr direct))
>                   (list ?\" command-event t string-or-comment)
>                 (list ?\( (cdr direct) t string-or-comment)))
> -     (reverse (list ?\) (car reverse) t string-or-comment)))))
> +     (reverse (list ?\) (car reverse) t string-or-comment))
> +     ;; The if-let here is for avoid unnecessary looking-back computation
> +     ((if-let* ((str-pair
> +		 (cl-loop for pairs in fallback
> +			  do
> +			  (if (and
> +			       (stringp (car pairs))
> +			       (looking-back
> +				(regexp-quote (car pairs))
> +				(- (point) (length (car pairs)))))
> +			      (cl-return (cdr pairs))))))
> +	  (list 'str str-pair nil nil))))))

BTW, here you could use `compare-buffer-substrings`.

And you can get rid of the `if-let*` altogether by doing:

     (t (cl-loop
         for pairs in fallback
         do (when {...}
              (cl-return (list 'str ...))))))))

>  (defun electric-pair--insert (char times)
>    (let ((last-command-event char)
> @@ -591,6 +604,11 @@ electric-pair-post-self-insert-function
>                                pos))
>           (forward-char num))
>          ;; Insert matching pair.
> +        ;; String pairs
> +        ((and (eq syntax 'str) (not overwrite-mode))
> +         (insert " ")
> +         (save-excursion (insert " " pair)))
> +        ;; Char pairs
>          ((and (memq syntax '(?\( ?\" ?\$))
>                (not overwrite-mode)
>                (or unconditional

I can imagine some multi-char delimiters which don't call for spaces
inside of them (e.g. LaTeX's ``...''), so maybe the entries in
`electric-pair-pairs` should have some extra info about it.
I suggest we replace the (STRING . STRING) format with
(STRING STRING ...) so we can put extra info in the `...`.


        Stefan





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

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


Received: (at 78053) by debbugs.gnu.org; 25 May 2025 06:27:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 25 02:27:26 2025
Received: from localhost ([127.0.0.1]:41201 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uJ4pS-0006In-A8
	for submit <at> debbugs.gnu.org; Sun, 25 May 2025 02:27:26 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:49028)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1uJ4pP-0006IV-65
 for 78053 <at> debbugs.gnu.org; Sun, 25 May 2025 02:27:23 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1uJ4pH-0003uJ-Tc; Sun, 25 May 2025 02:27:16 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=Ox+q5QU8qPmU2qW4Gi2U4CaGh0ktgi+1J8xejaUsXkg=; b=TBBdNSwPSUXSGnUOXGfl
 uvLvQm/O/tNx6bMQG5CTwM5Ckyyo3KdplYL8/6w3hQCmIc6j7LROwZtajO59pvHUi45xrCjqUeFO4
 +QG3Rm/JGPlWT42Ifd6A4skr9WsY/0rOhJ+NTW1XJcmLX21YJcCKAmQdluDbMEKlUlykQPThdZscC
 Vwqskbu45kYbVjvf6u0fWWosBOb1sE8LCfilzbBmUbPGyzjOWAQ9C5xu7WzbUezr2WLaSRYnhJeSw
 myUPAciAi8AgNlw41v/UCjMmG8hHHKl2TbZXXdAStr6OY8wnD0BiABjdNz1Kz04br92V2xw48W2fA
 ZPM4ZS6rjXzxew==;
Date: Sun, 25 May 2025 09:27:12 +0300
Message-Id: <86o6vhyzlr.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>
In-Reply-To: <CALDnm51joe+bK97KTuFACemYUnMEMgvMPZHts-ca6tiqOSM=9g@HIDDEN>
 (message from =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= on Sat, 24 May 2025 18:34:10
 +0100)
Subject: Re: bug#78053: [PATCH] Support strings for electric-pairs.
References: <877c39f5gt.fsf@HIDDEN> <86msbkbz3b.fsf@HIDDEN>
 <86h61a2xzb.fsf@HIDDEN>
 <CALDnm51joe+bK97KTuFACemYUnMEMgvMPZHts-ca6tiqOSM=9g@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: 78053
Cc: eg642616@HIDDEN, 78053 <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: João Távora <joaotavora@HIDDEN>
> Date: Sat, 24 May 2025 18:34:10 +0100
> Cc: Elijah G <eg642616@HIDDEN>, 78053 <at> debbugs.gnu.org
> 
> I already expressed my misgivings/opinion/ignorance about this in bug#77823, no? Or am I figured and this
> a different matter altogether? 

I cannot find your comments in that bug.  Could you reiterate your
opinions and comments?

> Just to clarify, electric-pair-mode already existed when I touched it and it did some arguably interesting but
> not particularly stuff. I just added the pair-based-on-syntax-while-helping-balance feature. This, as far as I
> can tell, is a somewhat distinct area that isn't in my expertise.
> 
> My advice is to call Stefan.

Stefan, WDYT about this proposal?




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

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


Received: (at 78053) by debbugs.gnu.org; 24 May 2025 17:34:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat May 24 13:34:31 2025
Received: from localhost ([127.0.0.1]:35015 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uIslS-0003dg-T5
	for submit <at> debbugs.gnu.org; Sat, 24 May 2025 13:34:31 -0400
Received: from mail-oi1-x22b.google.com ([2607:f8b0:4864:20::22b]:44314)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <joaotavora@HIDDEN>)
 id 1uIslP-0003cn-CT
 for 78053 <at> debbugs.gnu.org; Sat, 24 May 2025 13:34:28 -0400
Received: by mail-oi1-x22b.google.com with SMTP id
 5614622812f47-400fa6eafa9so620787b6e.1
 for <78053 <at> debbugs.gnu.org>; Sat, 24 May 2025 10:34:27 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1748108061; x=1748712861; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=Bjgr37SAeTxkl4AafkYYXrdDHkxEINSXmY7Lyg+3o1s=;
 b=cdbNFgVj2DS0BqdcLtHZPUaV0QrXbxmI+zuOyt+ijYcTavC18XtRB9LyEOAMUvNMso
 TiDdtOhhZL+6fA8D8FpMuKw+dk8qNlTNEuZODRBRrunPHhFb1GPL9F5uKvmgehYrY/Oe
 VgKDgkJMsis/knqrGw1mRObwaTtIVb9wXXQsNvIwC1HzLyD65aVhAEdqZYROHAus7Q+5
 O0eMgsEV6Y8YqpCpwpXBhdJadyiJQiHgeInssAvrOjcWbA+YZxyAGEDDq6qjXLnia8hg
 cDxQiesp+Hw+O1/kL0d5J6fcmOGw7y6EPuVs0dCEeaA3FQCjOmsZaZJPcXogWzp6yj2j
 CYmQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1748108061; x=1748712861;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=Bjgr37SAeTxkl4AafkYYXrdDHkxEINSXmY7Lyg+3o1s=;
 b=bgIfpC0KiXbU7I6wp19V0fjdnkr42foGA6DZ5udPv4sUU9QO2PdMv+ClzmdhaQ5AXZ
 4epw50xfw6CkM5Zi93hy3qLEIVEDc49kN9a/gEi9e7gathEtLaakwoeVWXJgds6qOYGG
 t0NqTkMScl0+dsQziJ4PXhD+T41QMIx7tSKyOvmN0/y6p1b2OkMd6h/ZS3D/hpOz+pxG
 X4Iw6IgkdgES6roPXGeC6U9bAU+WQ22xxPzLz8UpkG4e6jEwzY3DmnV+I9idRdPUCdRI
 PoEARIf1S1Qvb1Ipo7BJlFcobH2m73bAg4t1Vs/wzhI54Z8fYJOV1ktptV/Wldp6JXsf
 Jaiw==
X-Forwarded-Encrypted: i=1;
 AJvYcCVrq7Z7UCm2z2im24vNA5JRJiEpw/FoaG/XqbigfYFxyOcRyFpHjkP4qjdmTJmMX2hyb3vkOw==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YyBPoLiyhc55r1gT3o2Z4lOnRWAv/FH7ILhpk+77cPwzNInmdRW
 xCdMTu68UsZ6uev2Zy2lfwS+kTmVwG7fRxX8gagtkW6UFd59pZyM/yWUZJsKxzAQZ3+OUWYHDJt
 zS6LB1P22WJry8oWEHtjvU5gnqp+bGqQ=
X-Gm-Gg: ASbGncsBEmv+FB+1Aq9N8fKTPpXS32CIj6iglNjmknTsL2ZF2FHXkh1D37ilCHiKbga
 LerBgbMWxIMV3uDtscnbfNzjAwc81a5fUjEyze5HwLJ9ltbjK3fc+GuVGXH5ER6b+kBfBNunddv
 2x7mKXYRao+eg7FT6sGw3R5PUEIjj9RyuqmXumaZgqGKM=
X-Google-Smtp-Source: AGHT+IF1q5VCrug8uR1IrSndz5HrPrZtWj/fysPidezZ+QnR5jRhgQpe9BFbmDnPYeq4uu8gJgy6JW02kdmwJuJmbx0=
X-Received: by 2002:a05:6808:338a:b0:401:e6f0:a8d4 with SMTP id
 5614622812f47-406467c3fabmr2184339b6e.5.1748108061277; Sat, 24 May 2025
 10:34:21 -0700 (PDT)
MIME-Version: 1.0
References: <877c39f5gt.fsf@HIDDEN> <86msbkbz3b.fsf@HIDDEN>
 <86h61a2xzb.fsf@HIDDEN>
In-Reply-To: <86h61a2xzb.fsf@HIDDEN>
From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
Date: Sat, 24 May 2025 18:34:10 +0100
X-Gm-Features: AX0GCFuas-9prm5V1pMZS5jRP840BP-lZxLD0FxRjxU-ewhB7n_Yb1Lj9vHDU6g
Message-ID: <CALDnm51joe+bK97KTuFACemYUnMEMgvMPZHts-ca6tiqOSM=9g@HIDDEN>
Subject: Re: bug#78053: [PATCH] Support strings for electric-pairs.
To: Eli Zaretskii <eliz@HIDDEN>
Content-Type: multipart/alternative; boundary="0000000000000581180635e52047"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 78053
Cc: Elijah G <eg642616@HIDDEN>, 78053 <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 (-)

--0000000000000581180635e52047
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

I already expressed my misgivings/opinion/ignorance about this in
bug#77823, no? Or am I figured and this a different matter altogether?

Just to clarify, electric-pair-mode already existed when I touched it and
it did some arguably interesting but not particularly stuff. I just added
the pair-based-on-syntax-while-helping-balance feature. This, as far as
I can tell, is a somewhat distinct area that isn't in my expertise.

My advice is to call Stefan.

Jo=C3=A3o

On Sat, May 24, 2025, 09:51 Eli Zaretskii <eliz@HIDDEN> wrote:

> Ping!
>
> > Cc: 78053 <at> debbugs.gnu.org
> > Date: Sat, 10 May 2025 12:21:28 +0300
> > From: Eli Zaretskii <eliz@HIDDEN>
> >
> > > Cc: Jo=C3=A3o T=C3=A1vora <joaotavora@HIDDEN>
> > > From: Elijah Gabe P=C3=A9rez <eg642616@HIDDEN>
> > > Date: Thu, 24 Apr 2025 18:30:10 -0600
> > >
> > > As discussed in bug#77823, this feature bring support for
> > > using strings as pairs in `electric-pair-mode', the advantage is that
> > > this can be used for: Auto-close block comments, close conditional
> > > constructs such as `case esac' from bash and whatever.
> > >
> > > This is currently a working prototype (only inserts the pairs).
> > > I would like to hear some comments or suggestions of this
> implementation.
> >
> > Jo=C3=A3o, any comments?
> >
> >
> >
> >
>

--0000000000000581180635e52047
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto"><div><div>I already expressed my misgivings/opinion/ignor=
ance about this in bug#77823, no? Or am I figured and this a different matt=
er altogether?=C2=A0</div><div dir=3D"auto"><br></div><div dir=3D"auto">Jus=
t to clarify, electric-pair-mode already existed when I touched it and it d=
id some arguably interesting but not particularly stuff. I just added the p=
air-based-on-syntax-while-helping-balance feature. This, as far as I=C2=A0c=
an tell, is a somewhat distinct area that isn&#39;t in my expertise.</div><=
div dir=3D"auto"><br></div><div dir=3D"auto">My advice is to call Stefan.</=
div><div><br></div><div data-smartmail=3D"gmail_signature">Jo=C3=A3o</div><=
br><div class=3D"gmail_quote gmail_quote_container"><div dir=3D"ltr" class=
=3D"gmail_attr">On Sat, May 24, 2025, 09:51 Eli Zaretskii &lt;<a href=3D"ma=
ilto:eliz@HIDDEN">eliz@HIDDEN</a>&gt; wrote:<br></div><blockquote class=
=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rg=
b(204,204,204);padding-left:1ex">Ping!<br>
<br>
&gt; Cc: <a href=3D"mailto:78053 <at> debbugs.gnu.org" target=3D"_blank" rel=3D"=
noreferrer">78053 <at> debbugs.gnu.org</a><br>
&gt; Date: Sat, 10 May 2025 12:21:28 +0300<br>
&gt; From: Eli Zaretskii &lt;<a href=3D"mailto:eliz@HIDDEN" target=3D"_bla=
nk" rel=3D"noreferrer">eliz@HIDDEN</a>&gt;<br>
&gt; <br>
&gt; &gt; Cc: Jo=C3=A3o T=C3=A1vora &lt;<a href=3D"mailto:joaotavora@gmail.=
com" target=3D"_blank" rel=3D"noreferrer">joaotavora@HIDDEN</a>&gt;<br>
&gt; &gt; From: Elijah Gabe P=C3=A9rez &lt;<a href=3D"mailto:eg642616@gmail=
.com" target=3D"_blank" rel=3D"noreferrer">eg642616@HIDDEN</a>&gt;<br>
&gt; &gt; Date: Thu, 24 Apr 2025 18:30:10 -0600<br>
&gt; &gt; <br>
&gt; &gt; As discussed in bug#77823, this feature bring support for<br>
&gt; &gt; using strings as pairs in `electric-pair-mode&#39;, the advantage=
 is that<br>
&gt; &gt; this can be used for: Auto-close block comments, close conditiona=
l<br>
&gt; &gt; constructs such as `case esac&#39; from bash and whatever.<br>
&gt; &gt; <br>
&gt; &gt; This is currently a working prototype (only inserts the pairs).<b=
r>
&gt; &gt; I would like to hear some comments or suggestions of this impleme=
ntation.<br>
&gt; <br>
&gt; Jo=C3=A3o, any comments?<br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; <br>
</blockquote></div></div></div>

--0000000000000581180635e52047--




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

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


Received: (at 78053) by debbugs.gnu.org; 24 May 2025 08:51:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat May 24 04:51:14 2025
Received: from localhost ([127.0.0.1]:56809 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uIkb3-0006OU-Qe
	for submit <at> debbugs.gnu.org; Sat, 24 May 2025 04:51:14 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:53094)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1uIkb2-0006OB-1U
 for 78053 <at> debbugs.gnu.org; Sat, 24 May 2025 04:51:12 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1uIkaw-00077j-H6; Sat, 24 May 2025 04:51:06 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=65EtWnYs/wFowuxsY730gXtN/mpZYtS8uLk5arJ5aXo=; b=HzBMs0+vIXMKYjmGAcTF
 JHUs+RbgV5d3S++awEWReqZOwYQhY56Z963XeqsqnmyBbyyA1KJTJStU6Ln+FqvCKgezPxO9B0yZg
 Q3Qp0BpWVx5jTdppCDQDDD3skhw63sZHmGCLjHeF6qwEzhtes0vD1xgC88Cw+LaRLs9EU4/1qKDLn
 Q/hVU80ozkTQyf5RLUwkYFK+1s7wyS2kq42z/si7bLVOcFK7CUTuANP7c1NnUt0/css6751fZVjws
 mBhApdiuzMMf9hJ6XnCrZ+gr0gIMZ9Us1onTPyqMyW998vWFG2RkDex03Xw0Vc60TN2sKpd51s+YZ
 8oWGN26ySfW7og==;
Date: Sat, 24 May 2025 11:51:04 +0300
Message-Id: <86h61a2xzb.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: joaotavora@HIDDEN
In-Reply-To: <86msbkbz3b.fsf@HIDDEN> (message from Eli Zaretskii on Sat, 10
 May 2025 12:21:28 +0300)
Subject: Re: bug#78053: [PATCH] Support strings for electric-pairs.
References: <877c39f5gt.fsf@HIDDEN> <86msbkbz3b.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: 78053
Cc: eg642616@HIDDEN, 78053 <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 (---)

Ping!

> Cc: 78053 <at> debbugs.gnu.org
> Date: Sat, 10 May 2025 12:21:28 +0300
> From: Eli Zaretskii <eliz@HIDDEN>
> 
> > Cc: João Távora <joaotavora@HIDDEN>
> > From: Elijah Gabe Pérez <eg642616@HIDDEN>
> > Date: Thu, 24 Apr 2025 18:30:10 -0600
> > 
> > As discussed in bug#77823, this feature bring support for
> > using strings as pairs in `electric-pair-mode', the advantage is that
> > this can be used for: Auto-close block comments, close conditional
> > constructs such as `case esac' from bash and whatever.
> > 
> > This is currently a working prototype (only inserts the pairs).
> > I would like to hear some comments or suggestions of this implementation.
> 
> João, any comments?
> 
> 
> 
> 




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

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


Received: (at 78053) by debbugs.gnu.org; 10 May 2025 09:21:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat May 10 05:21:40 2025
Received: from localhost ([127.0.0.1]:43802 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uDgOq-0004kx-9V
	for submit <at> debbugs.gnu.org; Sat, 10 May 2025 05:21:40 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:57058)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1uDgOo-0004kj-PP
 for 78053 <at> debbugs.gnu.org; Sat, 10 May 2025 05:21:39 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1uDgOi-0000GK-Jc; Sat, 10 May 2025 05:21:32 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=oQ4ETgRnJSE8YSNNC9oHepPIiHyckQm8IXywqQtDuF8=; b=ZaENnIazu9FFs8WrWsYd
 vJVH6PuGB6b3bJEbAhl7ixsDqqHIxlRf0jladQ7XJnxszsYBFQAhnMffoOSAyuqH936wE0XdVigGl
 x3+01dhcpSqD4i3xeeDTGTI0hk7/AglPMngQAUjSq46GCGM3E0b0mneOejvB+gH6Ro4KrnSPNj2en
 NE/rCiKagP5lkUaN6CrOIOYDBYDDZshvGk2NVmGfob9qPN49kEoPwHWXHG5Shtq6xqPvyPUh0H3Ed
 ym3fgOVNX1Bwu9jVwVgkiO6iNGoRdrbFZScvW9wCnb1OVYdMOzvquTuj9/aKChCPW0HHsADNkwzbK
 queUVocL7h9WGw==;
Date: Sat, 10 May 2025 12:21:28 +0300
Message-Id: <86msbkbz3b.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Elijah Gabe =?utf-8?Q?P=C3=A9rez?= <eg642616@HIDDEN>,
 joaotavora@HIDDEN
In-Reply-To: <877c39f5gt.fsf@HIDDEN> (message from Elijah Gabe
 =?utf-8?Q?P=C3=A9rez?= on Thu, 24 Apr 2025 18:30:10 -0600)
Subject: Re: bug#78053: [PATCH] Support strings for electric-pairs.
References: <877c39f5gt.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: 78053
Cc: 78053 <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 (---)

> Cc: João Távora <joaotavora@HIDDEN>
> From: Elijah Gabe Pérez <eg642616@HIDDEN>
> Date: Thu, 24 Apr 2025 18:30:10 -0600
> 
> As discussed in bug#77823, this feature bring support for
> using strings as pairs in `electric-pair-mode', the advantage is that
> this can be used for: Auto-close block comments, close conditional
> constructs such as `case esac' from bash and whatever.
> 
> This is currently a working prototype (only inserts the pairs).
> I would like to hear some comments or suggestions of this implementation.

João, any comments?




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

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


Received: (at submit) by debbugs.gnu.org; 25 Apr 2025 00:30:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Apr 24 20:30:36 2025
Received: from localhost ([127.0.0.1]:42975 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1u86xf-0006mq-2b
	for submit <at> debbugs.gnu.org; Thu, 24 Apr 2025 20:30:36 -0400
Received: from lists.gnu.org ([2001:470:142::17]:50266)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eg642616@HIDDEN>)
 id 1u86xa-0006kL-0u
 for submit <at> debbugs.gnu.org; Thu, 24 Apr 2025 20:30:33 -0400
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 <eg642616@HIDDEN>)
 id 1u86xN-0001G5-Ub
 for bug-gnu-emacs@HIDDEN; Thu, 24 Apr 2025 20:30:18 -0400
Received: from mail-oo1-xc42.google.com ([2607:f8b0:4864:20::c42])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <eg642616@HIDDEN>)
 id 1u86xL-0006Ih-CD
 for bug-gnu-emacs@HIDDEN; Thu, 24 Apr 2025 20:30:17 -0400
Received: by mail-oo1-xc42.google.com with SMTP id
 006d021491bc7-60406de9cbfso630625eaf.3
 for <bug-gnu-emacs@HIDDEN>; Thu, 24 Apr 2025 17:30:14 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1745541013; x=1746145813; darn=gnu.org;
 h=mime-version:message-id:date:subject:to:from:from:to:cc:subject
 :date:message-id:reply-to;
 bh=ly5xe5RBjeUvuld+w4dA0LoiJ6LIIT6PwSJbg7M1ffI=;
 b=SkXwa9S9S0JjYAu773z+4ILpcfyixHzfNFzEJZqyRTwsdLA2NcGbZvhNrqnQWKq4de
 tC3arseq8s3YwNykZwN7eHrFHVJDNrqrOTCOTLG8tilYbW7rpbPbu341Py4n97kVn6Lk
 ljnAJNgbbBHFqsu09z54PRY/zhYajIuj5WfcMTPDOGYg08Gzev0MLAJr6Z1IBLxShiI0
 nECQQOyWhNksVRVkLnHbGqOmlT+LqNcm2Tvida9BWXWh/R8hHL4Hq9JEC5LMqiHL/IJ5
 OV/+hsYtlKncsSe9fbjwLJj+Z6KFpbsNoZ8dQOtnQCJD10tw9C9RcOgVNmgJ210Xk1e1
 K/kg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1745541013; x=1746145813;
 h=mime-version:message-id:date:subject:to:from:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=ly5xe5RBjeUvuld+w4dA0LoiJ6LIIT6PwSJbg7M1ffI=;
 b=qf2AfjZlJAjk3gxBMzpN7UByMSCc26sm9gzURTtD6dyCRHQjVkAmOv0IJmtXKDCd34
 qVTEf7kib9gl+VCDWJh3cdBDtvnGPpYIBwPp6Lwk1zd8H40HVtHcoygJuIkFcW3T32FK
 wl3mYEM6X8C9ovjxgsWZllDV2YbQqAZG4gH9txLi0aiMvaRrIGIM+NRR1b4xfnu8tESK
 jBo8psdfIuC1jUuvS5l804dIvG+qjCXbh7NnhujJf5IYZ9BWtWnD3QGkFii0P6DOntEK
 +rO+qf3K6OTuRmTbFVJWAoaQsxl84sE9knLdeAR5UXjspYBN+zuTCGmHHnlewB9BrTvR
 Tg+w==
X-Gm-Message-State: AOJu0Yx71NUvDmzw/HYgPsLUhgJ74th139GDWqSEs7b1AoIWEiTyZHQl
 ldS+3fzxO/ytRwLhs2FINdpBOHhFImlGiz2yssSqepyONI+986/L1NHHyVrL
X-Gm-Gg: ASbGnctESnGy4LIdlUaZs/aWXtJ13EA5V3E3gigWdvKf9nV0g1mgWumSXoVYzSGNwlV
 VeKurImDXBVSntf32g8sFgtyU9D+m9pc1mrDj2QzXcMsRioRUlfKernwZOf90686zpJzqBofmU0
 kWfFxSxc8lxVmsZMmzsvRLl1kZyRqE+7LjgzyyMNgj0TW6WYABJ38WAW/vuzd+3PTe71yKIY8qI
 zdlymUNDLNurpLH6hX0Lka6V6UBbydNWPQowIKQCNSrh2R6tSKqb7h/TSF6MFAhtDHzo3dEqnK0
 0O44+ICZ
X-Google-Smtp-Source: AGHT+IFilDqhkV6N2W9/uVLQ6qPiwXXpmMaSdBtJ/Xdnos+Bi5PBtx5UkFfaIuFgaOXMGZ9QUfWiLw==
X-Received: by 2002:a05:6870:d68c:b0:296:aef8:fe9a with SMTP id
 586e51a60fabf-2d99d749d78mr268698fac.7.1745541013219; 
 Thu, 24 Apr 2025 17:30:13 -0700 (PDT)
Received: from fedora ([2806:10ae:e:b268::1]) by smtp.gmail.com with ESMTPSA id
 586e51a60fabf-2d97364a7fcsm570973fac.6.2025.04.24.17.30.12
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 24 Apr 2025 17:30:12 -0700 (PDT)
From: =?utf-8?Q?Elijah_Gabe_P=C3=A9rez?= <eg642616@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: [PATCH] Support strings for electric-pairs.
X-Debbugs-Cc: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN>
Date: Thu, 24 Apr 2025 18:30:10 -0600
Message-ID: <877c39f5gt.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=2607:f8b0:4864:20::c42;
 envelope-from=eg642616@HIDDEN; helo=mail-oo1-xc42.google.com
X-Spam_score_int: -17
X-Spam_score: -1.8
X-Spam_bar: -
X-Spam_report: (-1.8 / 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_ENVFROM_END_DIGIT=0.25, 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.2 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.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
 the administrator of that system for details.
 Content preview:  Tags: patch As discussed in bug#77823, this feature bring
 support for using strings as pairs in `electric-pair-mode', the advantage
 is that this can be used for: Auto-close block comments, close conditional
 const [...] 
 Content analysis details:   (1.2 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
 no trust [2001:470:142:0:0:0:0:17 listed in] [list.dnswl.org]
 1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends
 in digit (eg642616[at]gmail.com)
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
 0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
 provider (eg642616[at]gmail.com)
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: 0.2 (/)

--=-=-=
Content-Type: text/plain

Tags: patch

As discussed in bug#77823, this feature bring support for
using strings as pairs in `electric-pair-mode', the advantage is that
this can be used for: Auto-close block comments, close conditional
constructs such as `case esac' from bash and whatever.

This is currently a working prototype (only inserts the pairs).
I would like to hear some comments or suggestions of this implementation.

Thanks.

--=-=-=
Content-Type: text/patch
Content-Disposition: attachment;
 filename=0001-Support-strings-for-electric-pairs.-bug.patch

From 8e237df3dded619b1f5a849e33b0bb5b9cf8bab7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?El=C3=ADas=20Gabriel=20P=C3=A9rez?= <eg642616@HIDDEN>
Date: Thu, 24 Apr 2025 17:34:58 -0600
Subject: [PATCH] Support strings for electric-pairs.  (bug#)

This add support for string pairs in electric-pairs-mode.
For example, typing `/*' in c-mode and derived it auto insert ` */',
or in sh-mode `case ' inserts `esac'.

* lisp/elec-pair.el (electric-pair-pairs): Add string :type
in defcustom.
(electric-pair-syntax-info)
(electric-pair-post-self-insert-function): Add support for
strings.
* etc/NEWS: Announce changes.
---
 etc/NEWS          |  5 +++++
 lisp/elec-pair.el | 22 ++++++++++++++++++++--
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index ade5abc43fc..2d024f7a5e3 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -527,6 +527,11 @@ You can now insert or wrap text with multiple sets of parentheses and
 other matching delimiters at once with Electric Pair mode, by providing
 a prefix argument when inserting one of the delimiters.
 
+---
+** Electric pair mode now supports using strings as pairs.
+Now 'electric-pair-mode' can use strings as pairs,
+TODO: I don't know what to put here
+
 +++
 ** You can now use 'M-~' during 'C-x s' ('save-some-buffers').
 Typing 'M-~' while saving some buffers means not to save the buffer and
diff --git a/lisp/elec-pair.el b/lisp/elec-pair.el
index aa2577300fd..e48fbee6b4a 100644
--- a/lisp/elec-pair.el
+++ b/lisp/elec-pair.el
@@ -41,7 +41,9 @@ electric-pair-pairs
 See also the variable `electric-pair-text-pairs'."
   :version "24.1"
   :group 'electricity
-  :type '(repeat (cons character character)))
+  :type '(repeat
+          (choice (cons character character)
+                  (cons string string))))
 
 (defcustom electric-pair-text-pairs
   `((?\" . ?\")
@@ -258,7 +260,18 @@ electric-pair-syntax-info
      (direct (if (eq (car direct) (cdr direct))
                  (list ?\" command-event t string-or-comment)
                (list ?\( (cdr direct) t string-or-comment)))
-     (reverse (list ?\) (car reverse) t string-or-comment)))))
+     (reverse (list ?\) (car reverse) t string-or-comment))
+     ;; The if-let here is for avoid unnecessary looking-back computation
+     ((if-let* ((str-pair
+		 (cl-loop for pairs in fallback
+			  do
+			  (if (and
+			       (stringp (car pairs))
+			       (looking-back
+				(regexp-quote (car pairs))
+				(- (point) (length (car pairs)))))
+			      (cl-return (cdr pairs))))))
+	  (list 'str str-pair nil nil))))))
 
 (defun electric-pair--insert (char times)
   (let ((last-command-event char)
@@ -591,6 +604,11 @@ electric-pair-post-self-insert-function
                               pos))
          (forward-char num))
         ;; Insert matching pair.
+        ;; String pairs
+        ((and (eq syntax 'str) (not overwrite-mode))
+         (insert " ")
+         (save-excursion (insert " " pair)))
+        ;; Char pairs
         ((and (memq syntax '(?\( ?\" ?\$))
               (not overwrite-mode)
               (or unconditional
-- 
2.49.0


--=-=-=
Content-Type: text/plain


-- 
                                          - E.G via GNU Emacs and Org.

--=-=-=--




Acknowledgement sent to Elijah Gabe Pérez <eg642616@HIDDEN>:
New bug report received and forwarded. Copy sent to joaotavora@HIDDEN, bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to joaotavora@HIDDEN, bug-gnu-emacs@HIDDEN:
bug#78053; 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: Mon, 16 Jun 2025 09:45:01 UTC

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