diff --git a/core/autoload/projects.el b/core/autoload/projects.el index e92d8e6b6..1a3cb4acd 100644 --- a/core/autoload/projects.el +++ b/core/autoload/projects.el @@ -61,10 +61,7 @@ If NOCACHE, don't fetch a cached answer." (if nocache (without-project-cache! (doom-project-root nil)) (let (projectile-require-project-root) - ;; NOTE `projectile-project-root' should return default-directory if we're - ;; not in a project. Seems to be a bug upstream. - (or (projectile-project-root) - default-directory)))) + (projectile-project-root)))) ;;;###autoload (defalias 'doom-project-expand #'projectile-expand-root) diff --git a/core/core-projects.el b/core/core-projects.el index 8ecf1bccd..d60d32282 100644 --- a/core/core-projects.el +++ b/core/core-projects.el @@ -45,6 +45,15 @@ projectile-project-root-files) projectile-project-root-files-bottom-up nil))) + ;; Restores the old behavior of `projectile-project-root', where it returns + ;; `default-directory' if not in a project, at least until I update Doom to + ;; deal with this. + ;; FIXME Check again after https://github.com/bbatsov/projectile/issues/1296 + (defun doom*projectile-project-root (project-root) + (or project-root + default-directory)) + (advice-add #'projectile-project-root :filter-return #'doom*projectile-project-root) + ;; Projectile root-searching functions can cause an infinite loop on TRAMP ;; connections, so disable them. (defun doom*projectile-locate-dominating-file (orig-fn file name)