[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: 1) (elisp) `Advising Named Functions', 2) search filtering example

From: Drew Adams
Subject: RE: 1) (elisp) `Advising Named Functions', 2) search filtering example
Date: Mon, 17 Oct 2016 08:40:32 -0700 (PDT)

> > Do you think that that information does not apply also
> > to this code, from dired-aux.el?  If so, why?
> >
> > (add-function :before-while (local 'isearch-filter-predicate)
> >               #'dired-isearch-filter-filenames
> >               '((isearch-message-prefix . "filename ")))
> I think it falls under this case in `(elisp) Hooks' (which should be
> updated to mention `-predicate' as a possible suffix)
>        If the variable’s name ends in ‘-function’, then its value is just
>     a single function, not a list of functions.  ‘add-hook’ cannot be used
>     to modify such a _single function hook_, and you have to use
>     ‘add-function’ instead (*note Advising Functions::).

I think that is wrong also.  `add-hook' _can_ be used to modify a _single
function hook_.  And the doc of `add-hook' tells you so, in its last line -
`C-h f add-hook':

  If HOOK's value is a single function, it is changed to a list of

Again, I do question whether we should now be advising against using
hooks and in favor of the new advice.  But I guess I'm OK with that,
if it's really the decision.  As I mentioned, I already took the
latter approach in my Isearch filtering feature.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]