Subject: Re: bug#79047: Add some multi-character pairs to some major modes.

From: Elijah Gabe Pérez <[email-masked]>
Date: Tue, 22 Jul 2025 17:03:34 -0600

Alan Mackenzie <[email-masked]> writes:

> Hello, Elijah.
>
> One important point.
>
> Are you sure about this?  In NEWS, there is the rather sloppily worded
> entry:
>
>     ** Electric Pair mode can now pair multiple delimiters at once.
>     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.
>
> It uses the sloppy American English ambiguity where "multiple" can mean
> either "several", or "composed of several parts".  In correct British
> English "multiple" has only the latter meaning.
>
> I think in this NEWS entry the meaning "several" was intended, and you
> may have misread it.  I don't think electric-pair-mode has any facilities
> for pairing a multiple delimiter; only for pairing several of the same
> delimiter at once, e.g. (((....))).

That is the wrong NEWS entry of the feature.
The real one is this:

  *** Electric Pair mode now supports multi-character paired delimiters.
  'electric-pair-pairs' and 'electric-pair-text-pairs' now allow using
  strings for multi-character paired delimiters.

  To use this, add a list to both electric pair user options: '("/*" . "*/")'.

  You can also specify to insert an extra space after the first string
  pair: '("/*" " */" t)'.

> Please check if I am correct or mistaken on this point.  If I'm correct,
> then the prerequisites for implementing this change are absent, and there
> is nothing more to discuss.

I've tested the feature, it's possible to achieve it:

  (setq electric-pair-pairs `((,(regexp-quote "/*") " */" t)))

  /* | */
       ^^ After inserting the * character.
          (the extra whitespace is optionally included)

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