From d587d11653609127f676e4d4a44c879408ce4e1b Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 4 Mar 2019 11:57:14 -0500 Subject: [PATCH] Prevent false modified indicator in modeline Mentioned in seagle0128/doom-modeline#129 Remove advice when lewang/ws-butler#31 is merged --- modules/ui/modeline/config.el | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/ui/modeline/config.el b/modules/ui/modeline/config.el index 0d93d0e5e..25dc9511d 100644 --- a/modules/ui/modeline/config.el +++ b/modules/ui/modeline/config.el @@ -66,7 +66,15 @@ (doom-modeline-def-modeline 'project '(bar buffer-default-directory) - '(misc-info mu4e github debug fancy-battery " " major-mode))) + '(misc-info mu4e github debug fancy-battery " " major-mode)) + + ;; Some functions modify the buffer, causing the modeline to show a false + ;; modified state, so we try to force them to behave. + (defun +modeline*inhibit-modification-hooks (orig-fn &rest args) + (with-silent-modifications (apply orig-fn args))) + (advice-add #'ws-butler-after-save :around #'+modeline*inhibit-modification-hooks) + (add-hook 'evil-insert-state-exit-hook #'doom-modeline-update-buffer-file-name) + (add-hook 'evil-insert-state-exit-hook #'doom-modeline-update-buffer-file-state-icon)) ;;