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

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

[elpa] externals/ivy-hydra 9b36d9c 186/395: swiper.el (swiper-isearch):


From: Basil L. Contovounesios
Subject: [elpa] externals/ivy-hydra 9b36d9c 186/395: swiper.el (swiper-isearch): Use ivy-init-fns-alist
Date: Thu, 25 Feb 2021 08:31:59 -0500 (EST)

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

    swiper.el (swiper-isearch): Use ivy-init-fns-alist
---
 swiper.el | 40 ++++++++++++++++++++++------------------
 1 file changed, 22 insertions(+), 18 deletions(-)

diff --git a/swiper.el b/swiper.el
index 4b60264..5cf5f3e 100644
--- a/swiper.el
+++ b/swiper.el
@@ -1659,33 +1659,36 @@ When not running `swiper-isearch' already, start it."
         (cl-incf i))
       (nreverse res))))
 
+(defun swiper--isearch-init ()
+  "Initialize `swiper-isearch'."
+  (swiper--init)
+  (setq swiper--isearch-start-point (point))
+  (swiper-font-lock-ensure))
+
 ;;;###autoload
 (defun swiper-isearch (&optional initial-input)
   "A `swiper' that's not line-based."
   (interactive)
-  (swiper--init)
-  (setq swiper--isearch-start-point (point))
-  (swiper-font-lock-ensure)
   (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))
+        (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)
@@ -1695,6 +1698,7 @@ When not running `swiper-isearch' already, start it."
 
 (ivy-configure 'swiper-isearch
   :occur #'swiper-occur
+  :init-fn #'swiper--isearch-init
   :update-fn 'auto
   :unwind-fn #'swiper--cleanup
   :format-fn #'swiper-isearch-format-function)



reply via email to

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