unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#34150: 26.1; Document filtering with `isearch-filter-predicate' in Elisp manual
@ 2019-01-21  0:17 Drew Adams
  2019-01-21 16:21 ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Drew Adams @ 2019-01-21  0:17 UTC (permalink / raw)
  To: 34150

See https://emacs.stackexchange.com/q/47302/105, as one possible
motivaton.

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'.

And that doc string isn't very precise about the args of the predicate.
It says only: "The function has two arguments: the positions of start
and end of text matched by the search."

It would help to add that these positions are `(match-beginning 0)' and
`(match-end 0)', respectively, and to say that the match start position
is the first of the two args.  (Sure, start coming first is not
surprising, but it also doesn't follow from the description.)

I suggest adding a short topic about filtering with this predicate,
perhaps with a simple example.  At least mention that this is used in
the predefined search commands (including Isearch) and the predefined
replacement commands.

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.)  You could guess
no, based on the `isearch' part of the variable name.  But if you guess
like that then you likely won't also guess that the variable applies to
`perform-replace' - it's not just about Isearch.

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.  Not getting this can be a gotcha with greedy regexp matching.
For example, a filter predicate that excludes matches that extend past
column 70 does not keep the part of a match before column 70, even if
that part also matches the same regexp.

In GNU Emacs 26.1 (build 1, x86_64-w64-mingw32)
 of 2018-05-30
Repository revision: 07f8f9bc5a51f5aa94eb099f3e15fbe0c20ea1ea
Windowing system distributor `Microsoft Corp.', version 10.0.17134
Configured using:
 `configure --without-dbus --host=x86_64-w64-mingw32
 --without-compress-install 'CFLAGS=-O2 -static -g3''





^ permalink raw reply	[flat|nested] 7+ messages in thread
[parent not found: <<8c207ca2-39ae-4ec1-acbd-358165964319@default>]
[parent not found: <<<8c207ca2-39ae-4ec1-acbd-358165964319@default>]

end of thread, other threads:[~2019-01-21 23:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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