mirror of
https://github.com/correl/doom-modeline.git
synced 2024-11-27 11:09:52 +00:00
[Performance] Improve performance of buffer-info segment.
Do not update every time for icons.
This commit is contained in:
parent
67cc091716
commit
77ac0984eb
1 changed files with 29 additions and 26 deletions
|
@ -270,12 +270,13 @@ Uses `all-the-icons-material' to fetch the icon."
|
|||
(doom-modeline-buffer-file-state-icon
|
||||
"vertical_align_center"
|
||||
"><"
|
||||
'doom-modeline-warning)))))
|
||||
'doom-modeline-warning))
|
||||
(t ""))))
|
||||
(add-hook 'find-file-hook #'doom-modeline-update-buffer-file-state-icon)
|
||||
(add-hook 'after-revert-hook #'doom-modeline-update-buffer-file-state-icon)
|
||||
(add-hook 'after-save-hook #'doom-modeline-update-buffer-file-state-icon)
|
||||
(add-hook 'read-only-mode-hook #'doom-modeline-update-buffer-file-state-icon)
|
||||
;; (add-hook 'after-change-functions #'doom-modeline-update-buffer-file-state-icon)
|
||||
(add-hook 'after-change-functions #'doom-modeline-update-buffer-file-state-icon)
|
||||
(add-hook 'clone-indirect-buffer-hook #'doom-modeline-update-buffer-file-state-icon)
|
||||
(add-hook 'evil-insert-state-exit-hook #'doom-modeline-update-buffer-file-state-icon)
|
||||
(advice-add #'undo :after #'doom-modeline-update-buffer-file-state-icon)
|
||||
|
@ -369,6 +370,7 @@ directory, the file name, and its state (modified, read-only or non-existent)."
|
|||
(when (and doom-modeline-icon doom-modeline-major-mode-icon)
|
||||
(when-let ((icon (or doom-modeline--buffer-file-icon
|
||||
(doom-modeline-update-buffer-file-icon))))
|
||||
(unless (string-empty-p icon)
|
||||
(concat
|
||||
(if (and active doom-modeline-major-mode-color-icon)
|
||||
icon
|
||||
|
@ -379,11 +381,12 @@ directory, the file name, and its state (modified, read-only or non-existent)."
|
|||
,(all-the-icons-icon-family icon)
|
||||
:inherit
|
||||
,(if active 'mode-line 'mode-line-inactive))))
|
||||
(if active doom-modeline-vspc doom-modeline-inactive-vspc))))
|
||||
(if active doom-modeline-vspc doom-modeline-inactive-vspc)))))
|
||||
|
||||
;; state icon
|
||||
(when-let ((icon (or doom-modeline--buffer-file-state-icon
|
||||
(doom-modeline-update-buffer-file-state-icon))))
|
||||
(unless (string-empty-p icon)
|
||||
(concat
|
||||
(if active
|
||||
icon
|
||||
|
@ -396,7 +399,7 @@ directory, the file name, and its state (modified, read-only or non-existent)."
|
|||
,(all-the-icons-icon-family icon)
|
||||
:inherit mode-line-inactive)
|
||||
'mode-line-inactive)))
|
||||
(if active doom-modeline-vspc doom-modeline-inactive-vspc)))
|
||||
(if active doom-modeline-vspc doom-modeline-inactive-vspc))))
|
||||
|
||||
;; buffer file name
|
||||
(when-let ((name (or doom-modeline--buffer-file-name
|
||||
|
|
Loading…
Reference in a new issue