From: Alan Mackenzie <acm@muc.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: yyoncho@gmail.com, 38406@debbugs.gnu.org
Subject: bug#38406: 27.0.50; post-self-insert-hook does not hold its contract in cc-mode derived modes
Date: Fri, 6 Dec 2019 22:24:59 +0000 [thread overview]
Message-ID: <20191206222459.GB3999@ACM> (raw)
In-Reply-To: <83y2vpffyd.fsf@gnu.org>
Hello, Eli.
On Fri, Dec 06, 2019 at 20:48:26 +0200, Eli Zaretskii wrote:
> > Date: Fri, 6 Dec 2019 18:28:42 +0000
> > Cc: yyoncho@gmail.com, 38406@debbugs.gnu.org
> > From: Alan Mackenzie <acm@muc.de>
> > > There might be a misunderstanding on my part here. Could you please
> > > explain how come electric-pair-post-self-insert-function is called
> > > twice if it isn't removed from the hook? where's the second (or the
> > > first) call?
> > The first call is an explicit call from c-electric-brace to
> > electric-pair-post-self-insert-function. Depending on the changes to the
> > buffer this call causes (amongst other things), differing electric
> > actions are performed by c-electric-brace. This call is itself a
> > workaround, there being no purpose designed function for this purpose in
> > elec-pair.el.
> > The second call happens when c-electric-brace run-hook's
> > post-self-insert-hook - _if_ electric-pair-post-self-insert-function
> > hasn't been filtered out of that hook.
> If you already call that particular function explicitly, then calling
> it one more time is indeed redundant.
No, it's not redundant. It's positively harmful.
> But is this the case with all the other functions that you suggest to
> filter from post-self-insert-hook?
No. They have individual reasons for being filtered out. Don't forget
that this is a particularly sensitive hook, allowing hook functions to
interfere in an unsynchronised way with partially complete command
processing.
Let's go through them again:
smie-blink-matching-open is inapplicable to CC Mode and just takes up
processor cycles.
electric-pair-post-self-insert-function we've already discussed.
blink-paren-post-self-insert-function would do nothing anyhow, since
blink-paren-function has been bound to nil - this is so that the actual
blinking doesn't occur until the newly inserted brace is at its final
position.
electric-indent-post-self-insert-function is redundant and possibly
harmful.
electric-layout-post-self-insert-function is undocumented, thus likely
to be harmful. Its name suggests it is redundant.
electric-quote-post-self-insert-function is undocumented, uncommented
and obscure. It is safer not to risk running it.
Given that the mechanism for filtering post-self-insert-hook is there,
why is there the resistance to filtering out redundant and effect-free
functions?
And how come functions without meaningful doc strings are allowed onto
Emacs hooks?
--
Alan Mackenzie (Nuremberg, Germany).
next prev parent reply other threads:[~2019-12-06 22:24 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-27 20:00 bug#38406: 27.0.50; post-self-insert-hook does not hold its contract in cc-mode derived modes yyoncho
2019-11-30 14:36 ` Alan Mackenzie
2019-12-01 10:02 ` yyoncho
2019-12-01 15:07 ` Alan Mackenzie
2019-12-01 15:27 ` yyoncho
2019-12-01 15:58 ` Alan Mackenzie
2019-12-01 18:03 ` Eli Zaretskii
2019-12-02 18:37 ` Alan Mackenzie
2019-12-01 17:59 ` Eli Zaretskii
2019-12-01 19:27 ` Alan Mackenzie
2019-12-01 20:47 ` Eli Zaretskii
2019-12-02 18:31 ` Alan Mackenzie
2019-12-02 20:17 ` Eli Zaretskii
2019-12-04 20:41 ` Alan Mackenzie
2019-12-04 21:04 ` Dmitry Gutov
2019-12-05 19:14 ` Alan Mackenzie
2019-12-05 20:44 ` Dmitry Gutov
2019-12-05 14:45 ` Eli Zaretskii
2019-12-05 19:09 ` Alan Mackenzie
2019-12-05 19:25 ` Eli Zaretskii
2019-12-05 20:17 ` Alan Mackenzie
2019-12-06 8:06 ` Eli Zaretskii
2019-12-06 18:28 ` Alan Mackenzie
2019-12-06 18:48 ` Eli Zaretskii
2019-12-06 22:24 ` Alan Mackenzie [this message]
2019-12-07 8:21 ` Eli Zaretskii
2019-12-07 11:40 ` Alan Mackenzie
2019-12-07 13:27 ` Eli Zaretskii
2019-12-07 19:03 ` Alan Mackenzie
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=20191206222459.GB3999@ACM \
--to=acm@muc.de \
--cc=38406@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=yyoncho@gmail.com \
/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.