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

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

[elpa] master 589e03f 144/184: ivy.el (ivy-configure): Use for ivy-index


From: Oleh Krehel
Subject: [elpa] master 589e03f 144/184: ivy.el (ivy-configure): Use for ivy-index-functions-alist
Date: Wed, 16 Oct 2019 13:15:10 -0400 (EDT)

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

    ivy.el (ivy-configure): Use for ivy-index-functions-alist
---
 counsel.el | 7 ++++---
 ivy.el     | 9 ++++-----
 swiper.el  | 6 ++++--
 3 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/counsel.el b/counsel.el
index 2286d9c..713166b 100644
--- a/counsel.el
+++ b/counsel.el
@@ -1520,7 +1520,8 @@ When CMD is non-nil, prompt for a specific \"git grep\" 
command."
 
 (ivy-configure 'counsel-git-grep
   :occur #'counsel-git-grep-occur
-  :unwind-fn #'counsel--grep-unwind)
+  :unwind-fn #'counsel--grep-unwind
+  :index-fn #'ivy-recompute-index-swiper-async)
 
 (cl-pushnew 'counsel-git-grep ivy-highlight-grep-commands)
 
@@ -3085,7 +3086,7 @@ When non-nil, INITIAL-INPUT is the initial search 
pattern."
         (init-point (point))
         res)
     (unwind-protect
-         (setq res (ivy-read "grep: " 'counsel-grep-function
+         (setq res (ivy-read "grep: " #'counsel-grep-function
                              :initial-input initial-input
                              :dynamic-collection t
                              :preselect
@@ -3096,7 +3097,6 @@ When non-nil, INITIAL-INPUT is the initial search 
pattern."
                                         (buffer-substring-no-properties
                                          (line-beginning-position)
                                          (line-end-position)))))
-
                              :keymap counsel-grep-map
                              :history 'counsel-grep-history
                              :re-builder #'ivy--regex
@@ -3108,6 +3108,7 @@ When non-nil, INITIAL-INPUT is the initial search 
pattern."
 (ivy-configure 'counsel-grep
   :update-fn 'auto
   :unwind-fn #'counsel--grep-unwind
+  :index-fn #'ivy-recompute-index-swiper-async
   :occur #'counsel-grep-occur
   :more-chars 2)
 
diff --git a/ivy.el b/ivy.el
index cc93077..c8ac5f1 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1829,11 +1829,7 @@ specified for the current collection in
       (ivy--reset-state ivy-last))))
 
 (defvar ivy-index-functions-alist
-  '((swiper . ivy-recompute-index-swiper)
-    (swiper-multi . ivy-recompute-index-swiper)
-    (counsel-git-grep . ivy-recompute-index-swiper)
-    (counsel-grep . ivy-recompute-index-swiper-async)
-    (t . ivy-recompute-index-zero))
+  '((t . ivy-recompute-index-zero))
   "An alist of index recomputing functions for each collection function.
 When the input changes, the appropriate function returns an
 integer - the index of the matched candidate that should be
@@ -1921,6 +1917,7 @@ May supersede `ivy-initial-inputs-alist'."
                            occur
                            update-fn
                            unwind-fn
+                           index-fn
                            more-chars)
   "Configure `ivy-read' params for CALLER."
   (declare (indent 1))
@@ -1932,6 +1929,8 @@ May supersede `ivy-initial-inputs-alist'."
     (ivy--alist-set 'ivy-update-fns-alist caller update-fn))
   (when unwind-fn
     (ivy--alist-set 'ivy-unwind-fns-alist caller unwind-fn))
+  (when index-fn
+    (ivy--alist-set 'ivy-index-functions-alist caller index-fn))
   (when more-chars
     (ivy--alist-set 'ivy-more-chars-alist caller more-chars)))
 
diff --git a/swiper.el b/swiper.el
index 6af5a25..289a0f7 100644
--- a/swiper.el
+++ b/swiper.el
@@ -809,7 +809,8 @@ When non-nil, INITIAL-INPUT is the initial search pattern."
 (ivy-configure 'swiper
   :occur #'swiper-occur
   :update-fn #'swiper--update-input-ivy
-  :unwind-fn #'swiper--cleanup)
+  :unwind-fn #'swiper--cleanup
+  :index-fn #'ivy-recompute-index-swiper)
 
 (defun swiper-toggle-face-matching ()
   "Toggle matching only the candidates with `swiper-invocation-face'."
@@ -1133,7 +1134,8 @@ Run `swiper' for those buffers."
               :caller 'swiper-multi)))
 
 (ivy-configure 'swiper-multi
-  :unwind-fn #'swiper--cleanup)
+  :unwind-fn #'swiper--cleanup
+  :index-fn #'ivy-recompute-index-swiper)
 
 (defun swiper-multi-action-1 (x)
   "Add X to list of selected buffers `swiper-multi-buffers'.



reply via email to

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