bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#49534: 26.3; Isearch should support using filter predicates with emp


From: Drew Adams
Subject: bug#49534: 26.3; Isearch should support using filter predicates with empty search hits
Date: Mon, 12 Jul 2021 14:34:29 +0000

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






reply via email to

[Prev in Thread] Current Thread [Next in Thread]