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

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

[elpa] master 10f9954 50/57: counsel.el (counsel-git-grep): Warn if not


From: Oleh Krehel
Subject: [elpa] master 10f9954 50/57: counsel.el (counsel-git-grep): Warn if not in a repository
Date: Tue, 19 May 2015 14:21:40 +0000

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

    counsel.el (counsel-git-grep): Warn if not in a repository
---
 counsel.el |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/counsel.el b/counsel.el
index 23c9f0a..ea5496e 100644
--- a/counsel.el
+++ b/counsel.el
@@ -237,15 +237,17 @@
   (interactive)
   (setq counsel--git-grep-dir
         (locate-dominating-file default-directory ".git"))
-  (setq counsel--git-grep-count (counsel-git-grep-count ""))
-  (ivy-read "pattern: " 'counsel-git-grep-function
-            :initial-input initial-input
-            :matcher #'counsel-git-grep-matcher
-            :dynamic-collection (when (> counsel--git-grep-count 20000)
-                                  'counsel-git-grep-function)
-            :keymap counsel-git-grep-map
-            :action #'counsel-git-grep-action
-            :unwind #'swiper--cleanup))
+  (if (null counsel--git-grep-dir)
+      (error "Not in a git repository")
+    (setq counsel--git-grep-count (counsel-git-grep-count ""))
+    (ivy-read "pattern: " 'counsel-git-grep-function
+              :initial-input initial-input
+              :matcher #'counsel-git-grep-matcher
+              :dynamic-collection (when (> counsel--git-grep-count 20000)
+                                    'counsel-git-grep-function)
+              :keymap counsel-git-grep-map
+              :action #'counsel-git-grep-action
+              :unwind #'swiper--cleanup)))
 
 (defun counsel-git-grep-matcher (x)
   (when (string-match "^[^:]+:[^:]+:" x)



reply via email to

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