[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: |
Sun, 1 Dec 2019 15:58:42 +0000 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
Hello, Ivan.
On Sun, Dec 01, 2019 at 17:27:33 +0200, yyoncho wrote:
> Hi Alan
> I am not aware of how exactly smartparens uses post-insert-hook.
In the simplest case, when you type, e.g. "{", it inserts "{}". In other
cases, when you type "}" onto the existing Rbrace in "{}" it erases one
of the Rbraces.
The problem with this for CC Mode (in c-electric-brace, for example) is
that all these extra and removed characters play havoc with CC Mode's
insertion of auto-newlines and its execution of "clean ups" (e.g.
compacting "}\n else {" to "} else {").
> > Again, how does this binding of post-self-insert-hook to nil in CC
> > Mode affect you? What is it you're trying to do that this binding
> > makes difficult?
> ATM this change breaks at least 2 packages - lsp-mode and smartparents. I
> am the maintainer of lsp-mode and it uses the hook for 2 things:
> 1. There are keys that are triggering displaying function signature.
> 2. There are keys that are triggering onTypeFormatting which happens
> asynchronously.
Ok, thanks for telling me!
Why are you using post-self-insert-hook for these? This hook can run in
the middle of a major mode's command, but surely you want them to run
_after_ that command, no? Why not use post-command-hook here instead?
> Thanks,
> Ivan
--
Alan Mackenzie (Nuremberg, Germany).
- bug#38406: 27.0.50; post-self-insert-hook does not hold its contract in cc-mode derived modes, yyoncho, 2019/12/01
- bug#38406: 27.0.50; post-self-insert-hook does not hold its contract in cc-mode derived modes, Eli Zaretskii, 2019/12/01
- 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