[Top][All Lists]

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

[elpa] master 6f0f32f 084/399: counsel.el (counsel-git-grep-count-functi

From: Oleh Krehel
Subject: [elpa] master 6f0f32f 084/399: counsel.el (counsel-git-grep-count-function): Promote to defcustom
Date: Sat, 20 Jul 2019 14:56:54 -0400 (EDT)

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

    counsel.el (counsel-git-grep-count-function): Promote to defcustom
    * counsel.el (counsel--git-grep-count-func):
    (counsel--git-grep-count-func-default): Add obsolete aliases.
    Re #1402
 counsel.el | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/counsel.el b/counsel.el
index 450bab2..bae9b2b 100644
--- a/counsel.el
+++ b/counsel.el
@@ -1409,7 +1409,7 @@ COMMAND fails.  Obey file handlers based on 
              (signal (car status) (cdr status))))
       (delete-file stderr))))
-(defun counsel--git-grep-count-func-default ()
+(defun counsel-git-grep-count-function-du ()
   "Default function to calculate `counsel--git-grep-count'."
   (or (unless (eq system-type 'windows-nt)
@@ -1417,8 +1417,20 @@ COMMAND fails.  Obey file handlers based on 
             (read (counsel--call "du" "-s" git-dir)))))
-(defvar counsel--git-grep-count-func #'counsel--git-grep-count-func-default
-  "Defun to calculate `counsel--git-grep-count' for `counsel-git-grep'.")
+(defcustom counsel-git-grep-count-function #'counsel-git-grep-count-function-du
+  "Defun to calculate `counsel--git-grep-count' for `counsel-git-grep'."
+  :type '(choice
+          (const :tag "Grep always does filtering."
+           (lambda () most-positive-fixnum))
+          (const :tag "Emacs always does filtering."
+           (lambda () 0))
+          (const :tag "Decide on Grep or Emacs based on .git directory size."
+           'counsel-git-grep-count-function-du)))
+(define-obsolete-variable-alias 'counsel--git-grep-count-func
+    'counsel-git-grep-count-function "0.11.0")
+(define-obsolete-function-alias 'counsel--git-grep-count-func-default
+    'counsel-git-grep-count-function-du "0.11.0")
 (defun counsel-git-grep (&optional cmd initial-input)
@@ -1446,7 +1458,7 @@ INITIAL-INPUT can be given as the initial minibuffer 
           (default-directory (if proj
                                  (car proj)
-      (setq counsel--git-grep-count (funcall counsel--git-grep-count-func))
+      (setq counsel--git-grep-count (funcall counsel-git-grep-count-function))
       (ivy-read "git grep: " collection-function
                 :initial-input initial-input
                 :matcher #'counsel-git-grep-matcher

reply via email to

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