1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-04-30 10:11:47 -07:00

Support Isearch filter predicates with empty search hits (bug#49534)

* lisp/isearch.el (isearch-search): Move (= (match-beginning 0) (match-end 0))
and (bobp)/(eobp) outside the call to isearch-filter-predicate.
Use forward-char 1/-1 on empty matches only when going to retry search.
(isearch-lazy-highlight-search):  Remove (= (point) bound),
but leave (= (match-beginning 0) (match-end 0)) since empty matches
make no sense in lazy-highlighting.
This commit is contained in:
Juri Linkov 2021-07-13 22:25:05 +03:00
parent b68e7a64ae
commit 35a8861619

View file

@ -3529,11 +3529,14 @@ Optional third argument, if t, means if fail just return nil (no error).
;; Clear RETRY unless the search predicate says
;; to skip this search hit.
(if (or (not isearch-success)
(bobp) (eobp)
(= (match-beginning 0) (match-end 0))
(funcall isearch-filter-predicate
(match-beginning 0) (match-end 0)))
(setq retry nil)))
(setq retry nil)
;; Advance point on empty matches before retrying
(when (= (match-beginning 0) (match-end 0))
(if (if isearch-forward (eobp) (bobp))
(setq retry nil isearch-success nil)
(forward-char (if isearch-forward 1 -1))))))
(setq isearch-just-started nil)
(when isearch-success
(setq isearch-other-end
@ -4044,7 +4047,6 @@ Attempt to do the search exactly the way the pending Isearch would."
;; Clear RETRY unless the search predicate says
;; to skip this search hit.
(if (or (not success)
(= (point) bound) ; like (bobp) (eobp) in `isearch-search'.
(= (match-beginning 0) (match-end 0))
(funcall isearch-filter-predicate
(match-beginning 0) (match-end 0)))