From 0ead21b91f9edf664b81162a66a0ca14a7335e5a Mon Sep 17 00:00:00 2001 From: Vincent Zhang Date: Fri, 29 Mar 2019 21:36:47 +0800 Subject: [PATCH] Optimize doom-modeline-project-root. --- doom-modeline-core.el | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/doom-modeline-core.el b/doom-modeline-core.el index ec3241a..b61120c 100644 --- a/doom-modeline-core.el +++ b/doom-modeline-core.el @@ -478,15 +478,14 @@ If DEFAULT is non-nil, set the default mode-line for all buffers." (defvar-local doom-modeline-project-root nil) (defun doom-modeline-project-root () "Get the path to the root of your project. - - Return `default-directory' if no project was found." +Return `default-directory' if no project was found." (or doom-modeline-project-root (setq doom-modeline-project-root (file-local-name (or - (when (featurep 'projectile) + (when (bound-and-true-p projectile-mode) (ignore-errors (projectile-project-root))) - (when (featurep 'project) + (when (fboundp 'project-current) (ignore-errors (when-let ((project (project-current))) (expand-file-name (car (project-roots project))))))