[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 35a8861: Support Isearch filter predicates with empty search hits
From: |
Juri Linkov |
Subject: |
master 35a8861: Support Isearch filter predicates with empty search hits (bug#49534) |
Date: |
Tue, 13 Jul 2021 15:25:28 -0400 (EDT) |
branch: master
commit 35a8861619d4a5038ff37aa9fbeb995bc9b861a7
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>
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.
---
lisp/isearch.el | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/lisp/isearch.el b/lisp/isearch.el
index c8bd628..d1b9f2c 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -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)))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 35a8861: Support Isearch filter predicates with empty search hits (bug#49534),
Juri Linkov <=