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

Previous Next

Package: emacs;

Reported by: Elijah Gabe Pérez <eg642616 <at> gmail.com>

Date: Fri, 25 Apr 2025 00:31:01 UTC

Severity: normal

Tags: patch

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Rudi Schlatte <rudi <at> constantly.at>
To: Eli Zaretskii <eliz <at> gnu.org>, 78053 <at> debbugs.gnu.org
Subject: bug#78053: [PATCH] Support strings for electric-pairs.
Date: Mon, 16 Jun 2025 11:40:12 +0200

> On 16 Jun 2025, at 11:20, Eli Zaretskii <eliz <at> gnu.org> wrote:
> 
>> From: Rudolf Schlatte <rudi <at> constantly.at>
>> 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?

That would also work, yes, just a little less “electrical”:  If the auto-insert string after the opening sequence can’t be configured, I’d use an entry ("\"\"\"" "\"\"\”" 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’s not a big deal; please don’t let me block the patch going in.  I’m looking forward to having multi-character electric pairs built in!





This bug report was last modified 24 days ago.

Previous Next


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