From: Drew Adams <drew.adams@oracle.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 34150-done@debbugs.gnu.org
Subject: bug#34150: 26.1; Document filtering with `isearch-filter-predicate' in Elisp manual
Date: Mon, 21 Jan 2019 10:18:23 -0800 (PST) [thread overview]
Message-ID: <8c88ff94-e322-4754-b74a-c792512ec277@default> (raw)
In-Reply-To: <83o98a9e2l.fsf@gnu.org>
> > The only doc I can find about making Isearch and `perform-replace'
> (all
> > of its uses) ignore/exclude certain matches is the doc string of
> > variable `isearch-filter-predicate'.
>
> I don't see why the doc string shouldn't be enough. This is a quite
> obscure feature, so I don't think it warrants to be described in the
> manual.
I disagree that it is obscure - or that it should be,
at least. But of course if it is not well documented
and it is (still) hardly ever used by Emacs itself
then it will not necessarily be noticed, understood,
and used. Its current obscurity is a self-fulfilling
prophecy.
> > It would also be good to state whether predefined search functions
> > such as `re-search-forward' respect it. (I imagine that they do
> > not, but I haven't checked, and there's no doc about this AFAIK.)
>
> I modified the doc string to mention Isearch and replace commands.
Thanks. And non-command functions such as `re-search-forward'?
> > One thing that it would also be good to make extra clear is that
> > filtering takes place _after_ input matching; it is not part of
> > matching.
>
> How can it be part of matching, if the filter needs to be passed the
> limits of the matched text?
No one contests that impossibility.
But it and its consequences are not necessarily
obvious - especially to a user searching, as opposed
to a programmer writing a filter predicate.
Isearch's handling of filter limits is very different
from its handling of buffer limits, for example. A
filter doesn't constrain search to be inside its
limits, in the sense that the search matches take no
account of such limits. This is not necessarily
obvious to a _user_. (It might or might not be clear
to some programmer who defines the filter.)
You can easily notice this as a user if you try to
regexp-search when a filter excludes text outside a
rectangle or a set of columns, for instance.
A user could easily, and incorrectly, expect the
rectangle to "contain" search, similarly to how a
buffer restriction contains it. She could ask herself
how it is that a regexp with `.*' doesn't "match" some
particular text within the rectangle, the answer being
that it instead matched longer text that extended
outside the rectangle, and that match was filtered out.
If this user-level description makes no sense to you
I expect it's because you haven't played with filters
enough or, more likely, because you start from an
understanding of the code - which a user does not.
Just emphasizing explicitly that filtering takes
place _after_ input matching can help, I think. As
you know, filtering can in general be done before or
during querying/searching/matching, as well as after
it. IMO, it's worth emphasizing that this is only
post-match filtering.
If you ask why a _user_ needs to know about filter
predicates and filtering then my answer is longer.
I'll leave that out, unless you ask for it.
Using `isearch-filter-predicate' can be powerful.
But it is also somewhat limited/weak because
filtering cannot be taken into account as part of
matching.
Imagine being able to contain search within a
rectangle, for instance. That's something you
cannot do with only `isearch-filter-predicate'.
Whether or not such limitation is obvious to a
particular filter writer, it certainly is not
obvious to a filter user, I think.
next prev parent reply other threads:[~2019-01-21 18:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-21 0:17 bug#34150: 26.1; Document filtering with `isearch-filter-predicate' in Elisp manual Drew Adams
2019-01-21 16:21 ` Eli Zaretskii
2019-01-21 18:18 ` Drew Adams [this message]
2019-01-21 18:27 ` Eli Zaretskii
[not found] <<8c207ca2-39ae-4ec1-acbd-358165964319@default>
[not found] ` <<83o98a9e2l.fsf@gnu.org>
[not found] ` <<8c88ff94-e322-4754-b74a-c792512ec277@default>
[not found] ` <<83h8e1amsu.fsf@gnu.org>
2019-01-21 18:40 ` Drew Adams
2019-01-21 19:05 ` Eli Zaretskii
[not found] <<<8c207ca2-39ae-4ec1-acbd-358165964319@default>
[not found] ` <<<83o98a9e2l.fsf@gnu.org>
[not found] ` <<<8c88ff94-e322-4754-b74a-c792512ec277@default>
[not found] ` <<<83h8e1amsu.fsf@gnu.org>
[not found] ` <<208f2037-8fa0-4475-a9cf-b2417613af5c@default>
[not found] ` <<83ef95al1s.fsf@gnu.org>
2019-01-21 23:10 ` Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8c88ff94-e322-4754-b74a-c792512ec277@default \
--to=drew.adams@oracle.com \
--cc=34150-done@debbugs.gnu.org \
--cc=eliz@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).