Speed up project root detection by resolving it less often
Projectile can consume a lot of cycles, especially in indirect buffers or because of project-root-sensitive path segments in the modeline. This experimental fix should spare you that heartache.
This commit is contained in:
parent
e9b288744d
commit
9acba6b269
1 changed files with 10 additions and 0 deletions
|
@ -40,6 +40,16 @@ Emacs.")
|
||||||
:config
|
:config
|
||||||
(projectile-mode +1)
|
(projectile-mode +1)
|
||||||
|
|
||||||
|
;; REVIEW Resolve the project root once, when the file/buffer is opened. This
|
||||||
|
;; speeds up projectile's project root resolution by leaps, but does
|
||||||
|
;; put you at risk of having a stale project root.
|
||||||
|
(setq-hook! '(after-change-major-mode-hook
|
||||||
|
;; In case the user saves the file to a new location
|
||||||
|
after-save-hook
|
||||||
|
;; ...or makes external changes then returns to Emacs
|
||||||
|
focus-in-hook)
|
||||||
|
projectile-project-root (if default-directory (doom-project-root)))
|
||||||
|
|
||||||
;; Projectile runs four functions to determine the root (in this order):
|
;; Projectile runs four functions to determine the root (in this order):
|
||||||
;;
|
;;
|
||||||
;; + `projectile-root-local' -> checks the `projectile-project-root' variable
|
;; + `projectile-root-local' -> checks the `projectile-project-root' variable
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue