From f4582bcbe3f5f5b1feb5e98c57fce4d4545ef291 Mon Sep 17 00:00:00 2001 From: Vincent Zhang Date: Thu, 7 Mar 2019 22:57:53 +0700 Subject: [PATCH] Fix #139: doom-modeline showing buffer is modified when it's not. --- doom-modeline-segments.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doom-modeline-segments.el b/doom-modeline-segments.el index 68f3f4b..8251bcf 100644 --- a/doom-modeline-segments.el +++ b/doom-modeline-segments.el @@ -237,6 +237,8 @@ Uses `all-the-icons-material' to fetch the 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 'clone-indirect-buffer-hook #'doom-modeline-update-buffer-file-state-icon) +(advice-add #'set-buffer-modified-p :after #'doom-modeline-update-buffer-file-state-icon) +(advice-add #'restore-buffer-modified-p :after #'doom-modeline-update-buffer-file-state-icon) (advice-add #'undo :after #'doom-modeline-update-buffer-file-state-icon) (advice-add #'undo-tree-undo-1 :after #'doom-modeline-update-buffer-file-state-icon) (advice-add #'undo-tree-redo-1 :after #'doom-modeline-update-buffer-file-state-icon) @@ -287,6 +289,8 @@ mouse-1: Previous buffer\nmouse-3: Next buffer" (add-hook 'evil-insert-state-exit-hook #'doom-modeline-update-buffer-file-state-icon) (advice-add #'rename-buffer :after #'doom-modeline-update-buffer-file-name) (advice-add #'set-visited-file-name :after #'doom-modeline-update-buffer-file-name) +(advice-add #'set-buffer-modified-p :after #'doom-modeline-update-buffer-file-name) +(advice-add #'restore-buffer-modified-p :after #'doom-modeline-update-buffer-file-name) (advice-add #'undo :after #'doom-modeline-update-buffer-file-name) (advice-add #'undo-tree-undo-1 :after #'doom-modeline-update-buffer-file-name) (advice-add #'undo-tree-redo-1 :after #'doom-modeline-update-buffer-file-name)