On 11/07/2014 04:55 PM, Alan Mackenzie wrote: > Hello, Stefan. > > On Fri, Nov 07, 2014 at 09:59:12AM -0500, Stefan Monnier wrote: >>> The advantage of hooks is that it makes it easier for users to >>> customize the behavior by adding and removing various entries. > >> While it's true that > >> (add-hook 'next-error-functions #'my-function) > >> is shorter than > >> (add-function :before-until next-error-function #'my-function) > >> I don't think it warrants the addition of a next-error-functions. > > Why not? > >> If the :before-until is the problematic part, then I guess we should >> look for ways to improve that (e.g. a better name, or some way for >> a variable to say that :before-until is the default when adding >> functions to it?). > >>> Is add-function intended to replace hooks like this in general? > >> Somewhat, yes. I have no intention to go around and replace existing >> hooks in the forseeable future (except for those rare hooks that used >> with-wrapper-hook), but I'll favor new foo-function over new >> foo-functions. > > Why? I'm adding my voice to the clamour of dissent. > > It would seem that the use of single functions, with `add-function' is > inferior to the conventional hook mechanism in every way. What am I > missing? In addition to the things cited by Daniel, there's: > > (i) the danger (near certainty) that somebody is going to use `setq' > rather than `add-function' to configure it; The same critique applies to regular hooks, doesn't it? > (ii) the additional incompatibility with other Emacsen; I'm not sure that compatibility with other Emacsen is as important as it once was. AIUI, GNU Emacs is receiving the vast majority of development effort. > (iii) the difficulty (or perhaps clumsiness) in looking at the contents > of an advised function. There would seem to be nothing equivalent to > M-: after-change-functions. > > So why are you changing from the conventional hook mechanism, which works > so well? What is the advantage of the new scheme. > > Incidentally, I had a look at the documentation for add-advice, and > there's a problem with it. "Advice" in English has no plural - there's > no such word as "advices". If it's necessary to emphasize the plurality, > then "pieces of advice" can be used. There's no such thing as "an > advice", rather you'd say "some advice". It's a bit like you wouldn't > refer to a lake as "a big water"; you'd say it contains "a lot of water". > I think there's a term in linguistics for such a word, but I don't know > it off hand. I think "advise" works like "code" in the software sense and "furniture". The term is "mass noun". > Incidentally 2, the verb corresponding to the noun "advice" is "to > advise". Isn't English fun?