From: Kevin Ryde <user42@zip.com.au>
To: bug-gnu-emacs@gnu.org
Subject: bug#5301: 23.1; unload-feature remove defadvice
Date: Mon, 04 Jan 2010 10:27:54 +1100 [thread overview]
Message-ID: <877hry7oqt.fsf@blah.blah> (raw)
As an idea, it'd be good if defadvice were among the `def' things
automatically unloaded by `unload-feature'.
A defadvice will nearly always use functions or whatever in the defining
package and if they've been unloaded it could leave the advised target
function badly broken.
I know it's possible for a foo-unload-function to undo its defadvices.
I've done that for some of my things, but it gets very repetitive and
makes me think defadvice could set that up itself.
I know advice is a slightly second class citizen, but if the necessary
unloading stuff were confined to advice.el then it needn't be a burden
if no advise is in use.
My best idea so far would be for defadvice to record something in
load-history like
(defadvice . (TARGET CLASS AD-NAME))
if it could beg a tie-in to unload-feature at a good spot. Something
indirect like a property setting on the `defadvice' symbol appearing in
the load-history might let other `def' macros jig up unloading for
themselves in a general way.
;; untested!
(put 'defadvice 'load-history-unload-feature-function
(lambda (elem)
(when (apply 'ad-find-advice (cdr elem))
(apply 'ad-remove-advice (cdr elem))
(ad-activate (cadr elem)))))
May have to think about what happens if the package defining the `def'
macro is unloaded when things it has `def'fed still exist. But if
`require's express dependencies correctly that might never arise.
In GNU Emacs 23.1.1 (i486-pc-linux-gnu, GTK+ Version 2.16.5)
of 2009-09-14 on raven, modified by Debian
configured using `configure '--build=i486-linux-gnu' '--host=i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.1/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.1/leim' '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS=''
reply other threads:[~2010-01-03 23:27 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877hry7oqt.fsf@blah.blah \
--to=user42@zip.com.au \
--cc=5301@debbugs.gnu.org \
--cc=bug-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.