[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 5f4e944 057/399: counsel.el: Fix finding dominating file
From: |
Oleh Krehel |
Subject: |
[elpa] master 5f4e944 057/399: counsel.el: Fix finding dominating file |
Date: |
Sat, 20 Jul 2019 14:56:48 -0400 (EDT) |
branch: master
commit 5f4e9444eeb254f1511e071cca819d1ad52c103a
Author: Basil L. Contovounesios <address@hidden>
Commit: Basil L. Contovounesios <address@hidden>
counsel.el: Fix finding dominating file
(counsel--dominating-file): Rename from...
(counsel--find-project-root): ...this; change all callers.
Fix error when locate-dominating-file returns nil.
(counsel-git): Remove redundant file name expansion.
---
counsel.el | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/counsel.el b/counsel.el
index 36c2f54..cd98456 100644
--- a/counsel.el
+++ b/counsel.el
@@ -1172,18 +1172,16 @@ selected face."
'(("j" find-file-other-window "other window")
("x" counsel-find-file-extern "open externally")))
-;; Common helper for counsel
-(defun counsel--find-project-root (domfile &optional startdir)
- "Traverse up from `default-directory' or STARTDIR until we find DOMFILE.
-Return a fully expanded path."
- (expand-file-name
- (locate-dominating-file
- (or startdir default-directory)
- domfile)))
+(defun counsel--dominating-file (file &optional dir)
+ "Look up directory hierarchy for FILE, starting in DIR.
+Like `locate-dominating-file', but DIR defaults to
+`default-directory' and the return value is expanded."
+ (and (setq dir (locate-dominating-file (or dir default-directory) file))
+ (expand-file-name dir)))
(defun counsel-locate-git-root ()
"Locate the root of the git repository containing the current buffer."
- (or (counsel--find-project-root ".git")
+ (or (counsel--dominating-file ".git")
(error "Not in a git repository")))
;;;###autoload
@@ -1192,7 +1190,7 @@ Return a fully expanded path."
INITIAL-INPUT can be given as the initial minibuffer input."
(interactive)
(counsel-require-program counsel-git-cmd)
- (let* ((default-directory (expand-file-name (counsel-locate-git-root)))
+ (let* ((default-directory (counsel-locate-git-root))
(cands (split-string
(shell-command-to-string counsel-git-cmd)
"\n"
@@ -5128,8 +5126,8 @@ to variable to `savehist-additional-variables'.")
"Locate the root of the project by trying a series of things."
(or (when (fboundp 'project-current)
(cdr (project-current)))
- (counsel--find-project-root ".dir-locals.el")
- (counsel--find-project-root ".git")
+ (counsel--dominating-file ".dir-locals.el")
+ (counsel--dominating-file ".git")
(error "Couldn't find project root")))
(defvar counsel-compile-local-builds
- [elpa] master e88c7d6 044/399: counsel.el (counsel-locate-cmd): Simplify, (continued)
- [elpa] master e88c7d6 044/399: counsel.el (counsel-locate-cmd): Simplify, Oleh Krehel, 2019/07/20
- [elpa] master 51c5874 042/399: counsel.el (counsel-find-file-map): Bind "`" to bookmarks, Oleh Krehel, 2019/07/20
- [elpa] master 3de074a 049/399: counsel.el (counsel-find-file-copy): Add and bind., Oleh Krehel, 2019/07/20
- [elpa] master a538df1 053/399: ivy.el (ivy-make-magic-action): Point doc to the action function, Oleh Krehel, 2019/07/20
- [elpa] master 84b5ece 050/399: counsel.el (counsel-find-file-copy): Use ivy-inhibit-action, Oleh Krehel, 2019/07/20
- [elpa] master 9e3c855 052/399: ivy.el (ivy-make-magic-action): Fix bug, Oleh Krehel, 2019/07/20
- [elpa] master 9cf3f08 045/399: swiper.el (swiper-use-visual-line-p): New variable, Oleh Krehel, 2019/07/20
- [elpa] master 15e2c88 051/399: Restore buffer-list after counsel-switch-buffers, Oleh Krehel, 2019/07/20
- [elpa] master 80d40e4 046/399: Dynamically handle grep tool look-arounds, Oleh Krehel, 2019/07/20
- [elpa] master 0a4ad42 047/399: ivy-test.el (counsel--grep-regex): Add test for negative lookahead, Oleh Krehel, 2019/07/20
- [elpa] master 5f4e944 057/399: counsel.el: Fix finding dominating file,
Oleh Krehel <=
- [elpa] master 3c16fa1 055/399: counsel.el (counsel-compile): Clean up, Oleh Krehel, 2019/07/20
- [elpa] master 876b4ac 059/399: counsel.el (counsel-compile): Minor cleanup, Oleh Krehel, 2019/07/20
- [elpa] master 56201b1 056/399: counsel.el: Remove cl-extra, Oleh Krehel, 2019/07/20
- [elpa] master 859e3cb 061/399: counsel.el: Clean up compile history keeping, Oleh Krehel, 2019/07/20
- [elpa] master 072f238 058/399: counsel.el: Capitalize proper noun "Git", Oleh Krehel, 2019/07/20
- [elpa] master 5f5a263 054/399: counsel.el (counsel-compile): Add, Oleh Krehel, 2019/07/20
- [elpa] master adea72f 060/399: counsel.el: Simplify counsel-compile action, Oleh Krehel, 2019/07/20
- [elpa] master 50dc9e6 065/399: counsel.el (counsel--get-build-subdirs): Fix, Oleh Krehel, 2019/07/20
- [elpa] master 4e0d403 066/399: counsel.el (counsel--find-build-subdir): Simplify, Oleh Krehel, 2019/07/20
- [elpa] master 144e7d9 069/399: counsel.el: Clean up recent compile variables, Oleh Krehel, 2019/07/20