From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs 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 Message-ID: <20191201155842.GC5085@ACM> References: <20191130143638.GA6716@ACM> <20191201150738.GB5085@ACM> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="224539"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.10.1 (2018-07-13) Cc: 38406@debbugs.gnu.org To: yyoncho Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Dec 01 16:59:11 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1ibRcs-000wIg-SS for geb-bug-gnu-emacs@m.gmane.org; Sun, 01 Dec 2019 16:59:11 +0100 Original-Received: from localhost ([::1]:52598 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ibRcr-0002wE-8y for geb-bug-gnu-emacs@m.gmane.org; Sun, 01 Dec 2019 10:59:09 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37530) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ibRck-0002so-Ss for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2019 10:59:03 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ibRcj-0004wk-QJ for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2019 10:59:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58851) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ibRcj-0004we-N5 for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2019 10:59:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ibRcj-00066P-Lb for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2019 10:59:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 01 Dec 2019 15:59:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38406 X-GNU-PR-Package: emacs Original-Received: via spool by 38406-submit@debbugs.gnu.org id=B38406.157521592823435 (code B ref 38406); Sun, 01 Dec 2019 15:59:01 +0000 Original-Received: (at 38406) by debbugs.gnu.org; 1 Dec 2019 15:58:48 +0000 Original-Received: from localhost ([127.0.0.1]:36591 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ibRcV-00065u-Uv for submit@debbugs.gnu.org; Sun, 01 Dec 2019 10:58:48 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:61000 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1ibRcU-00065m-Ih for 38406@debbugs.gnu.org; Sun, 01 Dec 2019 10:58:47 -0500 Original-Received: (qmail 23761 invoked by uid 3782); 1 Dec 2019 15:58:44 -0000 Original-Received: from acm.muc.de (p2E5D5336.dip0.t-ipconnect.de [46.93.83.54]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 01 Dec 2019 16:58:42 +0100 Original-Received: (qmail 6403 invoked by uid 1000); 1 Dec 2019 15:58:42 -0000 Content-Disposition: inline In-Reply-To: X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:172714 Archived-At: 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).