Adviced functions - ECB - the Emacs Code Browser
Description: ECB - the Emacs Code Browser

Next: The layout-engine, Previous: tree-buffer, Up: Elisp programming

### 11.4 How to deal with the adviced functions

ECB needs a bunch of advices so ECB can work correctly. ECB has a powerful advice-backbone which allows defining sets of adviced functions whereas a set means, that all advices of a certain set are always enabled or disabled together.

For this ECB contains four macros:

- `defecb-advice-set`
- `defecb-advice`
- `ecb-with-original-adviced-function-set`
- `ecb-with-ecb-advice` (for this one see below)

For a detailed explanation of each macro read the documentation with `describe-function`!

An advice in ECB must not being defined by `defadvice` but only with `defecb-advice` which in turn needs a previously defined advice-set defined by `defecb-advice-set`.

So ECB has always full control of all advices. For example ECB automatically disables all advices of all advice-sets at load-time of ECB and also at deactivation time of ECB. So you can be sure that after deactivating ECB all ecb-advices are deactivated/disabled too.

In addition to the four macros above ECB offers two further macros for running code with disabled some ecb-advices:

- `ecb-with-original-basic-functions`
- `ecb-with-original-permanent-layout-functions`

The advice set `ecb-basic-adviced-functions` contains most of the ecb-advices. See the contents of this variable to see which advices are contained in this set. Use `ecb-with-original-basic-functions` when you want evaluating elisp-code with disabled basic-advices. `ecb-with-original-basic-functions` is only a shortcut for `ecb-with-original-adviced-function-set` called for the `ecb-basic-adviced-functions`-set.

Same for `ecb-with-original-permanent-layout-functions` which is a shortcut for the advice-set `ecb-permanent-adviced-layout-functions`.

Last but not least ECB contains an advice-set `ecb-always-disabled-advices`. These advices are always disabled. This advice-set can not be enabled by `ecb-enable-advices` but such an advice has to be activated 'on demand' by the caller. Such an advice must be used with the macro `ecb-with-ecb-advice` (see the docstring) and is also enabled within the BODY of the macro-call.

ECB contains some more advice-sets but don't bother about it.

Please Note: See the value of `ecb-adviced-function-sets` which advice-sets are defined and see `ecb-adviced-functions` for an overview for all adviced functions.