Clarify when to use advice-add vs add-function

* lisp/emacs-lisp/nadvice.el (add-function): Note in docstring that
advice-add should be used for named functions.
This commit is contained in:
Noam Postavsky 2018-05-22 20:08:01 -04:00
parent c0f3e6b56b
commit e3f00f5637

View file

@ -288,6 +288,9 @@ a special meaning:
If PLACE is a symbol, its `default-value' will be affected. If PLACE is a symbol, its `default-value' will be affected.
Use (local \\='SYMBOL) if you want to apply FUNCTION to SYMBOL buffer-locally. Use (local \\='SYMBOL) if you want to apply FUNCTION to SYMBOL buffer-locally.
Use (var VAR) if you want to apply FUNCTION to the (lexical) VAR. Use (var VAR) if you want to apply FUNCTION to the (lexical) VAR.
If you are trying to modify an existing named function rather
than a function value, you probably want to use `advice-add'
instead (see Info node `(elisp) Advising Named Functions').
If one of FUNCTION or OLDFUN is interactive, then the resulting function If one of FUNCTION or OLDFUN is interactive, then the resulting function
is also interactive. There are 3 cases: is also interactive. There are 3 cases: