aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lispref/advice.texi29
1 files changed, 18 insertions, 11 deletions
diff --git a/lispref/advice.texi b/lispref/advice.texi
index cb877efe310..e5946db433f 100644
--- a/lispref/advice.texi
+++ b/lispref/advice.texi
@@ -36,7 +36,7 @@ function (or a new command) which uses the existing function.
36* Preactivation:: Preactivation is a way of speeding up the 36* Preactivation:: Preactivation is a way of speeding up the
37 loading of compiled advice. 37 loading of compiled advice.
38* Argument Access in Advice:: How advice can access the function's arguments. 38* Argument Access in Advice:: How advice can access the function's arguments.
39* Subr Arguments:: Accessing arguments when advising a primitive. 39* Advising Primitives:: Accessing arguments when advising a primitive.
40* Combined Definition:: How advice is implemented. 40* Combined Definition:: How advice is implemented.
41@end menu 41@end menu
42 42
@@ -656,16 +656,23 @@ will be 3, and @var{r} will be @code{(2 1 0)} inside the body of
656 These argument constructs are not really implemented as Lisp macros. 656 These argument constructs are not really implemented as Lisp macros.
657Instead they are implemented specially by the advice mechanism. 657Instead they are implemented specially by the advice mechanism.
658 658
659@node Subr Arguments 659@node Advising Primitives
660@section Definition of Subr Argument Lists 660@section Advising Primitives
661 661
662 When the advice facility constructs the combined definition, it needs 662 Advising a primitive function (also called a ``subr'') is risky.
663to know the argument list of the original function. This is not always 663Some primitive functions are used by the advice mechanism; advising
664possible for primitive functions. When advice cannot determine the 664them could cause an infinite recursion. Also, many primitive
665argument list, it uses @code{(&rest ad-subr-args)}, which always works 665functions are called directly from C code. Calls to the primitive
666but is inefficient because it constructs a list of the argument values. 666from Lisp code will take note of the advice, but calls from C code
667You can use @code{ad-define-subr-args} to declare the proper argument 667will ignore the advice.
668names for a primitive function: 668
669When the advice facility constructs the combined definition, it needs
670to know the argument list of the original function. This is not
671always possible for primitive functions. When advice cannot determine
672the argument list, it uses @code{(&rest ad-subr-args)}, which always
673works but is inefficient because it constructs a list of the argument
674values. You can use @code{ad-define-subr-args} to declare the proper
675argument names for a primitive function:
669 676
670@defun ad-define-subr-args function arglist 677@defun ad-define-subr-args function arglist
671This function specifies that @var{arglist} should be used as the 678This function specifies that @var{arglist} should be used as the