branch: master commit 86c904fd85b4a615d485058bc442c6b4f4e42786 Author: Oleh Krehel <ohwoeo...@gmail.com> Commit: Oleh Krehel <ohwoeo...@gmail.com>
counsel.el (counsel-compile-root-functions): Change priority * counsel.el (counsel--project-current): Rename. (counsel--root-dir-locals): Remove. Avoid functions that are just `apply-partially' if they are used only in one place. Re #1966 --- counsel.el | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/counsel.el b/counsel.el index 039ff92..d6d388f 100644 --- a/counsel.el +++ b/counsel.el @@ -5120,9 +5120,10 @@ This variable is suitable for addition to `savehist-additional-variables'.") (defvar counsel-compile-root-functions - '(counsel--root-project - counsel--root-dir-locals - counsel--git-root) + (list #'counsel--project-current + (apply-partially #'counsel--dominating-file "configure") + #'counsel--git-root + (apply-partially #'counsel--dominating-file dir-locals-file)) "Special hook to find the project root for compile commands. Each function on this hook is called in turn with no arguments and should return either a directory, or nil if no root was @@ -5134,17 +5135,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--root-project () +(defun counsel--project-current () "Return root of current project or nil on failure. Use `project-current' to determine the root." (and (fboundp 'project-current) (cdr (project-current)))) -(defun counsel--root-dir-locals () - "Return root of current project or nil on failure. -Use the presence of a `dir-locals-file' to determine the root." - (counsel--dominating-file dir-locals-file)) - (defun counsel--git-root () "Return root of current project or nil on failure. Use the presence of a \".git\" file to determine the root."