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

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

[elpa] externals/ivy-hydra d5225a1 187/395: swiper.el (swiper--isearch-u


From: Basil L. Contovounesios
Subject: [elpa] externals/ivy-hydra d5225a1 187/395: swiper.el (swiper--isearch-unwind): Extract
Date: Thu, 25 Feb 2021 08:31:59 -0500 (EST)

branch: externals/ivy-hydra
commit d5225a19ae88db570e1b01f604c4af392a800bf6
Author: Oleh Krehel <ohwoeowho@gmail.com>
Commit: Oleh Krehel <ohwoeowho@gmail.com>

    swiper.el (swiper--isearch-unwind): Extract
    
    Fixes #2378
---
 swiper.el | 48 +++++++++++++++++++++++-------------------------
 1 file changed, 23 insertions(+), 25 deletions(-)

diff --git a/swiper.el b/swiper.el
index 5cf5f3e..cdcfbbe 100644
--- a/swiper.el
+++ b/swiper.el
@@ -1665,42 +1665,40 @@ When not running `swiper-isearch' already, start it."
   (setq swiper--isearch-start-point (point))
   (swiper-font-lock-ensure))
 
+(defun swiper--isearch-unwind ()
+  (swiper--cleanup)
+  (unless (or (eq ivy-exit 'done) swiper-stay-on-quit)
+    (goto-char swiper--opoint))
+  (isearch-clean-overlays)
+  (swiper--ensure-visible)
+  (unless (or (eq ivy-exit 'done) (string= ivy-text ""))
+    (cl-pushnew ivy-text swiper-history)))
+
 ;;;###autoload
 (defun swiper-isearch (&optional initial-input)
   "A `swiper' that's not line-based."
   (interactive)
   (let ((ivy-fixed-height-minibuffer t)
         (cursor-in-non-selected-windows nil)
-        (swiper-min-highlight 1)
-        res)
-    (unwind-protect
-        (and
-         (setq res
-               (ivy-read
-                "Swiper: "
-                #'swiper-isearch-function
-                :initial-input initial-input
-                :keymap swiper-isearch-map
-                :dynamic-collection t
-                :require-match t
-                :action #'swiper-isearch-action
-                :re-builder #'swiper--re-builder
-                :history 'swiper-history
-                :extra-props (list :fname (buffer-file-name))
-                :caller 'swiper-isearch))
-         (point))
-      (unless (or res swiper-stay-on-quit)
-        (goto-char swiper--opoint))
-      (isearch-clean-overlays)
-      (swiper--ensure-visible)
-      (unless (or res (string= ivy-text ""))
-        (cl-pushnew ivy-text swiper-history)))))
+        (swiper-min-highlight 1))
+    (ivy-read
+     "Swiper: "
+     #'swiper-isearch-function
+     :initial-input initial-input
+     :keymap swiper-isearch-map
+     :dynamic-collection t
+     :require-match t
+     :action #'swiper-isearch-action
+     :re-builder #'swiper--re-builder
+     :history 'swiper-history
+     :extra-props (list :fname (buffer-file-name))
+     :caller 'swiper-isearch)))
 
 (ivy-configure 'swiper-isearch
   :occur #'swiper-occur
   :init-fn #'swiper--isearch-init
   :update-fn 'auto
-  :unwind-fn #'swiper--cleanup
+  :unwind-fn #'swiper--isearch-unwind
   :format-fn #'swiper-isearch-format-function)
 
 ;;;###autoload



reply via email to

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