From 1b1fad0d106390d907a805c9e8c81dd9831b5e1e Mon Sep 17 00:00:00 2001 From: Augusto Stoffel Date: Fri, 12 Feb 2021 19:37:14 +0100 Subject: [PATCH 2/2] Make `isearch-del-char' backtrack the search more aggressively This allows to always find the first occurrence of the search string after the last `isearch-repeat' or the start of search. * lisp/isearch.el (isearch-del-char): Call `isearch-fallback' before updating the search. --- lisp/isearch.el | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lisp/isearch.el b/lisp/isearch.el index aae4aeb261..b9c4cd2a65 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -2475,13 +2475,9 @@ isearch-del-char isearch-string ""))) ;; Do the following before moving point. (funcall (or isearch-message-function #'isearch-message) nil t) - ;; Use the isearch-other-end as new starting point to be able - ;; to find the remaining part of the search string again. - ;; This is like what `isearch-search-and-update' does, - ;; but currently it doesn't support deletion of characters - ;; for the case where unsuccessful search may become successful - ;; by deletion of characters. - (if isearch-other-end (goto-char isearch-other-end)) + ;; Use `isearch-fallback' to be able to find an earlier occurrence + ;; of the remaining part of the search string. + (isearch-fallback nil nil t) (isearch-search) (isearch-push-state) (isearch-update)) -- 2.29.2