[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#38406: 27.0.50; post-self-insert-hook does not hold its contract in
From: |
Alan Mackenzie |
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 18:28:42 +0000 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
Hello, Eli.
On Fri, Dec 06, 2019 at 10:06:31 +0200, Eli Zaretskii wrote:
> > Date: Thu, 5 Dec 2019 20:17:13 +0000
> > Cc: yyoncho@gmail.com, 38406@debbugs.gnu.org
> > From: Alan Mackenzie <acm@muc.de>
> > > We never provide any "safety nets" for silly hook functions, so we
> > > shouldn't do that here as well. OTOH, if someone puts a function
> > > on those hooks which does something legitimate, we should meet
> > > their expectations and let those functions run, as the contract
> > > says.
> > I think that, with my latest patch, that is the case.
> > > So I think you shouldn't filter anything from the hook before you
> > > run it.
> > I thought you were urging me to do precisely that two or three posts
> > ago.
> > I just tried taking a particular function off of
> > c--unsafe-post-self-insert-hook-functions and enabling electric-pair
> > mode. On typing a brace, electric-pair-mode threw an obscure error.
> > It doesn't make sense to call electric-pair-post-self-insert-function
> > twice for one keypress. That is a good reason for having that
> > function filtered out of the hook.
> 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.
> > The root of the problem is the hook post-self-insert-hook. It is a
> > thoroughly bad idea. The implications of introducing it a few years ago
> > weren't thought through.
> That might be so, but I think it's too late for removing it now.
> > Assuming that removing this hook from Emacs isn't an option, we are
> > left with ugly ad-hoc workarounds, such as the patch we're currently
> > discussing.
> Yes.
--
Alan Mackenzie (Nuremberg, Germany).
- bug#38406: 27.0.50; post-self-insert-hook does not hold its contract in cc-mode derived modes, (continued)
- bug#38406: 27.0.50; post-self-insert-hook does not hold its contract in cc-mode derived modes, Eli Zaretskii, 2019/12/02
- bug#38406: 27.0.50; post-self-insert-hook does not hold its contract in cc-mode derived modes, Alan Mackenzie, 2019/12/04
- bug#38406: 27.0.50; post-self-insert-hook does not hold its contract in cc-mode derived modes, Dmitry Gutov, 2019/12/04
- bug#38406: 27.0.50; post-self-insert-hook does not hold its contract in cc-mode derived modes, Alan Mackenzie, 2019/12/05
- bug#38406: 27.0.50; post-self-insert-hook does not hold its contract in cc-mode derived modes, Dmitry Gutov, 2019/12/05
- bug#38406: 27.0.50; post-self-insert-hook does not hold its contract in cc-mode derived modes, Eli Zaretskii, 2019/12/05
- bug#38406: 27.0.50; post-self-insert-hook does not hold its contract in cc-mode derived modes, Alan Mackenzie, 2019/12/05
- bug#38406: 27.0.50; post-self-insert-hook does not hold its contract in cc-mode derived modes, Eli Zaretskii, 2019/12/05
- bug#38406: 27.0.50; post-self-insert-hook does not hold its contract in cc-mode derived modes, Alan Mackenzie, 2019/12/05
- bug#38406: 27.0.50; post-self-insert-hook does not hold its contract in cc-mode derived modes, Eli Zaretskii, 2019/12/06
- bug#38406: 27.0.50; post-self-insert-hook does not hold its contract in cc-mode derived modes,
Alan Mackenzie <=
- bug#38406: 27.0.50; post-self-insert-hook does not hold its contract in cc-mode derived modes, Eli Zaretskii, 2019/12/06
- bug#38406: 27.0.50; post-self-insert-hook does not hold its contract in cc-mode derived modes, Alan Mackenzie, 2019/12/06
- bug#38406: 27.0.50; post-self-insert-hook does not hold its contract in cc-mode derived modes, Eli Zaretskii, 2019/12/08
- bug#38406: 27.0.50; post-self-insert-hook does not hold its contract in cc-mode derived modes, Alan Mackenzie, 2019/12/07
- bug#38406: 27.0.50; post-self-insert-hook does not hold its contract in cc-mode derived modes, Eli Zaretskii, 2019/12/07
- bug#38406: 27.0.50; post-self-insert-hook does not hold its contract in cc-mode derived modes, Alan Mackenzie, 2019/12/07