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: Drew Adams
Subject: RE: 1) (elisp) `Advising Named Functions', 2) search filtering example
Date: Mon, 17 Oct 2016 07:02:42 -0700 (PDT)

> `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".

`advice-add' is essentially `add-function' for a _named_
function.  It does not apply to lambda forms etc.  It is
a wrapper around `add-function' that also deals with the
symbol itself (e.g. adding doc, handling macro symbols,...).

But you raise a reasonable point about that doc.  AFAICT,
nearly everything that is said in that node about potential
problems and reserving advice for when you cannot modify a 
function's behavior any other way applies just as well to
`add-function' etc. as to `advice-add' etc.

AFAICS, that info and advice is about advising functions.
It is not just about advising named functions, and even if
it were, it should apply equally to `add-function' for a
named function.

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 ")))

(The local value of `isearch-filter-predicate' can of
course be a named function.  But it need not be.)

> `isearch-filter-predicate' is not a function, it's a
> variable containing a function value.

Yes, I know that.  (And its value is not necessarily a
symbol.)



reply via email to

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