Fix doom-project-root returning nil if no project

It should return default-directory. A change upstream broke this.
This commit is contained in:
Henrik Lissner 2018-09-22 11:54:08 -04:00
parent 7acece3e0b
commit ac63596be8
3 changed files with 6 additions and 3 deletions

View file

@ -89,7 +89,7 @@ MATCH is a string regexp. Only entries that match it will be included."
(recentf-remove-if-non-kept old-path)) (recentf-remove-if-non-kept old-path))
(when (and (bound-and-true-p projectile-mode) (when (and (bound-and-true-p projectile-mode)
(projectile-project-p) (projectile-project-p)
(projectile-file-cached-p old-path (projectile-project-root))) (projectile-file-cached-p old-path (doom-project-root 'nocache)))
(projectile-purge-file-from-cache old-path)) (projectile-purge-file-from-cache old-path))
(when (bound-and-true-p save-place-mode) (when (bound-and-true-p save-place-mode)
(save-place-forget-unreadable-files))) (save-place-forget-unreadable-files)))

View file

@ -62,7 +62,10 @@ If NOCACHE, don't fetch a cached answer."
(if nocache (if nocache
(without-project-cache! (doom-project-root nil)) (without-project-cache! (doom-project-root nil))
(let (projectile-require-project-root) (let (projectile-require-project-root)
(projectile-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))))
;;;###autoload ;;;###autoload
(defalias 'doom-project-expand #'projectile-expand-root) (defalias 'doom-project-expand #'projectile-expand-root)

View file

@ -299,7 +299,7 @@ Otherwise, falls back on `find-file-at-point'."
(let ((file (projectile-completing-read "Find file: " (let ((file (projectile-completing-read "Find file: "
(projectile-current-project-files) (projectile-current-project-files)
:initial-input path))) :initial-input path)))
(find-file (expand-file-name file (projectile-project-root))) (find-file (expand-file-name file (doom-project-root)))
(run-hooks 'projectile-find-file-hook)))))) (run-hooks 'projectile-find-file-hook))))))
(#'doom-project-browse)))) (#'doom-project-browse))))
(find-file-at-point path)))))) (find-file-at-point path))))))