[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: Stefan Monnier
Subject: Re: 1) (elisp) `Advising Named Functions', 2) search filtering example
Date: Mon, 17 Oct 2016 13:47:29 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

> #[128 <some-byte-code> [apply (lambda (b e) (save-excursion
> (goto-char e) (eolp))) isearch-filter-visible ((name . "eol")
> (isearch-message-prefix . "eol, "))] 4 nil]
> Dunno what you want to call such a thing.

A function object (a closure).  More specifically a function which is
the composition of two or more functions.  You could get a similar
function without using add-function, but using instead something like

    (setq isearch-filter-predicate
          (let ((old isearch-filter-predicate))
            (lambda (&rest args)
              (and (apply <f> args)
                   (apply old args)))))

> To me, the new advice doc is not as helpful as it should be,
> and the thingies dealt with are not clear or clearly presented.

To me, they're not as obscure as they should be: in my world, functions
are black boxes (you only get to know their type).

If you do

   (setq isearch-filter-predicate (symbol-function isearch-filter-predicate))

you end up with a variable that behaves pretty much exactly as before,
but if you look at the value of `isearch-filter-predicate` it will
suddenly look like some gobbledygook as well.  The fact that sometimes
you get a symbol is just an accident.

> If you cannot or will not, I'm still hoping that someone else will
> improve the doc and make things clearer, for all.

I have no idea how to improve the doc, so feel free to try and do it.
In the past I've had some luck with a "generate&test" approach, where
someone writes a tentative doc, and I point out the factual errors in it,
repeating the process until the doc is both understandable and correct.


reply via email to

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