From: Alan Mackenzie <acm@muc.de>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 33840@debbugs.gnu.org
Subject: bug#33840: electric-pair-mode breaks self-insert-command
Date: Wed, 10 Jul 2019 09:39:56 +0000 [thread overview]
Message-ID: <20190710093956.GA4109@ACM> (raw)
In-Reply-To: <87r26yq1dn.fsf@mouse.gnus.org>
Hello, Lars.
On Wed, Jul 10, 2019 at 00:39:00 +0200, Lars Ingebrigtsen wrote:
> Alan Mackenzie <acm@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).
next prev parent reply other threads:[~2019-07-10 9:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-23 2:38 bug#33840: electric-pair-mode breaks self-insert-command Alan Mackenzie
2019-07-09 22:39 ` Lars Ingebrigtsen
2019-07-10 9:39 ` Alan Mackenzie [this message]
2019-07-10 11:34 ` Lars Ingebrigtsen
2019-07-10 17:08 ` Noam Postavsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190710093956.GA4109@ACM \
--to=acm@muc.de \
--cc=33840@debbugs.gnu.org \
--cc=larsi@gnus.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.