branch: master
commit 47f642762d8930613cc54f7a207e9f883a7fac9c
Author: Alex Bennée <[email protected]>
Commit: Alex Bennée <[email protected]>
counsel.el (counsel-compile): favour project root over default-directory
The counsel-compile--current-build-dir variable is set if we ever
descend into a build directory. However sometimes the user might want
to build in the top level, for example QEMU's docker build targets are
independent of configured builds. In this case default-directory is a
poor choice if you are calling from a file somewhere deep in the
source tree, especially as we have a function to find the root.
---
counsel.el | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/counsel.el b/counsel.el
index 06db8e9..b046d1b 100644
--- a/counsel.el
+++ b/counsel.el
@@ -5762,7 +5762,9 @@ specified by the `blddir' property."
(defun counsel-compile (&optional dir)
"Call `compile' completing with smart suggestions, optionally for DIR."
(interactive)
- (setq counsel-compile--current-build-dir (or dir default-directory))
+ (setq counsel-compile--current-build-dir (or dir
+ (counsel--compile-root)
+ default-directory))
(ivy-read "Compile command: "
(delete-dups (counsel--get-compile-candidates dir))
:action #'counsel-compile--action