[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

17.6 Enabling and Disabling Advice

Each piece of advice has a flag that says whether it is enabled or not. By enabling or disabling a piece of advice, you can turn it on and off without having to undefine and redefine it. For example, here is how to disable a particular piece of advice named my-advice for the function foo:

 
(ad-disable-advice 'foo 'before 'my-advice)

This function by itself only changes the enable flag for a piece of advice. To make the change take effect in the advised definition, you must activate the advice for foo again:

 
(ad-activate 'foo)

Command: ad-disable-advice function class name
This command disables the piece of advice named name in class class on function.

Command: ad-enable-advice function class name
This command enables the piece of advice named name in class class on function.

You can also disable many pieces of advice at once, for various functions, using a regular expression. As always, the changes take real effect only when you next reactivate advice for the functions in question.

Command: ad-disable-regexp regexp
This command disables all pieces of advice whose names match regexp, in all classes, on all functions.

Command: ad-enable-regexp regexp
This command enables all pieces of advice whose names match regexp, in all classes, on all functions.



This document was generated on May 2, 2002 using texi2html