emacs-devel
[Top][All Lists]
Advanced

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

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


From: Noam Postavsky
Subject: Re: 1) (elisp) `Advising Named Functions', 2) search filtering example
Date: Mon, 17 Oct 2016 10:37:41 -0400

On Mon, Oct 17, 2016 at 10:02 AM, Drew Adams <address@hidden> wrote:
>> `advice-add' puts advice on a function, `add-function'
>> does not.
>
> I don't think so.  AFAICS, `add-function' certainly does
> "put advice on a function".

You're right. I did have the impression that add-function was
considered to be okay, just like add-hook is. But the manual doesn't
say this (and also, I didn't realize that (add-function
...(symbol-function 'FUN)...) has almost the same effect as
advice-add). So I was wrong to look at add-function vs advice-add; the
important distinction is between the thing being added to, not the
function used to do the adding.

>
> 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::).



reply via email to

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