branch: master commit d92d43a2abc87fba084b3af3b40911f61258e121 Author: Basil L. Contovounesios <conto...@tcd.ie> Commit: Oleh Krehel <ohwoeo...@gmail.com>
counsel.el (counsel-compile-root-functions): Tidy Revert introduction of partially applied functions[1] in the definition of a variable, as they are inefficient, illegible in the *Help* buffer, and undocumented. [1]: counsel.el (counsel-compile-root-functions): Change priority 2019-03-14 11:25:04 +0100 https://github.com/abo-abo/swiper/commit/86c904fd85b4a615d485058bc442c6b4f4e42786 Fixes #1968 --- counsel.el | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/counsel.el b/counsel.el index bae9b2b..27eeb1e 100644 --- a/counsel.el +++ b/counsel.el @@ -5133,10 +5133,10 @@ This variable is suitable for addition to `savehist-additional-variables'.") (defvar counsel-compile-root-functions - (list 'counsel--project-current - (apply-partially #'counsel--dominating-file "configure") - 'counsel--git-root - (apply-partially #'counsel--dominating-file dir-locals-file)) + '(counsel--project-current + counsel--configure-root + counsel--git-root + counsel--dir-locals-root) "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 @@ -5154,11 +5154,21 @@ Use `project-current' to determine the root." (and (fboundp 'project-current) (cdr (project-current)))) +(defun counsel--configure-root () + "Return root of current project or nil on failure. +Use the presence of a \"configure\" file to determine the root." + (counsel--dominating-file "configure")) + (defun counsel--git-root () "Return root of current project or nil on failure. Use the presence of a \".git\" file to determine the root." (counsel--dominating-file ".git")) +(defun counsel--dir-locals-root () + "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)) + (defvar counsel-compile-local-builds '(counsel-compile-get-filtered-history counsel-compile-get-build-directories