GNU bug report logs -
#38406
27.0.50; post-self-insert-hook does not hold its contract in cc-mode derived modes
Previous Next
Reported by: yyoncho <yyoncho <at> gmail.com>
Date: Wed, 27 Nov 2019 20:01:01 UTC
Severity: normal
Found in version 27.0.50
Done: Alan Mackenzie <acm <at> muc.de>
Bug is archived. No further changes may be made.
Full log
Message #20 received at 38406 <at> debbugs.gnu.org (full text, mbox):
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).
This bug report was last modified 5 years and 168 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.