mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
ui/modeline: refresh +modeline-buffer-state often
This fixes issues where the buffer's modified state isn't reflected properly in the mode-line, at the expense of a little (but acceptable loss of) efficiency.
This commit is contained in:
@ -402,22 +402,7 @@ Meant for `+modeline-buffer-path-function'."
|
||||
;;
|
||||
;; Segments
|
||||
|
||||
(defun +modeline|update-on-change ()
|
||||
(+modeline--set-+modeline-buffer-state)
|
||||
(remove-hook 'post-command-hook #'+modeline|update-on-change t))
|
||||
(defun +modeline|start-update-on-change ()
|
||||
(add-hook 'post-command-hook #'+modeline|update-on-change nil t))
|
||||
(add-hook 'first-change-hook #'+modeline|start-update-on-change)
|
||||
|
||||
(advice-add #'undo :after #'+modeline--set-+modeline-buffer-state)
|
||||
(advice-add #'undo-tree-undo :after #'+modeline--set-+modeline-buffer-state)
|
||||
|
||||
(def-modeline-segment! +modeline-buffer-state
|
||||
:on-hooks (find-file-hook
|
||||
read-only-mode-hook
|
||||
after-change-functions
|
||||
after-save-hook
|
||||
after-revert-hook)
|
||||
(let* ((base (buffer-base-buffer))
|
||||
(icon (cond (buffer-read-only
|
||||
(all-the-icons-octicon
|
||||
|
Reference in New Issue
Block a user