branch: externals/ivy-hydra
commit 9b36d9c13bb837bcafeaac78017f2fde26bf7124
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
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)