mirror of
https://github.com/correl/doom-modeline.git
synced 2024-11-27 19:19:53 +00:00
Optimize performance of truncate-with-project style.
`file-truename` is bad performance, so should not used in the crucial function.
This commit is contained in:
parent
700a0107f2
commit
a530aaee04
1 changed files with 2 additions and 3 deletions
|
@ -340,7 +340,7 @@ active.")
|
||||||
(when (featurep 'projectile) (projectile-project-root))
|
(when (featurep 'projectile) (projectile-project-root))
|
||||||
(when (featurep 'project)
|
(when (featurep 'project)
|
||||||
(when-let ((project (project-current)))
|
(when-let ((project (project-current)))
|
||||||
(car (project-roots project))))
|
(expand-file-name (car (project-roots project)))))
|
||||||
default-directory))))
|
default-directory))))
|
||||||
|
|
||||||
;; Disable projectile mode-line segment
|
;; Disable projectile mode-line segment
|
||||||
|
@ -550,8 +550,7 @@ Show relative path to the project and truncate it.
|
||||||
Example:
|
Example:
|
||||||
~/Projects/FOSS/emacs/lisp/comint.el => emacs/l/comint.el"
|
~/Projects/FOSS/emacs/lisp/comint.el => emacs/l/comint.el"
|
||||||
(let* ((project-root (doom-modeline-project-root))
|
(let* ((project-root (doom-modeline-project-root))
|
||||||
(relative-path (file-relative-name (or (file-name-directory file-path) "./")
|
(relative-path (file-relative-name (or (file-name-directory file-path) "./") project-root)))
|
||||||
(file-truename project-root))))
|
|
||||||
(let ((active (doom-modeline--active))
|
(let ((active (doom-modeline--active))
|
||||||
(modified-faces (if (buffer-modified-p) 'doom-modeline-buffer-modified)))
|
(modified-faces (if (buffer-modified-p) 'doom-modeline-buffer-modified)))
|
||||||
(let ((project-faces (or modified-faces (if active 'font-lock-string-face)))
|
(let ((project-faces (or modified-faces (if active 'font-lock-string-face)))
|
||||||
|
|
Loading…
Reference in a new issue