emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/el-search b936a28 062/332: Go to isearch left end when


From: Stefan Monnier
Subject: [elpa] externals/el-search b936a28 062/332: Go to isearch left end when starting replace
Date: Tue, 1 Dec 2020 15:48:12 -0500 (EST)

branch: externals/el-search
commit b936a28497ca85bed1aed43566cd91d7d36a8b10
Author: Michael Heerdegen <michael_heerdegen@web.de>
Commit: Michael Heerdegen <michael_heerdegen@web.de>

    Go to isearch left end when starting replace
    
    with el-search from isearch
    
    This partially reverts
    
    "When coming from isearch, don't move to other end".
---
 el-search.el | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/el-search.el b/el-search.el
index f6c8c48..2f69f5f 100644
--- a/el-search.el
+++ b/el-search.el
@@ -952,8 +952,13 @@ Hit any key to proceed."
   (barf-if-buffer-read-only)
   (el-search-search-and-replace-pattern from to mapping))
 
-(defun el-search--take-over-from-isearch ()
-  (prog1 isearch-string (isearch-exit)))
+(defun el-search--take-over-from-isearch (&optional goto-left-end)
+  (let ((other-end (and goto-left-end isearch-other-end))
+        (input isearch-string))
+    (isearch-exit)
+    (when (and other-end (< other-end (point)))
+      (goto-char other-end))
+    input))
 
 ;;;###autoload
 (defun el-search-search-from-isearch ()
@@ -968,7 +973,7 @@ Hit any key to proceed."
 ;;;###autoload
 (defun el-search-replace-from-isearch ()
   (interactive)
-  (let ((el-search--initial-mb-contents (concat "'" 
(el-search--take-over-from-isearch))))
+  (let ((el-search--initial-mb-contents (concat "'" 
(el-search--take-over-from-isearch t))))
     (call-interactively #'el-search-query-replace)))
 
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]