diff options
| author | Richard M. Stallman | 2003-06-24 18:14:01 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2003-06-24 18:14:01 +0000 |
| commit | 7a010076e305bfccf3e65d95c4d33eef8ba114e3 (patch) | |
| tree | 858b2e7886b9bc185c369faab8327fead307d596 | |
| parent | bcea31c2b6326d6a194a2bf457b2f4f0992779b7 (diff) | |
| download | emacs-7a010076e305bfccf3e65d95c4d33eef8ba114e3.tar.gz emacs-7a010076e305bfccf3e65d95c4d33eef8ba114e3.zip | |
(Advising Primitives): Renamed from Subr Arguments.
Explain that advising primitives doesn't affect calls from C code.
| -rw-r--r-- | lispref/advice.texi | 29 |
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. |
| 657 | Instead they are implemented specially by the advice mechanism. | 657 | Instead 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. |
| 663 | to know the argument list of the original function. This is not always | 663 | Some primitive functions are used by the advice mechanism; advising |
| 664 | possible for primitive functions. When advice cannot determine the | 664 | them could cause an infinite recursion. Also, many primitive |
| 665 | argument list, it uses @code{(&rest ad-subr-args)}, which always works | 665 | functions are called directly from C code. Calls to the primitive |
| 666 | but is inefficient because it constructs a list of the argument values. | 666 | from Lisp code will take note of the advice, but calls from C code |
| 667 | You can use @code{ad-define-subr-args} to declare the proper argument | 667 | will ignore the advice. |
| 668 | names for a primitive function: | 668 | |
| 669 | When the advice facility constructs the combined definition, it needs | ||
| 670 | to know the argument list of the original function. This is not | ||
| 671 | always possible for primitive functions. When advice cannot determine | ||
| 672 | the argument list, it uses @code{(&rest ad-subr-args)}, which always | ||
| 673 | works but is inefficient because it constructs a list of the argument | ||
| 674 | values. You can use @code{ad-define-subr-args} to declare the proper | ||
| 675 | argument names for a primitive function: | ||
| 669 | 676 | ||
| 670 | @defun ad-define-subr-args function arglist | 677 | @defun ad-define-subr-args function arglist |
| 671 | This function specifies that @var{arglist} should be used as the | 678 | This function specifies that @var{arglist} should be used as the |