diff --git a/core/core-projects.el b/core/core-projects.el index 86fda91a7..32926ccd0 100644 --- a/core/core-projects.el +++ b/core/core-projects.el @@ -32,6 +32,19 @@ ("less" "css") ("styl" "css")))) + ;; It breaks projectile's project root resolution if HOME is a project (e.g. + ;; it's a git repo). In that case, we disable bottom-up root searching to + ;; prevent issues. This makes project resolution a little slower and may cause + ;; incorrect project roots in other edge cases. + (let ((default-directory "~")) + (when (cl-find-if #'projectile-file-exists-p + projectile-project-root-files-bottom-up) + (message "HOME appears to be a project. Disabling bottom-up root search.") + (setq projectile-project-root-files + (append projectile-project-root-files-bottom-up + projectile-project-root-files) + projectile-project-root-files-bottom-up nil))) + ;; Projectile root-searching functions can cause an infinite loop on TRAMP ;; connections, so disable them. (defun doom*projectile-locate-dominating-file (orig-fn &rest args)