mirror of
https://github.com/correl/doom-modeline.git
synced 2024-11-23 19:19:50 +00:00
Optimize: cache project root.
Refer to https://github.com/seagle0128/doom-modeline/issues/32.
This commit is contained in:
parent
645f2426b6
commit
9337faed5b
1 changed files with 5 additions and 2 deletions
|
@ -309,13 +309,16 @@ active.")
|
|||
(buffer-local-value 'mode-line-format (current-buffer)))
|
||||
(list "%e" modeline))))
|
||||
|
||||
(defvar-local doom-modeline-project-root nil)
|
||||
(defun doom-modeline-project-root ()
|
||||
"Get the path to the root of your project.
|
||||
|
||||
If STRICT-P, return nil if no project was found, otherwise return
|
||||
`default-directory'."
|
||||
(if (local-variable-p 'doom-modeline-project-root)
|
||||
doom-modeline-project-root
|
||||
(let (projectile-require-project-root)
|
||||
(projectile-project-root)))
|
||||
(setq doom-modeline-project-root (projectile-project-root)))))
|
||||
|
||||
;; Disable projectile mode-line segment
|
||||
(setq projectile-dynamic-mode-line nil)
|
||||
|
|
Loading…
Reference in a new issue