[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#33840: electric-pair-mode breaks self-insert-command
From: |
Noam Postavsky |
Subject: |
bug#33840: electric-pair-mode breaks self-insert-command |
Date: |
Wed, 10 Jul 2019 13:08:24 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1.92 (windows-nt) |
Lars Ingebrigtsen <larsi@gnus.org> writes:
> Alan Mackenzie <acm@muc.de> writes:
>
>> self-insert-command is a primitive, and it shouldn't be modified to do
>> other things. Instead these other things should be done alongside the
>> primitive, or after it.
>>
>> Similarly, you would not modify + such that (+ 2 3) => 6, even if you had
>> a use case where you wanted this strange arithmetic.
>
> I agree that modifying primitives is really confusing and should be
> avoided, but I don't think self-insert-command is ... very primitive.
> :-) I mean, look at the doc string:
[...]
> There's a lot of stuff going on there! It sounds more like a "don't use
> this function from code unless you want unpredictable things to happen"
> thing to me...
>
>> Being realistic, I now don't really expect this bug to be fixed. It
>> would cost too much.
FWIW, I don't think using a documented hook should be considered
"modifying" the primitive which calls it (unlike say, using advice).
But electric-pair-mode's current implementation seems to involve a
complicated dance of inserting and deleting and inserting characters
again, so I think there is some room for improvement. Perhaps by using
something other than post-self-insert-hook.