51 |
|
|
52 |
Suppose you wanted to add a similar feature to @code{previous-line}, |
Suppose you wanted to add a similar feature to @code{previous-line}, |
53 |
which would insert a new line at the beginning of the buffer for the |
which would insert a new line at the beginning of the buffer for the |
54 |
command to move to. How could you do this? |
command to move to (when @code{next-line-add-newlines} is |
55 |
|
non-@code{nil}). How could you do this? |
56 |
|
|
57 |
You could do it by redefining the whole function, but that is not |
You could do it by redefining the whole function, but that is not |
58 |
modular. The advice feature provides a cleaner alternative: you can |
modular. The advice feature provides a cleaner alternative: you can |
274 |
searches when the original definition of @code{foo} is run. |
searches when the original definition of @code{foo} is run. |
275 |
|
|
276 |
@defvar ad-do-it |
@defvar ad-do-it |
277 |
This is not really a variable, but it is somewhat used like one |
This is not really a variable, rather a place-holder that looks like a |
278 |
in around-advice. It specifies the place to run the function's |
variable. You use it in around-advice to specify the place to run the |
279 |
original definition and other ``earlier'' around-advice. |
function's original definition and other ``earlier'' around-advice. |
280 |
@end defvar |
@end defvar |
281 |
|
|
282 |
If the around-advice does not use @code{ad-do-it}, then it does not run |
If the around-advice does not use @code{ad-do-it}, then it does not run |
361 |
This command activates all the advice defined for @var{function}. |
This command activates all the advice defined for @var{function}. |
362 |
@end deffn |
@end deffn |
363 |
|
|
364 |
To activate advice for a function whose advice is already active is not |
Activating advice does nothing if @var{function}'s advice is already |
365 |
a no-op. It is a useful operation which puts into effect any changes in |
active. But if there is new advice, added since the previous time you |
366 |
that function's advice since the previous activation of advice for that |
activated advice for @var{function}, it activates the new advice. |
|
function. |
|
367 |
|
|
368 |
@deffn Command ad-deactivate function |
@deffn Command ad-deactivate function |
369 |
This command deactivates the advice for @var{function}. |
This command deactivates the advice for @var{function}. |
430 |
that results from activating advice for a function. |
that results from activating advice for a function. |
431 |
|
|
432 |
A value of @code{always} specifies to compile unconditionally. |
A value of @code{always} specifies to compile unconditionally. |
433 |
A value of @code{nil} specifies never compile the advice. |
A value of @code{never} specifies never compile the advice. |
434 |
|
|
435 |
A value of @code{maybe} specifies to compile if the byte-compiler is |
A value of @code{maybe} specifies to compile if the byte-compiler is |
436 |
already loaded. A value of @code{like-original} specifies to compile |
already loaded. A value of @code{like-original} specifies to compile |