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#34686: 26.1; unload-feature doesn't remove functions locally from hooks Date: Thu, 28 Feb 2019 20:03:27 +0200 Message-ID: <83ef7rkcy8.fsf@gnu.org> References: <11240364.O9o76ZdvQC@gabor> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="16807"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 34686@debbugs.gnu.org To: Braun =?UTF-8?Q?G=C3=A1bor?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Feb 28 19:05:18 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.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gzQ3a-0004G7-1K for geb-bug-gnu-emacs@m.gmane.org; Thu, 28 Feb 2019 19:05:18 +0100 Original-Received: from localhost ([127.0.0.1]:44319 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gzQ3Z-0003Du-1K for geb-bug-gnu-emacs@m.gmane.org; Thu, 28 Feb 2019 13:05:17 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:43719) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gzQ3R-0003Ak-Hd for bug-gnu-emacs@gnu.org; Thu, 28 Feb 2019 13:05:10 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gzQ3P-0004dV-HD for bug-gnu-emacs@gnu.org; Thu, 28 Feb 2019 13:05:09 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41967) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gzQ3K-0004T6-I7 for bug-gnu-emacs@gnu.org; Thu, 28 Feb 2019 13:05:06 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gzQ3K-0002IQ-A1 for bug-gnu-emacs@gnu.org; Thu, 28 Feb 2019 13:05: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: Thu, 28 Feb 2019 18:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34686 X-GNU-PR-Package: emacs Original-Received: via spool by 34686-submit@debbugs.gnu.org id=B34686.15513770518761 (code B ref 34686); Thu, 28 Feb 2019 18:05:02 +0000 Original-Received: (at 34686) by debbugs.gnu.org; 28 Feb 2019 18:04:11 +0000 Original-Received: from localhost ([127.0.0.1]:55511 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gzQ2U-0002HE-MM for submit@debbugs.gnu.org; Thu, 28 Feb 2019 13:04:10 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:57445) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gzQ2T-0002H2-QM for 34686@debbugs.gnu.org; Thu, 28 Feb 2019 13:04:10 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:43868) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gzQ2K-00042E-N0; Thu, 28 Feb 2019 13:04:03 -0500 Original-Received: from [176.228.60.248] (port=1107 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1gzQ2B-0003d2-LC; Thu, 28 Feb 2019 13:03:58 -0500 In-reply-to: <11240364.O9o76ZdvQC@gabor> (message from Braun =?UTF-8?Q?G=C3=A1bor?= on Sat, 23 Feb 2019 22:16:45 +0100) 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:155903 Archived-At: > From: Braun Gábor > Date: Sat, 23 Feb 2019 22:16:45 +0100 > > Create in the current directory the following two files: > > ------------------------- test.el ------------------------------------- > (with-temp-buffer > (load-file "./test-unload.el") > (add-hook 'test-hook #'test-function nil t) > (unload-feature 'test-unload) > (run-hooks 'test-hook)) > ----------------------------------------------------------------------- > > ------------------------- test-unload.el ------------------------------ > (defun test-function () "Test function, does nothing." nil) > (provide 'test-unload) > ----------------------------------------------------------------------- > > Start Emacs via > > emacs -Q --eval '(setq debug-on-error t)' -l test.el > > Expectation: Emacs starts up with no error. > (`unload-feature' should remove `test-function' from `test-hook' as > documented, so `(run-hooks 'test-hook)' should be a no-op.) Where do you see it documented that the hook should be removed? All I see is this: Standard unloading activities include restoring old autoloads for functions defined by the library, undoing any additions that the library has made to hook variables or to ‘auto-mode-alist’[...] This says that hooks are removed if they were added by the library being unloaded. But in your example, the hook was not added by test-unload.el, it was added by test.el, a different library.