* bug#5301: 23.1; unload-feature remove defadvice
@ 2010-01-03 23:27 Kevin Ryde
0 siblings, 0 replies; only message in thread
From: Kevin Ryde @ 2010-01-03 23:27 UTC (permalink / raw
To: bug-gnu-emacs
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=''
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-01-03 23:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-03 23:27 bug#5301: 23.1; unload-feature remove defadvice Kevin Ryde
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.