[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Emacs-diffs] master 5811404: Replace eldoc-documentation-function w
From: |
Stefan Monnier |
Subject: |
Re: [Emacs-diffs] master 5811404: Replace eldoc-documentation-function with a hook |
Date: |
Sat, 09 Jul 2016 20:27:52 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) |
> […] advice should be reserved for the cases where you cannot modify
> a function’s behavior in any other way. If it is possible to do
> the same thing via a hook, that is preferable (see Hooks). […] In
> particular, Emacs’s own source files should not put advice on
> functions in Emacs. (There are currently a few exceptions to this
> convention, but we aim to correct them.)
A *-function variable is not an advice, but a hook.
It's a different kind of hook than those manipulated by add-hook (which
have names ending in -hook or -functions), but it's still a hook and
those have been used for many years in various parts of Emacs.
It just so happens that the operations that can manipulate those hooks
conveniently (add-function/remove-function) are provided in the same
file as the new advice-add, but that's only because it was convenient
and natural to implement advice-add on top of those new operations.
Stefan