unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#49534: 26.3; Isearch should support using filter predicates with empty search hits
@ 2021-07-12 14:34 Drew Adams
  2021-07-13 16:27 ` Lars Ingebrigtsen
  2022-02-16  4:20 ` Drew Adams
  0 siblings, 2 replies; 20+ messages in thread
From: Drew Adams @ 2021-07-12 14:34 UTC (permalink / raw)
  To: 49534

Consider regep-searching for just $.  No problem; search goes to every
line end.

Now consider wanting to use a filter predicate that allows search hits
only for lines that are at least 80 chars long, e.g.:

 (defun line>79-p (beg end)
   "Return non-nil if END is past column 79."
   (save-excursion
     (goto-char end)
     (> (current-column) 79)))

 (defun foo ()
   (interactive)
   (let ((isearch-filter-predicate  #'line>79-p))
     (isearch-forward 4)))

That won't work.  Isearch is unnecessarily restrictive because of this
test in `isearch-search', which if non-nil prevents invoking
`isearch-filter-predicate'.

 (= (match-beginning 0) (match-end 0))

I've fixed this in my own code (isearch+.el).  But there are now many
differences between vanilla isearch.el and my code, so it's better if
you fix the vanilla code for this bug.

The fix should be pretty straightforward, but if you have trouble let me
know.  You can anyway see my fix here:

  https://www.emacswiki.org/emacs/download/isearch%2b.el


In GNU Emacs 26.3 (build 1, x86_64-w64-mingw32)
 of 2019-08-29
Repository revision: 96dd0196c28bc36779584e47fffcca433c9309cd
Windowing system distributor `Microsoft Corp.', version 10.0.19042
Configured using:
 `configure --without-dbus --host=x86_64-w64-mingw32
 --without-compress-install 'CFLAGS=-O2 -static -g3''






^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2022-02-16 19:25 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-12 14:34 bug#49534: 26.3; Isearch should support using filter predicates with empty search hits Drew Adams
2021-07-13 16:27 ` Lars Ingebrigtsen
2021-07-13 19:25   ` Juri Linkov
2021-07-13 20:20     ` Juri Linkov
2021-07-13 20:41       ` Lars Ingebrigtsen
2021-07-13 22:30         ` Juri Linkov
2021-07-13 21:42       ` bug#49534: [External] : " Drew Adams
2021-07-13 22:30         ` Juri Linkov
2021-07-13 23:00           ` Drew Adams
2021-07-13 22:48       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-07-13 23:21         ` Juri Linkov
2021-07-13 21:44     ` bug#49534: [External] : " Drew Adams
2021-07-13 22:31       ` Juri Linkov
2021-07-13 23:04         ` Drew Adams
2022-02-16  4:20 ` Drew Adams
2022-02-16 18:20   ` Juri Linkov
2022-02-16 18:54     ` bug#49534: [External] : " Drew Adams
2022-02-16 19:09       ` Juri Linkov
2022-02-16 19:17         ` Drew Adams
2022-02-16 19:25           ` Juri Linkov

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