From 4b225341999b7b56b3720fa100a0704c81d1ee1f Mon Sep 17 00:00:00 2001 From: Vincent Zhang Date: Sun, 16 Dec 2018 18:09:26 +0800 Subject: [PATCH] Improve: Watch buffer-read-only. --- doom-modeline.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doom-modeline.el b/doom-modeline.el index 0693fe1..312b872 100644 --- a/doom-modeline.el +++ b/doom-modeline.el @@ -214,6 +214,7 @@ It returns a file name which can be used directly as argument of (declare-function symbol-overlay-assoc 'symbol-overlay) (declare-function symbol-overlay-get-list 'symbol-overlay) (declare-function symbol-overlay-get-symbol 'symbol-overlay) +(declare-function undo-tree-redo 'undo-tree) (declare-function undo-tree-undo 'undo-tree) (declare-function window-numbering-clear-mode-line 'window-numbering) (declare-function window-numbering-get-number-string 'window-numbering) @@ -798,6 +799,12 @@ buffer where knowing the current project directory is important." (advice-add #'narrow-to-region :after #'doom-modeline-update-buffer-file-state-icon) (advice-add #'widen :after #'doom-modeline-update-buffer-file-state-icon) +(add-variable-watcher + 'buffer-read-only + (lambda (_sym val op _where) + (when (and (eq op 'set) (eq val nil)) + (doom-modeline-update-buffer-file-state-icon)))) + (defvar-local doom-modeline--buffer-file-name nil) (defun doom-modeline-update-buffer-file-name (&rest _) "Update buffer file name in mode-line."