Optimize performance.

(benchmark-run 1000 (format-mode-line mode-line-format))
From ~2.5s to ~0.5s!!!
This commit is contained in:
Vincent Zhang 2018-11-13 23:23:57 +08:00
parent 97d6b69222
commit e075339b2b

View file

@ -521,8 +521,7 @@ active.")
(and (doom-modeline--active) (and (doom-modeline--active)
'doom-modeline-buffer-file)))) 'doom-modeline-buffer-file))))
(when face `(:inherit ,face)))))) (when face `(:inherit ,face))))))
'help-echo buffer-file-truename))) 'help-echo buffer-file-truename))))
(message "#####%s####" doom-modeline-buffer-file-name))
(add-hook 'find-file-hook #'doom-modeline-update-buffer-file-name) (add-hook 'find-file-hook #'doom-modeline-update-buffer-file-name)
(add-hook 'after-save-hook #'doom-modeline-update-buffer-file-name) (add-hook 'after-save-hook #'doom-modeline-update-buffer-file-name)
@ -642,7 +641,7 @@ directory, the file name, and its state (modified, read-only or non-existent)."
:face 'doom-modeline-warning :face 'doom-modeline-warning
:v-adjust -0.05) :v-adjust -0.05)
" "))) " ")))
(if doom-modeline-buffer-file-name (if doom-modeline-buffer-file-name
doom-modeline-buffer-file-name doom-modeline-buffer-file-name
"%b"))) "%b")))