GNU bug report logs -
#33840
electric-pair-mode breaks self-insert-command
Previous Next
Reported by: Alan Mackenzie <acm <at> muc.de>
Date: Sun, 23 Dec 2018 02:46:01 UTC
Severity: normal
Tags: wontfix
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #11 received at 33840 <at> debbugs.gnu.org (full text, mbox):
Hello, Lars.
On Wed, Jul 10, 2019 at 00:39:00 +0200, Lars Ingebrigtsen wrote:
> Alan Mackenzie <acm <at> muc.de> writes:
> > In the master branch, put the following into *scratch* and evaluate it:
> > (defun s-i-c ()
> > (interactive)
> > (self-insert-command 1))
> > (local-set-key "(" 's-i-c))
> > On typing "(", it will be seen that the self-insert-command does its
> > job, correctly entering "(" into *scratch*.
> > Now do M-x electric-pair-mode.
> > If you now type "(", self-insert-command wrongly enters "()" into the
> > buffer. This is a bug, and is the root cause of bug #33794.
> I must be misunderstanding something -- isn't the entire point of
> electric-pair-mode that it inserts the corresponding parenthesis when
> self-insert-command is called on one of the magical characters?
But the entire point of (self-insert-command 1) is to insert exactly one
copy of what was just typed. With electric-pair-mode enabled, it no
longer does this; it does something else instead.
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.
Because of this change to self-insert-command, other uses of it (other
than when bound directly to a key) fail. This happened in bug #33794
where this change to self-insert-command broke c-electric-brace. This
has since been worked around by other means.
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".
Thanks!
> --
> (domestic pets only, the antidote for overdose, milk.)
> bloggy blog: http://lars.ingebrigtsen.no
--
Alan Mackenzie (Nuremberg, Germany).
This bug report was last modified 5 years and 315 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.