From c2d0cae6a54516b6ffd321e143dd85eb24b0e3fc Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 26 Mar 2019 03:38:37 -0400 Subject: [PATCH] doom-project-find-file: avoid helm-projectile #1274 helm-projectile-find-file misbehaves as a workspace project-switch handler (likely because it runs asynchronously and misses the lexical value of `default-directory`), so we avoid it and use projectile-find-file directly (which still uses helm, just not the helm-projectile package). --- core/autoload/projects.el | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/core/autoload/projects.el b/core/autoload/projects.el index 157bd17b7..74a740f9b 100644 --- a/core/autoload/projects.el +++ b/core/autoload/projects.el @@ -86,19 +86,24 @@ they are absolute." ;;;###autoload (defun doom-project-find-file (dir) "Fuzzy-find a file under DIR." - (without-project-cache! - (let* ((default-directory (file-truename dir)) - projectile-project-root) - (call-interactively - ;; completion modules may remap this command - (or (command-remapping #'projectile-find-file) - #'projectile-find-file))))) + (unless (file-directory-p dir) + (error "Directory %S does not exist" dir)) + (let ((default-directory dir) + projectile-project-root) + (call-interactively + ;; Intentionally avoid `helm-projectile-find-file', because it runs + ;; asynchronously, and thus doesn't see the lexical `default-directory' + (if (featurep! :completion ivy) + #'counsel-projectile-find-file + #'projectile-find-file)))) ;;;###autoload (defun doom-project-browse (dir) "Traverse a file structure starting linearly from DIR." (let ((default-directory (file-truename dir))) (call-interactively - ;; completion modules may remap this command - (or (command-remapping #'find-file) - #'find-file)))) + (cond ((featurep! :completion ivy) + #'counsel-find-file) + ((featurep! :completion helm) + #'helm-find-files) + (#'find-file)))))