GNU Info

Info Node: (elisp)Advising Functions

(elisp)Advising Functions


Next: Debugging Prev: Byte Compilation Up: Top
Enter node , (file) or (file)node

Advising Emacs Lisp Functions
*****************************

   The "advice" feature lets you add to the existing definition of a
function, by "advising the function".  This is a clean method for a
library to customize functions defined by other parts of Emacs--cleaner
than redefining the whole function.

   Each function can have multiple "pieces of advice", separately
defined.  Each defined piece of advice can be "enabled" or disabled
explicitly.  All the enabled pieces of advice for any given function
actually take effect when you "activate" advice for that function, or
when you define or redefine the function.  Note that enabling a piece
of advice and activating advice for a function are not the same thing.

   *Usage Note:* Advice is useful for altering the behavior of existing
calls to an existing function.  If you want the new behavior for new
calls, or for key bindings, it is cleaner to define a new function (or
a new command) which uses the existing function.

Simple Advice
A simple example to explain the basics of advice.
Defining Advice
Detailed description of `defadvice'.
Around-Advice
Wrapping advice around a function's definition.
Computed Advice
is to `defadvice' as `fset' is to `defun'.
Activation of Advice
Advice doesn't do anything until you activate it.
Enabling Advice
You can enable or disable each piece of advice.
Preactivation
Preactivation is a way of speeding up the
loading of compiled advice.
Argument Access in Advice
How advice can access the function's arguments.
Subr Arguments
Accessing arguments when advising a primitive.
Combined Definition
How advice is implemented.

automatically generated by info2www version 1.2.2.9