From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii 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, 01 Dec 2019 22:47:01 +0200 Message-ID: <83blsrn58a.fsf@gnu.org> References: <20191130143638.GA6716@ACM> <20191201150738.GB5085@ACM> <83imn0lyed.fsf@gnu.org> <20191201192709.GE5085@ACM> Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="47677"; mail-complaints-to="usenet@blaine.gmane.org" Cc: yyoncho@gmail.com, 38406@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Dec 01 21:48:09 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 1ibW8X-000CEn-M0 for geb-bug-gnu-emacs@m.gmane.org; Sun, 01 Dec 2019 21:48:09 +0100 Original-Received: from localhost ([::1]:55388 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ibW8W-0002QC-Gl for geb-bug-gnu-emacs@m.gmane.org; Sun, 01 Dec 2019 15:48:08 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46874) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ibW8R-0002Q1-6Y for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2019 15:48:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ibW8Q-000413-6m for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2019 15:48:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:59036) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ibW8Q-00040x-3n for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2019 15:48:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ibW8Q-0007Gi-1t for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2019 15:48:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 01 Dec 2019 20:48: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.157523324727896 (code B ref 38406); Sun, 01 Dec 2019 20:48:01 +0000 Original-Received: (at 38406) by debbugs.gnu.org; 1 Dec 2019 20:47:27 +0000 Original-Received: from localhost ([127.0.0.1]:36776 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ibW7q-0007Fs-Uy for submit@debbugs.gnu.org; Sun, 01 Dec 2019 15:47:27 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:37623) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ibW7o-0007Fd-FX for 38406@debbugs.gnu.org; Sun, 01 Dec 2019 15:47:25 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:53133) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ibW7i-0003Zy-TU; Sun, 01 Dec 2019 15:47:18 -0500 Original-Received: from [176.228.60.248] (port=4846 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ibW7f-00049x-QJ; Sun, 01 Dec 2019 15:47:18 -0500 In-reply-to: <20191201192709.GE5085@ACM> (message from Alan Mackenzie on Sun, 1 Dec 2019 19:27:09 +0000) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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:172732 Archived-At: > Date: Sun, 1 Dec 2019 19:27:09 +0000 > Cc: yyoncho@gmail.com, 38406@debbugs.gnu.org > From: Alan Mackenzie > > post-self-insert-hook's functions, unusually amongs hooks, interfere with > its triggering event. This contrasts with, say, after-change-functions, > where the functions don't insert into or delete from the buffer, or > pre-redisplay-functions, where the functions don't try to prevent a > particular window getting displayed. You'd be surprised to know what some of those hooks do. Everything you say they don't, and then some. There's nothing we can do to prevent people from shooting themselves in the foot or hanging themselves with the rope we provided. And if you think you are the only one who needs to harden your code to let people do the craziest things with these hooks, please don't think so: you are definitely not alone. But breaking a hook's contract as a means to teach people not to shoot themselves in the foot is not right. If the uses are legitimate, they should be able to do them; if they aren't, let them cope with the consequences. > So to call this hook at the end of c-electric-brace would mean having to > filter the hook first (at the very least, to remove > electric-pair-post-self-insert-function), which just seems very hackish > and unsatisfactory. It doesn't seem too hackish to me, and as a nice bonus we will have post-self-insert-hook act as per its contract again. So could you please do that? TIA.