From 5fefd185b6b0db0958a07dba5f09fca9640180ad Mon Sep 17 00:00:00 2001 From: Vincent Zhang Date: Sun, 18 Nov 2018 03:39:35 +0800 Subject: [PATCH] Fix: nil error if the buffer file name doesn't contain directory. --- doom-modeline.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doom-modeline.el b/doom-modeline.el index c53c8f6..2fbccb5 100644 --- a/doom-modeline.el +++ b/doom-modeline.el @@ -550,7 +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 (file-name-directory file-path) + (relative-path (file-relative-name (or (file-name-directory file-path) "./") (file-truename project-root)))) (let ((active (doom-modeline--active)) (modified-faces (if (buffer-modified-p) 'doom-modeline-buffer-modified)))