From c4fe2fbfab052de6ab21f1accb0d364e478d924e Mon Sep 17 00:00:00 2001 From: Vincent Zhang Date: Wed, 10 Apr 2019 14:23:44 +0800 Subject: [PATCH] Refactor doom-modeline-update-file-icon. --- doom-modeline-segments.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doom-modeline-segments.el b/doom-modeline-segments.el index caedb5b..3d6c55c 100644 --- a/doom-modeline-segments.el +++ b/doom-modeline-segments.el @@ -201,10 +201,12 @@ buffer where knowing the current project directory is important." (setq doom-modeline--buffer-file-icon (when (and doom-modeline-icon doom-modeline-major-mode-icon) (let* ((height (/ all-the-icons-scale-factor 1.3)) + (file (file-name-nondirectory (or buffer-file-name ""))) (icon (if (and buffer-file-name (all-the-icons-match-to-alist buffer-file-name all-the-icons-icon-alist)) - (doom-modeline-icon-for-file buffer-file-name :height height) + (unless (string-empty-p file) + (doom-modeline-icon-for-file file :height height)) (doom-modeline-icon-for-mode major-mode :height height)))) (if (symbolp icon) (setq icon (doom-modeline-icon-faicon "file" :height height :v-adjust -0.0575)))