Subject: bug#78053: [PATCH] Support strings for electric-pairs.

From: Eli Zaretskii <[email-masked]>
Date: Thu, 12 Jun 2025 10:35:09 +0300

> From: Elijah Gabe Pérez <[email-masked]>
> Cc: Stefan Monnier <[email-masked]>,  [email-masked],
>   [email-masked]
> Date: Sun, 08 Jun 2025 12:24:57 -0600
> 
> Eli Zaretskii <[email-masked]> 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.