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

From: Eshel Yaron <[email-masked]>
Date: Sat, 03 Aug 2024 20:18:06 +0200

Hi Eli,

Eli Zaretskii <[email-masked]> writes:

>> From: Eshel Yaron <[email-masked]>
>> Cc: Joseph Turner <[email-masked]>,  Stefan Monnier
>>  <[email-masked]>,  [email-masked]
>> Date: Sat, 03 Aug 2024 13:04:58 +0200
>> 
>> Eli Zaretskii <[email-masked]> writes:
>> 
>> > 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?
>> 
>> 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.