GNU bug report logs - #72437
Unexpected behavior when inserting with prefix arg in electric-pair-mode

Previous Next

Package: emacs;

Reported by: Joseph Turner <joseph <at> breatheoutbreathe.in>

Date: Sat, 3 Aug 2024 07:14:02 UTC

Severity: normal

Fixed in version 31.1

Done: Eshel Yaron <me <at> eshelyaron.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Joseph Turner <joseph <at> breatheoutbreathe.in>, Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 72437 <at> debbugs.gnu.org
Subject: bug#72437: Unexpected behavior when inserting with prefix arg in electric-pair-mode
Date: Sat, 03 Aug 2024 12:12:06 +0300
> Cc: eliz <at> gnu.org
> From: Joseph Turner <joseph <at> breatheoutbreathe.in>
> Date: Sat, 03 Aug 2024 00:12:33 -0700
> 
> Migrated from this thread on the devel mailing list:
> 
> https://yhetil.org/emacs-devel/86ikwiumza.fsf <at> gnu.org/T/#t
> 
> 
> On Emacs 29.4, with emacs -Q
> 
> Turn on electric-pair-mode
> 
> (electric-pair-mode +1)
> 
> Then press "C-2 ("
> 
> Expected result:
> 
> Either (()) or ()()
> 
> Actual result:
> 
> (()
> 
> 
> I noticed the unexpected behavior when attempting to surround some text
> with multiple braces in order to create Anki flashcards.
> 
> More or less, I wanted to go from "foo" to "{{foo}}", and I thought
> perhaps that with the whole word selected, pressing "C-2 {" would DTRT.
> 
> In general, I'm not sure whether "{}{}" or "{{}}"is more useful or
> expected, but I suspect both are better than "{{}".

Making it produce "{}{}" is relatively easy: we just need to call the
post-self-insert-hook for each of the ARG inserted characters.  OTOH,
to produce "{{}}" we'd probably need to rewrite the
electric-pair-mode's hook function, but I have no idea how to rewrite
it to do that.

Stefan, any suggestions?




This bug report was last modified 302 days ago.

Previous Next


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