From bd728fd2a8490f99c2497cb77a61e9d0ff829c9d Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 16 Jul 2024 11:06:39 -0400 Subject: [PATCH] fix(lib): doom-project-find-file: fall back to find-file if DIR is empty Fix: #7949 --- lisp/lib/projects.el | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lisp/lib/projects.el b/lisp/lib/projects.el index 16c592e65..3a38750d9 100644 --- a/lisp/lib/projects.el +++ b/lisp/lib/projects.el @@ -155,9 +155,14 @@ If DIR is not a project, it will be indexed (but not cached)." ((and (bound-and-true-p helm-mode) (fboundp 'helm-find-files)) (call-interactively #'helm-find-files)) - ((when-let ((project-current-directory-override t) - (pr (project-current t dir))) - (project-find-file-in nil nil pr))) + ((when-let* ((project-current-directory-override t) + (pr (project-current t dir))) + (condition-case _ + (project-find-file-in nil nil pr) + ;; FIX: project.el throws errors if DIR is an empty directory, + ;; which is poor UX. + (wrong-type-argument + (call-interactively #'find-file))))) ((call-interactively #'find-file))))) ;;;###autoload