Subject: bug#21440: 25.0.50; Manual: FEATURE-unload-hook in (info "(elisp) Coding Conventions")

From: Michael Heerdegen <[email-masked]>
Date: Sat, 17 Jul 2021 03:35:09 +0200

Michael Heerdegen <[email-masked]> writes:

> > Hm...  does unload-feature remove advices?  Let's see..
> >
> > Well, there's this:
> >
> > (defun loadhist--unload-function (x)
> > [...]
> >
> > Hm...  but is that what it does?
>
> I don't think so.  AFAIU this does not even effect nadvice advices,
> and treats only advises of functions defined by the feature.

Here is a simple test file:

#+begin_src emacs-lisp
;;; foo.el --- ...  -*- lexical-binding: t -*-

(defun my-foo--around-ad (f &rest args)
  17
  (apply f args))

(advice-add 'make-frame-command :around #'my-foo--around-ad)

(provide 'foo)
;;; foo.el ends here
#+end_src

Load it, then M-x unload-feature foo RET -- and after that, C-x 5 2
errors.

Michael.