* About advices.
@ 2013-11-27 8:19 Constantin Kulikov
2013-11-27 20:52 ` Stefan Monnier
0 siblings, 1 reply; 3+ messages in thread
From: Constantin Kulikov @ 2013-11-27 8:19 UTC (permalink / raw)
To: help-gnu-emacs
What the right way to use advices? (I know that best way it to not use it
at all.;))
At my current level of understanding:
1) You declare advices with `defadvice'. (acces arguments of original
function by `ad-get-arg').
Example:
(defadvice switch-to-buffer (after my-switch-to-buffer-advice)
(let ((buf (ad-get-arg 0)))
do something))
2) Then you call `ad-activate'.
Example: (ad-activate 'switch-to-buffer)
The problem here is that it will activate all advices for that function
that were defined before this `ad-activate' call, not only
`my-switch-to-buffer-advice'
3) I'm not sure. You can enable/disable certain advices with
`ad-enable-advice'/`ad-disable-advice'. Example:
(ad-disable-advice 'switch-to-buffer 'after 'my-switch-to-buffer-advice)
4) `ad-deactivate' will disable all advices for function.
Example: (ad-deactivate 'switch-to-buffer)
Am I right?
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-11-28 17:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-27 8:19 About advices Constantin Kulikov
2013-11-27 20:52 ` Stefan Monnier
2013-11-28 17:23 ` Constantin Kulikov
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.