From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Daniel Mendler Newsgroups: gmane.emacs.bugs Subject: bug#47992: 27; 28; Phase out use of `equal` in `add-hook`, `remove-hook` Date: Sun, 2 May 2021 12:37:24 +0200 Message-ID: <8b715c19-e6bf-90a8-75a2-3ae3e1ace563@daniel-mendler.de> References: <87mttdh57n.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5781"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 47992@debbugs.gnu.org, monnier@iro.umontreal.ca, jakanakaevangeli@chiru.no To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun May 02 12:38:18 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ld9UQ-0001QS-FU for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 02 May 2021 12:38:18 +0200 Original-Received: from localhost ([::1]:38554 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ld9UP-0007sy-Fi for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 02 May 2021 06:38:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50596) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ld9UB-0007r4-7C for bug-gnu-emacs@gnu.org; Sun, 02 May 2021 06:38:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58789) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ld9UA-0006TK-Ux for bug-gnu-emacs@gnu.org; Sun, 02 May 2021 06:38:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ld9UA-0003am-TL for bug-gnu-emacs@gnu.org; Sun, 02 May 2021 06:38:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Daniel Mendler Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 02 May 2021 10:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47992 X-GNU-PR-Package: emacs Original-Received: via spool by 47992-submit@debbugs.gnu.org id=B47992.161995185513772 (code B ref 47992); Sun, 02 May 2021 10:38:02 +0000 Original-Received: (at 47992) by debbugs.gnu.org; 2 May 2021 10:37:35 +0000 Original-Received: from localhost ([127.0.0.1]:42097 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ld9Tj-0003a4-7L for submit@debbugs.gnu.org; Sun, 02 May 2021 06:37:35 -0400 Original-Received: from server.qxqx.de ([178.63.65.180]:50221 helo=mail.qxqx.de) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ld9Th-0003Zy-DH for 47992@debbugs.gnu.org; Sun, 02 May 2021 06:37:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=qxqx.de; s=mail1392553390; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=wbMG+JNJqGNg4vDHPHG24mK/RfswWHGRj7oq0HxMdjU=; b=ZuXUL1fdtlmE+jq43yEORdzxxc uY+wlGqFEyr0HutfmN/vRueaOL+xpa0kVnKC8uscLxidy5v/wrx0L1tBmTxBER5jWj0xRpDUmGjRa 8yRvXlcU8HCRxrkRhqAW3VyLxEG/eiF2W9UtSqhrND+cuTc2OPSbqcGM6hPmt+9wFsug=; In-Reply-To: <87mttdh57n.fsf@gnus.org> Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:205421 Archived-At: On 5/2/21 11:09 AM, Lars Ingebrigtsen wrote:> And since 2) isn't possible, I don't really think 1) is possible > either. People do `M-x eval-buffer' their .emacs files, and since we're > using `equal' here, this happens to work -- almost by accident. I understand. This argument is pretty similar to Drew's argument, but realistic. The problem is that people expect idempotence when evaluating their ".emacs". This property breaks as soon as we require `eq` and if we want to retain this behavior we have no alternative than keeping the current behavior. >From my experience, relying on this accidental idempotence when evaluating buffers almost ever breaks in more intricate scenarios, so I am usually not relying on this behavior. But making it break more often is not a good idea, in particular in this important use case of the ".emacs", which is one of the points where people get first contact with Elisp. There are the following resolutions from my perspective: 1. Do almost nothing, but document the behavior of `add/remove-hook` more precisely. Add a warning, that the functions should not be used with large/cyclic closures and an symbol indirection should be used in such scenarios. Generally it should be recommended to add symbols. 2. As you propose we could either add new `add/remove-hook-eq` variants. 3. Add an argument to the `add/remove-hook` functions, which allows to turn on `eq` equality. I assume the problem is mostly gone now due to the patches applied previously by Stefan to `add/remove-hook`, which removed the depth information to avoid leaks. In particular the problem with the original `minibuffer-with-setup-hook` I observed was gone after the changes to `add/remove-hook`. So my favorite resolution is 1. Daniel