aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lispref/advice.texi33
1 files changed, 17 insertions, 16 deletions
diff --git a/lispref/advice.texi b/lispref/advice.texi
index ae22fecc1fb..2006474fc61 100644
--- a/lispref/advice.texi
+++ b/lispref/advice.texi
@@ -7,15 +7,15 @@
7@chapter Advising Emacs Lisp Functions 7@chapter Advising Emacs Lisp Functions
8@cindex advising functions 8@cindex advising functions
9 9
10 The @dfn{advice} feature lets you add to the existing definition of a 10 The @dfn{advice} feature lets you add to the existing definition of
11function, by @dfn{advising the function}. This is a clean method for a 11a function, by @dfn{advising the function}. This is a clean method
12library to customize functions defined by other parts of Emacs---cleaner 12for a library to customize functions defined within Emacs---cleaner
13than redefining the whole function. 13than redefining the whole function.
14 14
15@cindex piece of advice 15@cindex piece of advice
16 Each function can have multiple @dfn{pieces of advice}, separately 16 Each function can have multiple @dfn{pieces of advice}, separately
17defined. Each defined piece of advice can be @dfn{enabled} or 17defined. Each defined piece of advice can be @dfn{enabled} or
18disabled explicitly. All the enabled pieces of advice for any given 18@dfn{disabled} explicitly. All the enabled pieces of advice for any given
19function actually take effect when you @dfn{activate} advice for that 19function actually take effect when you @dfn{activate} advice for that
20function, or when you define or redefine the function. Note that 20function, or when you define or redefine the function. Note that
21enabling a piece of advice and activating advice for a function 21enabling a piece of advice and activating advice for a function
@@ -129,6 +129,9 @@ form) to be advised. From now on, we will write just ``function'' when
129describing the entity being advised, but this always includes macros and 129describing the entity being advised, but this always includes macros and
130special forms. 130special forms.
131 131
132 In place of the argument list in an ordinary definition, an advice
133definition calls for several different pieces of information.
134
132@cindex class of advice 135@cindex class of advice
133@cindex before-advice 136@cindex before-advice
134@cindex after-advice 137@cindex after-advice
@@ -154,9 +157,6 @@ the pieces of advice in a particular class for a particular
154@var{function}. The name allows you to refer to the piece of 157@var{function}. The name allows you to refer to the piece of
155advice---to redefine it, or to enable or disable it. 158advice---to redefine it, or to enable or disable it.
156 159
157In place of the argument list in an ordinary definition, an advice
158definition calls for several different pieces of information.
159
160The optional @var{position} specifies where, in the current list of 160The optional @var{position} specifies where, in the current list of
161advice of the specified @var{class}, this new advice should be placed. 161advice of the specified @var{class}, this new advice should be placed.
162It should be either @code{first}, @code{last} or a number that specifies 162It should be either @code{first}, @code{last} or a number that specifies
@@ -332,9 +332,9 @@ replaced with the new one.
332@cindex advice, activating 332@cindex advice, activating
333 333
334By default, advice does not take effect when you define it---only when 334By default, advice does not take effect when you define it---only when
335you @dfn{activate} advice for the function that was advised. However 335you @dfn{activate} advice for the function that was advised. However,
336the advice will be automatically activated if the function is defined 336the advice will be activated automatically if you define or redefine
337or redefined later. You can request the activation of advice for a 337the function later. You can request the activation of advice for a
338function when you define the advice, by specifying the @code{activate} 338function when you define the advice, by specifying the @code{activate}
339flag in the @code{defadvice}. But normally you activate the advice 339flag in the @code{defadvice}. But normally you activate the advice
340for a function by calling the function @code{ad-activate} or one of 340for a function by calling the function @code{ad-activate} or one of
@@ -353,9 +353,11 @@ are combined with the original definition to make a new definition.
353@ref{Enabling Advice}.) This definition is installed, and optionally 353@ref{Enabling Advice}.) This definition is installed, and optionally
354byte-compiled as well, depending on conditions described below. 354byte-compiled as well, depending on conditions described below.
355 355
356In all of the commands to activate advice, if @var{compile} is @code{t}, 356In all of the commands to activate advice, if @var{compile} is
357the command also compiles the combined definition which implements the 357@code{t} (or anything but @code{nil} or a negative number), the
358advice. 358command also compiles the combined definition which implements the
359advice. If it is @code{nil} or a negative number, what happens
360depends on @code{ad-default-compilation-action} as described below.
359 361
360@deffn Command ad-activate function &optional compile 362@deffn Command ad-activate function &optional compile
361This command activates all the advice defined for @var{function}. 363This command activates all the advice defined for @var{function}.
@@ -438,9 +440,8 @@ the advice if the original definition of the advised function is
438compiled or a built-in function. 440compiled or a built-in function.
439 441
440This variable takes effect only if the @var{compile} argument of 442This variable takes effect only if the @var{compile} argument of
441@code{ad-activate} (or any of the above functions) was supplied as 443@code{ad-activate} (or any of the above functions) did not force
442@code{nil}. If that argument is non-@code{nil}, that means 444compilation.
443to compile the advice regardless.
444@end defopt 445@end defopt
445 446
446 If the advised definition was constructed during ``preactivation'' 447 If the advised definition was constructed during ``preactivation''