[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#33840: electric-pair-mode breaks self-insert-command
From: |
Lars Ingebrigtsen |
Subject: |
bug#33840: electric-pair-mode breaks self-insert-command |
Date: |
Wed, 10 Jul 2019 13:34:26 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
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:
---
(self-insert-command N &optional C)
Probably introduced at or before Emacs version 22.1.
Insert the character you type.
Whichever character C you type to run this command is inserted.
The numeric prefix argument N says how many times to repeat the insertion.
Before insertion, ‘expand-abbrev’ is executed if the inserted character does
not have word syntax and the previous character in the buffer does.
After insertion, ‘internal-auto-fill’ is called if
‘auto-fill-function’ is non-nil and if the ‘auto-fill-chars’ table has
a non-nil value for the inserted character. At the end, it runs
‘post-self-insert-hook’.
---
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. But if you are going to close it, please mark it as
> "won't fix" and _not_ "not a bug".
Will do. :-)
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no