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

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

[elpa] master 4ce0ed8: [el-search] Make y move forward after replacing


From: Michael Heerdegen
Subject: [elpa] master 4ce0ed8: [el-search] Make y move forward after replacing
Date: Sun, 11 Nov 2018 04:55:51 -0500 (EST)

branch: master
commit 4ce0ed8bba7ee23ef5da8cd6b691c0f5c7503e38
Author: Michael Heerdegen <address@hidden>
Commit: Michael Heerdegen <address@hidden>

    [el-search] Make y move forward after replacing
    
    Make y in 'el-search-query-replace' instead of n move to the next
    match after replacing a match with r.  This feels more logical when
    thinking about y and n as abbreviating "yes" and "no".
    Also do some related minor rewording.
    
    * packages/el-search/el-search.el
    (el-search--search-and-replace-pattern): Make y the key to confirm a
    replacement and go to the next match after replacing the current match
    with r.
---
 packages/el-search/el-search.el | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/packages/el-search/el-search.el b/packages/el-search/el-search.el
index 2c7246a..d598a2b 100644
--- a/packages/el-search/el-search.el
+++ b/packages/el-search/el-search.el
@@ -298,9 +298,9 @@
 ;;    `(foo ,b ,a . ,rest) RET
 ;;
 ;; Type y to replace a match and go to the next one, r to replace
-;; without moving, SPC or n to go to the next match and ! to replace
-;; all remaining matches automatically.  q quits.  And ? shows a quick
-;; help summarizing all of these keys.
+;; without moving, n to go to the next match without replacing and !
+;; to replace all remaining matches automatically.  q quits.  ? shows
+;; a quick help summarizing all of these keys.
 ;;
 ;; It is possible to replace a match with an arbitrary number of
 ;; expressions using "splicing mode".  When it is active, the
@@ -3711,13 +3711,14 @@ exactly you did?  Thanks!"))))
                                              (+ nbr-done nbr-to-do)))
                                    (delq nil
                                          (list
+                                          `(?y "y"
+                                               ,(if replaced-this
+                                                    "Keep replacement and move 
to the next match"
+                                                  "Replace match and move to 
the next"))
                                           (and (not replaced-this)
-                                               '(?y "y" "Replace this match 
and move to the next"))
-                                          (list ?n
-                                                (if replaced-this "next" "n")
-                                                "Go to the next match")
+                                               '(?n "n" "Move to the next 
match"))
                                           (and (not replaced-this)
-                                               '(?r "r" "Replace this match 
but don't move"))
+                                               '(?r "r" "Replace match but 
don't move"))
                                           '(?! "all" "Replace all remaining 
matches in this buffer")
                                           '(?b "skip buf"
                                                "Skip this buffer and any 
remaining matches in it")
@@ -3737,10 +3738,11 @@ Toggle splicing mode (\\[describe-function] 
el-search-query-replace for details)
                            (while (not (pcase (funcall query)
                                          (?r (funcall do-replace)
                                              nil)
-                                         (?y (funcall do-replace)
-                                             t)
+                                         (?y
+                                          (unless replaced-this (funcall 
do-replace))
+                                          t)
                                          (?n
-                                          (unless replaced-this (cl-incf 
nbr-skipped))
+                                          (cl-incf nbr-skipped)
                                           t)
                                          (?!
                                           (when (and use-current-search



reply via email to

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