From e0619995594d1686afd0493391417d6f900d632c Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Wed, 14 Jul 2021 01:29:53 +0300 Subject: [PATCH] * lisp/isearch.el: Add save-match-data for funcall isearch-filter-predicate. * lisp/isearch.el (isearch-search): Add save-match-data before funcall isearch-filter-predicate. (isearch-lazy-highlight-search): Add save-match-data before funcall isearch-filter-predicate. (Bug#49534) --- lisp/isearch.el | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lisp/isearch.el b/lisp/isearch.el index d1b9f2c4397..4bc5956e50e 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -3529,8 +3529,9 @@ 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) - (funcall isearch-filter-predicate - (match-beginning 0) (match-end 0))) + (save-match-data + (funcall isearch-filter-predicate + (match-beginning 0) (match-end 0)))) (setq retry nil) ;; Advance point on empty matches before retrying (when (= (match-beginning 0) (match-end 0)) @@ -4048,8 +4049,9 @@ Attempt to do the search exactly the way the pending Isearch would." ;; to skip this search hit. (if (or (not success) (= (match-beginning 0) (match-end 0)) - (funcall isearch-filter-predicate - (match-beginning 0) (match-end 0))) + (save-match-data + (funcall isearch-filter-predicate + (match-beginning 0) (match-end 0)))) (setq retry nil))) success) (error nil))) -- 2.39.2