Subject: RE: bug#1352: 23.0.60; isearch-success-function

From: "Drew Adams" <[email-masked]>
Date: Sun, 16 Nov 2008 16:45:34 -0800

Thanks, Juri. Looks better, to me anyway.

Some details you might want to consider -

1. This doc string:

> ! (defun isearch-filter-invisible (beg end)
> !   "Default predicate to filter out invisible text.
> ! It filters search hits to those that are visible (at least 
> partially),
> ! unless invisible text too can be searched."
>     (or (eq search-invisible t)
>         (not (isearch-range-invisible beg end))))

That explains how the predicate is used, not what it, itself, does.
I'd propose something like this:

 Tests whether the current search hit is visible to Isearch.
 Returns non-nil if `search-invisible' is t or the text from BEG to END
 is visible to Isearch as determined by `isearch-range-invisible'.

2. The predicate name.

A filter can be used either way: to allow to pass or to keep out.  The
Isearch filter allows whatever passes the predicate and disallows
whatever does not pass it.

Regardless of how a predicate might be used, its doc string and name
should reflect the quality for which the predicate is true: `bluep' is
true if its arg is blue, regardless of whether the predicate is used
to filter blueness out or in.

It is the quality of being isearch-visible that is tested here; the
predicate returns true when the search hit is visible to Isearch.  A
name that reflects that is `isearch-visible-p'.

Or, if we add the prefix `isearch-' systematically,
`isearch-isearch-visible-p'.  Or `isearch-visible-to-isearch-p'.
(This is bound to be somewhat confusing whatever name we use for it,
because of the notion of normally invisible text being visible to
Isearch.)

I'd probably go with just `isearch-visible-p'.

3. Similarly, I'd suggest `dired-isearch-filename-p' instead of
`dired-isearch-filter-filenames'.  Again, the predicate name should
reflect what the predicate does, not how it might be used.  In this
case, it returns true for a search hit that is a file name.  And the
doc string:

 Tests whether the current search hit is a file name.
 Returns non-nil if the text from BEG to END is part of a visible file
 name.

4. Likewise, something like `Info-isearch-visible-body-text-p' instead
of `Info-isearch-filter-predicate'.  Name it after the kind of search
hits that pass the test: body text (not header or tag-table text) that
is visible.  And the doc string:

 Tests whether the current search hit is a visible body text.
 Returns non-nil if the text from BEG to END is visible and is not in
 a header line or a tag table.