[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

17. 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.

17.1 A Simple Advice Example  A simple example to explain the basics of advice.
17.2 Defining Advice  Detailed description of defadvice.
17.3 Around-Advice  Wrapping advice around a function's definition.
17.4 Computed Advice  ...is to defadvice as fset is to defun.
17.5 Activation of Advice  Advice doesn't do anything until you activate it.
17.6 Enabling and Disabling Advice  You can enable or disable each piece of advice.
17.7 Preactivation  Preactivation is a way of speeding up the loading of compiled advice.
17.8 Argument Access in Advice  How advice can access the function's arguments.
17.9 Definition of Subr Argument Lists  Accessing arguments when advising a primitive.
17.10 The Combined Definition  How advice is implemented.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on May 2, 2002 using texi2html