[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Around-advice lets you "wrap" a Lisp expression "around" the
original function definition. You specify where the original function
definition should go by means of the special symbol ad-do-it
.
Where this symbol occurs inside the around-advice body, it is replaced
with a progn
containing the forms of the surrounded code. Here
is an example:
(defadvice foo (around foo-around) "Ignore case in `foo'." (let ((case-fold-search t)) ad-do-it)) |
Its effect is to make sure that case is ignored in
searches when the original definition of foo
is run.
If the around-advice does not use ad-do-it
, then it does not run
the original function definition. This provides a way to override the
original definition completely. (It also overrides lower-positioned
pieces of around-advice).
If the around-advice uses ad-do-it
more than once, the original
definition is run at each place. In this way, around-advice can execute
the original definition (and lower-positioned pieces of around-advice)
several times. Another way to do that is by using ad-do-it
inside of a loop.