From 92b5bf5c793ea52705b95a8ce3f01f73d94f48df Mon Sep 17 00:00:00 2001 From: Vincent Zhang Date: Wed, 26 Sep 2018 17:20:04 +0800 Subject: [PATCH] Fix #29: Handle project root is nil. Exception: (wrong-type-argument stringp nil) --- doom-modeline.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doom-modeline.el b/doom-modeline.el index 93608e6..fa746fe 100644 --- a/doom-modeline.el +++ b/doom-modeline.el @@ -402,8 +402,8 @@ active.") (defun doom-modeline-update-env () "Update environment info on mode-line." (when doom-modeline-env-command - (let* ((default-directory (doom-modeline-project-root)) - (s (shell-command-to-string doom-modeline-env-command))) + (let ((default-directory (or (doom-modeline-project-root) "")) + (s (shell-command-to-string doom-modeline-env-command))) (setq doom-modeline-env-version (if (string-match "[ \t\n\r]+\\'" s) (replace-match "" t t s) s))))) @@ -530,8 +530,8 @@ fish-shell style. Example: ~/Projects/FOSS/emacs/lisp/comint.el => ~/P/F/emacs/lisp/comint.el" - (let* ((project-root (doom-modeline-project-root)) - (file-name-split (shrink-path-file-mixed (or project-root "") + (let* ((project-root (or (doom-modeline-project-root) "")) + (file-name-split (shrink-path-file-mixed project-root (file-name-directory file-path) file-path)) (active (doom-modeline--active)))