branch: externals/ivy-hydra
commit 7b1af7931b1a652fd69cbabb58ba1f4c31fdc910
Author: Andrew Whatson <[email protected]>
Commit: Oleh Krehel <[email protected]>
counsel.el (counsel--projectile-root): Add
Adds projectile support to `counsel-compile-root-functions', so
projectile will be used to determine the project root if it's loaded.
Fixes #2291
---
counsel.el | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/counsel.el b/counsel.el
index a11bc37..afec27b 100644
--- a/counsel.el
+++ b/counsel.el
@@ -5729,7 +5729,8 @@ This variable is suitable for addition to
`savehist-additional-variables'.")
(defvar counsel-compile-root-functions
- '(counsel--project-current
+ '(counsel--projectile-root
+ counsel--project-current
counsel--configure-root
counsel--git-root
counsel--dir-locals-root)
@@ -5744,6 +5745,12 @@ The root is determined by
`counsel-compile-root-functions'."
(or (run-hook-with-args-until-success 'counsel-compile-root-functions)
(error "Couldn't find project root")))
+(defun counsel--projectile-root ()
+ "Return root of current projectile project or nil on failure.
+Use `projectile-project-root' to determine the root."
+ (and (fboundp 'projectile-project-root)
+ (projectile-project-root)))
+
(defun counsel--project-current ()
"Return root of current project or nil on failure.
Use `project-current' to determine the root."