[ < ] | [ > ] | [ << ] | [Plus haut] | [ >> ] | [Top] | [Table des matières] | [Index] | [ ? ] |
The advice feature lets you add to the existing definition of a function, by advising the function. This is a cleaner method for a library to customize functions defined within 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, you should define a new function (or a new command) which uses the existing function.
Usage note: Advising a function can cause confusion in debugging, since people who debug calls to the original function may not notice that it has been modified with advice. Therefore, if you have the possibility to change the code of that function (or ask someone to do so) to run a hook, please solve the problem that way. Advice should be reserved for the cases where you cannot get the function changed.
In particular, this means that a file in Emacs should not put advice on a function in Emacs. There are currently a few exceptions to this convention, but we aim to correct them.
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 Advising Primitives | Accessing arguments when advising a primitive. | |
17.10 The Combined Definition | How advice is implemented. |
[ < ] | [ > ] | [ << ] | [Plus haut] | [ >> ] | [Top] | [Table des matières] | [Index] | [ ? ] |
Ce document a été généré par Eric Reinbold le 13 Octobre 2007 en utilisant texi2html 1.78.