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

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

[elpa] master b27ef9e 111/399: counsel.el (counsel-git-cands): Extract


From: Oleh Krehel
Subject: [elpa] master b27ef9e 111/399: counsel.el (counsel-git-cands): Extract
Date: Sat, 20 Jul 2019 14:57:00 -0400 (EDT)

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

    counsel.el (counsel-git-cands): Extract
    
    Re #1970
---
 counsel.el | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/counsel.el b/counsel.el
index 742f334..8ef3906 100644
--- a/counsel.el
+++ b/counsel.el
@@ -1190,21 +1190,23 @@ Like `locate-dominating-file', but DIR defaults to
   (or (counsel--git-root)
       (error "Not in a Git repository")))
 
+(defun counsel-git-cands ()
+  (let ((default-directory (counsel-locate-git-root)))
+    (split-string
+     (shell-command-to-string counsel-git-cmd)
+     "\n"
+     t)))
+
 ;;;###autoload
 (defun counsel-git (&optional initial-input)
   "Find file in the current Git repository.
 INITIAL-INPUT can be given as the initial minibuffer input."
   (interactive)
   (counsel-require-program counsel-git-cmd)
-  (let* ((default-directory (counsel-locate-git-root))
-         (cands (split-string
-                 (shell-command-to-string counsel-git-cmd)
-                 "\n"
-                 t)))
-    (ivy-read "Find file: " cands
-              :initial-input initial-input
-              :action #'counsel-git-action
-              :caller 'counsel-git)))
+  (ivy-read "Find file: " (counsel-git-cands)
+            :initial-input initial-input
+            :action #'counsel-git-action
+            :caller 'counsel-git))
 
 (defun counsel-git-action (x)
   "Find file X in current Git repository."



reply via email to

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