[Top][All Lists]

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

[elpa] master ce51607 6/7: Allow to cancel "M-q" with "C-g"

From: Oleh Krehel
Subject: [elpa] master ce51607 6/7: Allow to cancel "M-q" with "C-g"
Date: Thu, 26 Mar 2015 11:30:32 +0000

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

    Allow to cancel "M-q" with "C-g"
    swiper.el (swiper-query-replace): If the TO argument to
    `perform-replace' isn't read, don't exit minibuffer.
    If the user called `swiper-query-replace' and isn't happy with the
    current input being the FROM arg of `perform-replace', it's possible to
    cancel with "C-g", and edit the input once again.
 swiper.el |   19 +++++++++----------
 1 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/swiper.el b/swiper.el
index a57004f..cb8e91b 100644
--- a/swiper.el
+++ b/swiper.el
@@ -83,16 +83,15 @@
   (if (null (window-minibuffer-p))
       (user-error "Should only be called in the minibuffer through 
-    (delete-minibuffer-contents)
-    (setq ivy--action
-          (lambda ()
-            (let ((from (ivy--regex ivy-text)))
-              (perform-replace
-               from
-               (query-replace-read-to from "Query replace" t)
-               t t t))))
-    (swiper--cleanup)
-    (exit-minibuffer)))
+    (let* ((from (ivy--regex ivy-text))
+           (to (query-replace-read-to from "Query replace" t)))
+      (delete-minibuffer-contents)
+      (setq ivy--action
+            (lambda ()
+              (perform-replace from to
+                               t t t)))
+      (swiper--cleanup)
+      (exit-minibuffer))))
 (defvar swiper--window nil
   "Store the current window.")

reply via email to

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