Subject: bug#72437: Unexpected behavior when inserting with prefix arg in electric-pair-mode

From: Eli Zaretskii <[email-masked]>
Date: Sat, 03 Aug 2024 21:46:22 +0300

> From: Eshel Yaron <[email-masked]>
> Cc: [email-masked],  [email-masked],
>   [email-masked]
> Date: Sat, 03 Aug 2024 20:18:06 +0200
> 
> >> I'm no Stefan, but I took a quick stab at it.  The following diff
> >> teaches electric-pair-mode about numeric prefix arguments:
> >
> > Thanks, but isn't it cleaner if we simply call the hook from cmds.c
> > the same number of times as we insert a character?
> 
> Interesting, it might work for electric-pair-mode, though I suspect that
> not all functions that people put on post-self-insert-hook are prepared
> to be invoked repeatedly following a single self-insert-command.

It isn't a single self-insert-command, since it inserts N characters.
So it is natural to expect the hook to be invoked those same N times.
I think.  Let's hear what Stefan thinks (and anyone else who has an
opinion or some case other than electric-pair-mode).