From a530aaee04bf4d819407ecfba065db0da1517a91 Mon Sep 17 00:00:00 2001 From: Vincent Zhang Date: Tue, 20 Nov 2018 21:24:24 +0800 Subject: [PATCH] Optimize performance of truncate-with-project style. `file-truename` is bad performance, so should not used in the crucial function. --- doom-modeline.el | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/doom-modeline.el b/doom-modeline.el index 1295df0..39c2542 100644 --- a/doom-modeline.el +++ b/doom-modeline.el @@ -340,7 +340,7 @@ active.") (when (featurep 'projectile) (projectile-project-root)) (when (featurep 'project) (when-let ((project (project-current))) - (car (project-roots project)))) + (expand-file-name (car (project-roots project))))) default-directory)))) ;; Disable projectile mode-line segment @@ -550,8 +550,7 @@ Show relative path to the project and truncate it. Example: ~/Projects/FOSS/emacs/lisp/comint.el => emacs/l/comint.el" (let* ((project-root (doom-modeline-project-root)) - (relative-path (file-relative-name (or (file-name-directory file-path) "./") - (file-truename project-root)))) + (relative-path (file-relative-name (or (file-name-directory file-path) "./") project-root))) (let ((active (doom-modeline--active)) (modified-faces (if (buffer-modified-p) 'doom-modeline-buffer-modified))) (let ((project-faces (or modified-faces (if active 'font-lock-string-face)))