GNU bug report logs - #34686
26.1; unload-feature doesn't remove functions locally from hooks

Previous Next

Package: emacs;

Reported by: Braun Gábor <braungb88 <at> gmail.com>

Date: Thu, 28 Feb 2019 16:21:02 UTC

Severity: minor

Merged with 5293

Found in version 26.1

Done: Štěpán Němec <stepnem <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 34686 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Braun Gábor <braungb88 <at> gmail.com>
Cc: 34686 <at> debbugs.gnu.org
Subject: Re: bug#34686: 26.1;
 unload-feature doesn't remove functions locally from hooks
Date: Thu, 28 Feb 2019 20:03:27 +0200
> From: Braun Gábor <braungb88 <at> gmail.com>
> 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.




This bug report was last modified 4 years and 213 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.