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

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

[elpa] master c24b6de 217/272: swiper.el (swiper-query-replace): Improve


From: Oleh Krehel
Subject: [elpa] master c24b6de 217/272: swiper.el (swiper-query-replace): Improve "M-n"
Date: Mon, 25 Apr 2016 10:13:26 +0000

branch: master
commit c24b6de1a2ce9e04b9b917b6ef8cbc9c09e09be7
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    swiper.el (swiper-query-replace): Improve "M-n"
    
    To replace a symbol with a similar symbol,
    
    1. Press "C-s" "M-n" for `swiper' and select the symbol at point as input.
    2. Press "M-q" for `swiper-query-replace'
    3. Press "M-n" to yank the symbol to replace.
    
    Here step-3 was modified to yank e.g. "symbol" instead of "\_<symbo\_>"
    previously.
---
 swiper.el |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/swiper.el b/swiper.el
index 6eb433f..b6b4c84 100644
--- a/swiper.el
+++ b/swiper.el
@@ -94,7 +94,13 @@
       (user-error "Should only be called in the minibuffer through 
`swiper-map'")
     (let* ((enable-recursive-minibuffers t)
            (from (ivy--regex ivy-text))
-           (to (query-replace-read-to from "Query replace" t)))
+           (to (minibuffer-with-setup-hook
+                   (lambda ()
+                     (setq minibuffer-default
+                           (if (string-match "\\`\\\\_<\\(.*\\)\\\\_>\\'" 
ivy-text)
+                               (match-string 1 ivy-text)
+                             ivy-text)))
+                 (read-from-minibuffer (format "Query replace %s with: " 
from)))))
       (swiper--cleanup)
       (ivy-exit-with-action
        (lambda (_)



reply via email to

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