GNU bug report logs - #78074
isearch not respecting point when changing direction after scrolling

Previous Next

Package: emacs;

Reported by: Jake <jforst.mailman <at> gmail.com>

Date: Sat, 26 Apr 2025 16:29:02 UTC

Severity: normal

Fixed in version 31.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> linkov.net>
To: Jake <jforst.mailman <at> gmail.com>
Cc: 78074 <at> debbugs.gnu.org
Subject: bug#78074: isearch not respecting point when changing direction after scrolling
Date: Tue, 29 Apr 2025 09:46:07 +0300
>> I think this is a bug because it doesn't happen when
>> `isearch-repeat-on-direction-change' has its default value of nil.
>
> Thanks for the bug report.  Maybe we don't need these lines
> in 'isearch-repeat' after all:
>
>     (if (and isearch-other-end isearch-repeat-on-direction-change)
>         (goto-char isearch-other-end))
>
> Could you please try to remove these 2 lines and see whether this
> improves the behavior of changing the direction.

Actually, this still should be used when changing the direction
with point on the current match.  So here is the correct patch:

diff --git a/lisp/isearch.el b/lisp/isearch.el
index 52c5042133e..57df42e1128 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -1952,7 +1952,9 @@ isearch-repeat
 	      (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)
+                 (eq (isearch--state-point (car isearch-cmds)) (point))))
         (goto-char isearch-other-end))
     (setq isearch-forward (not isearch-forward)
 	  isearch-success t))




This bug report was last modified 23 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.