From c809e27487bfc70957ec1facc6e83affd9204b5e Mon Sep 17 00:00:00 2001 From: Vincent Zhang Date: Fri, 16 Nov 2018 02:28:36 +0800 Subject: [PATCH] Don't update buffer info if the file doesn't exist. --- doom-modeline.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/doom-modeline.el b/doom-modeline.el index 3a388de..5041dd1 100644 --- a/doom-modeline.el +++ b/doom-modeline.el @@ -618,9 +618,10 @@ buffer where knowing the current project directory is important." (when-let ((file-name (doom-modeline-buffer-file-name)) (buffer-name (buffer-name)) (buffer-file-name buffer-file-name)) - (if (string-equal - (file-name-nondirectory buffer-file-name) - (replace-regexp-in-string "<.+>$" "" buffer-name)) + (if (or (not (file-exists-p buffer-file-name)) + (string-equal + (file-name-nondirectory buffer-file-name) + (replace-regexp-in-string "<.+>$" "" buffer-name))) file-name (format "%s[%s]" file-name buffer-name))))