From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Filipp Gunbin Newsgroups: gmane.emacs.bugs Subject: bug#51620: add-hook repeatedly adds same function into hook--depth-alist Date: Sat, 06 Nov 2021 23:31:58 +0300 Message-ID: References: <87r1buf8fl.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35717"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.60 (darwin) Cc: 51620@debbugs.gnu.org, Stefan Monnier To: Michael Heerdegen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Nov 06 21:33:14 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 1mjSND-0008za-QL for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 06 Nov 2021 21:33:13 +0100 Original-Received: from localhost ([::1]:58478 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mjSNB-00056d-RG for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 06 Nov 2021 16:33:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47668) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mjSN4-00056E-6x for bug-gnu-emacs@gnu.org; Sat, 06 Nov 2021 16:33:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39344) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mjSN3-00027j-Ty for bug-gnu-emacs@gnu.org; Sat, 06 Nov 2021 16:33:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mjSN3-0006JQ-Mx for bug-gnu-emacs@gnu.org; Sat, 06 Nov 2021 16:33:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Filipp Gunbin Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 06 Nov 2021 20:33:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51620 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 51620-submit@debbugs.gnu.org id=B51620.163623072924194 (code B ref 51620); Sat, 06 Nov 2021 20:33:01 +0000 Original-Received: (at 51620) by debbugs.gnu.org; 6 Nov 2021 20:32:09 +0000 Original-Received: from localhost ([127.0.0.1]:50890 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mjSMC-0006IA-Jp for submit@debbugs.gnu.org; Sat, 06 Nov 2021 16:32:08 -0400 Original-Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:33913) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mjSM9-0006Hy-Du for 51620@debbugs.gnu.org; Sat, 06 Nov 2021 16:32:07 -0400 Original-Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id F2C4232007CF; Sat, 6 Nov 2021 16:32:02 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Sat, 06 Nov 2021 16:32:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.fm; h= from:to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type; s=fm1; bh=zTFfZMmkiC254StSq+Yf90IjAE iMjxbDixcq2LBGwxU=; b=DYRdm9TkqCn64AlQZsoim5R6Dfd1XKk5+pKCsND1RR iIVhFPd8YYKyNPC1IvdiNSUNoCz9i52oPZi34f6nMoSJ2iPnEIJrgYCFAOcLKgTO 2GIGf9poG8MnHKc8kn2aWVzllB+Sv5l7xt8c5oZN5siN69N0P3Z+md7+bvazsIAe hq+G9TZiShGjbcI3xHZ7tsa9qx7PK5jJ02m8b3G0U1BHyEJSWoM14XnaoagSZaXC YExq5vxRrtaECMyWdgAxIKYxstzCX0RIitqkTkQothzwVBNpRfTKvJ+xeDaUQwTw uXSZ898BjyeaJWgJdoRNmZLHeDB46uadJcAVYdv+l/2g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=zTFfZM mkiC254StSq+Yf90IjAEiMjxbDixcq2LBGwxU=; b=mxLQkmGh4wv11K0+n/qJ5s C96P+kxT5SdZQrb+l3KyE42uJjRxVOoepTjrYlFIMnfa2NwgwDPjhN7DFXq9o8Ff iEi9QmD46Haz9QnGqJr69eVtDvFVmFxMK1M1LrCJPF99QCyarPsDvXDhXd2NMK73 Jmnvlm9yIRcHa779MELUTP6lj33tKF90NAUjl0yRVzGW0XCrIjAxF3oh515F4cOz 319R0kdQBFfoO6+YH1IjXIszeGElJImTd6RI4CDkH1EAKRvGKXJmbC9c6D9pMlbM 0WtF14sHHSqhHK5fzp0pguimTtUSxZxK6UtaY6YDjMBh9nJx+bgW/P+6zXDTK17w == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrtdekgddufeeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufgjfhgffffkgggtsehttdertddtredtnecuhfhrohhmpefhihhlihhp phcuifhunhgsihhnuceofhhguhhnsghinhesfhgrshhtmhgrihhlrdhfmheqnecuggftrf grthhtvghrnhepvdevkeffvdeuvefhuddtjeehkedvueefveettddtveduudfgieffieev ieevhfdtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh epfhhguhhnsghinhesfhgrshhtmhgrihhlrdhfmh X-ME-Proxy: Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 6 Nov 2021 16:32:00 -0400 (EDT) In-Reply-To: <87r1buf8fl.fsf@web.de> (Michael Heerdegen's message of "Sat, 06 Nov 2021 01:13:02 +0100") 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:219161 Archived-At: On 06/11/2021 01:13 +0100, Michael Heerdegen wrote: > Filipp Gunbin writes: > >> diff --git a/lisp/subr.el b/lisp/subr.el >> index 8ff403e113..2b8b6deeb0 100644 >> --- a/lisp/subr.el >> +++ b/lisp/subr.el >> @@ -1868,7 +1868,7 @@ add-hook >> (when (or (get hook 'hook--depth-alist) (not (zerop depth))) >> ;; Note: The main purpose of the above `when' test is to avoid running >> ;; this `setf' before `gv' is loaded during bootstrap. >> - (push (cons function depth) (get hook 'hook--depth-alist))) >> + (setf (alist-get function (get hook 'hook--depth-alist) 0) depth)) >> (setq hook-value >> (if (< 0 depth) >> (append hook-value (list function)) > > So the function would still be compared using `eq' but we would avoid to > add dups of equal conses? Looks reasonable to me -- Stefan? Yep, that was the intent.