branch: elpa/helm
commit ae013e721f56debb8fea1e509130439986dd26e7
Author: Ta Quang Trung <taquangtrun...@gmail.com>
Commit: Ta Quang Trung <taquangtrun...@gmail.com>

    helm-grep: run ag from the current project root
---
 helm-grep.el | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/helm-grep.el b/helm-grep.el
index 4c312465f9..7c569264cd 100644
--- a/helm-grep.el
+++ b/helm-grep.el
@@ -22,6 +22,7 @@
 (require 'helm)
 (require 'helm-help)
 (require 'helm-regexp)
+(require 'project)
 
 ;;; load wgrep proxy if it's available
 (require 'wgrep-helm nil t)
@@ -1848,6 +1849,19 @@ version."
   (require 'helm-files)
   (helm-grep-ag (expand-file-name default-directory) arg))
 
+;;;###autoload
+(defun helm-do-grep-ag-project (arg)
+  "Preconfigured `helm' for grepping with AG from the current project root.
+With prefix arg prompt for type if available with your AG version."
+  (interactive "P")
+  (require 'helm-files)
+  (require 'project)
+  (helm-aif (project-current)
+      (let* ((project-root (expand-file-name (car (last it))))
+             (default-directory project-root))
+        (helm-grep-ag project-root arg))
+    (message "Not in any project!")))
+
 ;;;###autoload
 (defun helm-grep-do-git-grep (arg)
   "Preconfigured `helm' for git-grepping `default-directory'.

Reply via email to