unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: 34150@debbugs.gnu.org
Subject: bug#34150: 26.1; Document filtering with `isearch-filter-predicate' in Elisp manual
Date: Sun, 20 Jan 2019 16:17:41 -0800 (PST)	[thread overview]
Message-ID: <8c207ca2-39ae-4ec1-acbd-358165964319@default> (raw)

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





             reply	other threads:[~2019-01-21  0:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-21  0:17 Drew Adams [this message]
2019-01-21 16:21 ` bug#34150: 26.1; Document filtering with `isearch-filter-predicate' in Elisp manual 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

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=8c207ca2-39ae-4ec1-acbd-358165964319@default \
    --to=drew.adams@oracle.com \
    --cc=34150@debbugs.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).