Don't update buffer info if the file doesn't exist.

This commit is contained in:
Vincent Zhang 2018-11-16 02:28:36 +08:00
parent c7251193bb
commit c809e27487

View file

@ -618,9 +618,10 @@ buffer where knowing the current project directory is important."
(when-let ((file-name (doom-modeline-buffer-file-name)) (when-let ((file-name (doom-modeline-buffer-file-name))
(buffer-name (buffer-name)) (buffer-name (buffer-name))
(buffer-file-name buffer-file-name)) (buffer-file-name buffer-file-name))
(if (string-equal (if (or (not (file-exists-p buffer-file-name))
(string-equal
(file-name-nondirectory buffer-file-name) (file-name-nondirectory buffer-file-name)
(replace-regexp-in-string "<.+>$" "" buffer-name)) (replace-regexp-in-string "<.+>$" "" buffer-name)))
file-name file-name
(format "%s[%s]" file-name buffer-name)))) (format "%s[%s]" file-name buffer-name))))