unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Noam Postavsky <npostavs@gmail.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: Alan Mackenzie <acm@muc.de>, 33840@debbugs.gnu.org
Subject: bug#33840: electric-pair-mode breaks self-insert-command
Date: Wed, 10 Jul 2019 13:08:24 -0400	[thread overview]
Message-ID: <85sgrdddh3.fsf@gmail.com> (raw)
In-Reply-To: <m3y31615tp.fsf@gnus.org> (Lars Ingebrigtsen's message of "Wed, 10 Jul 2019 13:34:26 +0200")

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.





      reply	other threads:[~2019-07-10 17:08 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
2019-07-10 11:34     ` Lars Ingebrigtsen
2019-07-10 17:08       ` Noam Postavsky [this message]

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=85sgrdddh3.fsf@gmail.com \
    --to=npostavs@gmail.com \
    --cc=33840@debbugs.gnu.org \
    --cc=acm@muc.de \
    --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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).