Computed Advice
===============
The macro `defadvice' resembles `defun' in that the code for the
advice, and all other information about it, are explicitly stated in
the source code. You can also create advice whose details are computed,
using the function `ad-add-advice'.
- Function: ad-add-advice function advice class position
Calling `ad-add-advice' adds ADVICE as a piece of advice to
FUNCTION in class CLASS. The argument ADVICE has this form:
(NAME PROTECTED ENABLED DEFINITION)
Here PROTECTED and ENABLED are flags, and DEFINITION is the
expression that says what the advice should do. If ENABLED is
`nil', this piece of advice is initially disabled (Note:Enabling
Advice).
If FUNCTION already has one or more pieces of advice in the
specified CLASS, then POSITION specifies where in the list to put
the new piece of advice. The value of POSITION can either be
`first', `last', or a number (counting from 0 at the beginning of
the list). Numbers outside the range are mapped to the beginning
or the end of the range, whichever is closer. The POSITION value
is ignored when redefining an existing piece of advice.
If FUNCTION already has a piece of ADVICE with the same name, then
the position argument is ignored and the old advice is replaced
with the new one.