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

Full log


View this message in rfc822 format

From: Rudolf Schlatte <rudi <at> constantly.at>
To: 78053 <at> debbugs.gnu.org
Subject: bug#78053: [PATCH] Support strings for electric-pairs.
Date: Thu, 12 Jun 2025 09:47:15 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Elijah Gabe Pérez <eg642616 <at> gmail.com>
>> Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>,  78053 <at> debbugs.gnu.org,
>>   joaotavora <at> gmail.com
>> Date: Sun, 08 Jun 2025 12:24:57 -0600
>> 
>> Eli Zaretskii <eliz <at> gnu.org> 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 = """
    |"""





This bug report was last modified 1 day ago.

Previous Next


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