From ece7b8fdcd899da16183751664d59d375f4b7536 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 28 Mar 2019 15:07:14 -0400 Subject: [PATCH] Fix doom-project-find-file on non-project DIRs This function should be as DWIM as possible. --- core/autoload/projects.el | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/core/autoload/projects.el b/core/autoload/projects.el index 530deb0e0..c02778d36 100644 --- a/core/autoload/projects.el +++ b/core/autoload/projects.el @@ -76,11 +76,16 @@ they are absolute." ;;;###autoload (defun doom-project-find-file (dir) - "Fuzzy-find a file under DIR." + "Fuzzy-find a file under DIR. + +Will resolve to the nearest project root above DIR. If no project can be found, +the search will be rooted from DIR." (unless (file-directory-p dir) (error "Directory %S does not exist" dir)) - (let ((default-directory dir) - projectile-project-root) + (let* ((default-directory dir) + (projectile-project-root + (or (projectile-project-root) + dir))) (call-interactively ;; Intentionally avoid `helm-projectile-find-file', because it runs ;; asynchronously, and thus doesn't see the lexical `default-directory'