Subject: Re: bug#47599: 28.0.50; Feature request improve/update isearch

From: Gregory Heytings <[email-masked]>
Date: Tue, 06 Apr 2021 21:32:51 +0000

>>>> 1) Option or command to automatically go to the other end on exit.
>>> 
>>> It seems the conclusion was that it should not be an option. As for a 
>>> command, there were objections against binding it to a key, but 
>>> without a keybinding such command has little sense.
>> 
>> I attach a patch which implements these two "options" in isearch-exit.
>
> And of course my patch had an error ;-)
>

While we're improving isearch, there is another minor change that I think 
would improve its behavior, namely to go to the next/previous match when 
changing the search direction, instead of hitting the same match before 
moving to the next/previous one with the next C-s/C-r.  This change is so 
small that I'm not sure it's worth creating a defcustom for it, but you 
might have a different opinion.

From 63e74e7a06df1ebf05061328de7edb1b5f9f8200 Mon Sep 17 00:00:00 2001
From: Gregory Heytings <[email-masked]>
Date: Tue, 6 Apr 2021 21:24:47 +0000
Subject: [PATCH] Find another match when changing direction in isearch.

* lisp/isearch.el (isearch-repeat): Move point to the other end when
changing direction, to find another match.
---
 lisp/isearch.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/isearch.el b/lisp/isearch.el
index a828c569aa..7241b6b319 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -1847,6 +1847,7 @@ 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 isearch-other-end (goto-char isearch-other-end))
     (setq isearch-forward (not isearch-forward)
 	  isearch-success t))
 
-- 
2.30.2