From: Juri Linkov Date: Tue, 29 Apr 2025 16:35:30 +0000 (+0300) Subject: Respect point when changing direction after isearch scrolling. X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=0cfc06d09571eb93e02d43fe12828de7e9eb2021;p=emacs.git Respect point when changing direction after isearch scrolling. * lisp/isearch.el (isearch-repeat): Don't go to isearch-other-end on changing direction after scrolling (bug#78074). (cherry picked from commit 622825995204b7aae70b836c8e5e5d44385c401b) --- diff --git a/lisp/isearch.el b/lisp/isearch.el index aaa3df75a9e..19d13057eff 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -1910,7 +1910,14 @@ Use `isearch-exit' to quit without signaling." (funcall isearch-wrap-function) (goto-char (if isearch-forward (point-min) (point-max)))))) ;; C-s in reverse or C-r in forward, change direction. - (if (and isearch-other-end isearch-repeat-on-direction-change) + (if (and isearch-other-end isearch-repeat-on-direction-change + (or (null isearch-cmds) + ;; Go to 'isearch-other-end' only when point is still + ;; on the current match. However, after scrolling + ;; (when 'isearch-allow-scroll' is 'unlimited'), + ;; repeat the reversed search from a new position + ;; where point was moved during scrolling (bug#78074). + (eq (isearch--state-point (car isearch-cmds)) (point)))) (goto-char isearch-other-end)) (setq isearch-forward (not isearch-forward) isearch-success t))