Mercurial > emacs
changeset 99046:7257b84b68a2
(Computed Advice): Explain what DEFINITION is.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Wed, 22 Oct 2008 19:53:33 +0000 |
parents | 5abca568a07b |
children | 1dcf806b4a8d |
files | doc/lispref/advice.texi |
diffstat | 1 files changed, 23 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/lispref/advice.texi Wed Oct 22 19:53:19 2008 +0000 +++ b/doc/lispref/advice.texi Wed Oct 22 19:53:33 2008 +0000 @@ -314,26 +314,36 @@ @defun ad-add-advice function advice class position Calling @code{ad-add-advice} adds @var{advice} as a piece of advice to -@var{function} in class @var{class}. The argument @var{advice} has +@var{function} in class @var{class}. The argument @var{advice} has this form: @example (@var{name} @var{protected} @var{enabled} @var{definition}) @end example -Here @var{protected} and @var{enabled} are flags, and @var{definition} -is the expression that says what the advice should do. If @var{enabled} -is @code{nil}, this piece of advice is initially disabled -(@pxref{Enabling Advice}). +@noindent +Here, @var{protected} and @var{enabled} are flags; if @var{protected} +is non-@code{nil}, the advice is protected against non-local exits +(@pxref{Defining Advice}), and if @var{enabled} is @code{nil} the +advice is initially disabled (@pxref{Enabling Advice}). +@var{definition} should have the form + +@example +(advice . @var{LAMBDA}) +@end example -If @var{function} already has one or more pieces of advice in the -specified @var{class}, then @var{position} specifies where in the list -to put the new piece of advice. The value of @var{position} can either -be @code{first}, @code{last}, or a number (counting from 0 at the -beginning of the list). Numbers outside the range are mapped to the -beginning or the end of the range, whichever is closer. The -@var{position} value is ignored when redefining an existing piece of -advice. +@noindent +where @var{LAMBDA} is a lambda expression that is evaluated to run the +advice. @xref{Lambda Expressions}. + +If the @var{function} argument to @code{ad-add-advice} already has one +or more pieces of advice in the specified @var{class}, then +@var{position} specifies where in the list to put the new piece of +advice. The value of @var{position} can either be @code{first}, +@code{last}, or a number (counting from 0 at the beginning of the +list). Numbers outside the range are mapped to the beginning or the +end of the range, whichever is closer. The @var{position} value is +ignored when redefining an existing piece of advice. If @var{function} already has a piece of @var{advice} with the same name, then the position argument is ignored and the old advice is