GNU bug report logs - #79047
Add some multi-character pairs to some major modes.

Previous Next

Package: emacs;

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

Date: Sat, 19 Jul 2025 02:05:02 UTC

Severity: normal

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

Full log


Message #29 received at 79047 <at> debbugs.gnu.org (full text, mbox):

From: Elijah Gabe Pérez <eg642616 <at> gmail.com>
To: Alan Mackenzie <acm <at> muc.de>
Cc: 79047 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>,
 John Muhl <jm <at> pub.pink>, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#79047: Add some multi-character pairs to some major modes.
Date: Tue, 22 Jul 2025 17:03:34 -0600
Alan Mackenzie <acm <at> muc.de> 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.




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.