From 89bfa214dcc64ae13e4d459d2089d97465955c03 Mon Sep 17 00:00:00 2001 From: "Matthew L. Fidler" Date: Fri, 26 Feb 2016 08:55:07 -0600 Subject: [PATCH] Add modified outside of emacs flag and icon --- mode-icons.el | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/mode-icons.el b/mode-icons.el index 9ac55fd..abc29c2 100644 --- a/mode-icons.el +++ b/mode-icons.el @@ -206,6 +206,7 @@ This was stole/modified from `c-save-buffer-state'" (writable #xf09c FontAwesome) (save #xf0c7 FontAwesome) (saved "" nil) + (modified-outside #xf071 FontAwesome) (apple #xf179 FontAwesome) (win #xf17a FontAwesome) ;; FIXME: use lsb_release to determine Linux variant and choose appropriate icon @@ -228,6 +229,7 @@ without the extension. And the third being the type of icon." (const :tag "Writable Indicator" writable) (const :tag "Saved" saved) (const :tag "Save" save) + (const :tag "Modified Outside Emacs" modified-outside) (const :tag "Apple" apple) (const :tag "Windows" win) (const :tag "Unix" unix)) @@ -553,10 +555,17 @@ ICON-SPEC should be a specification from `mode-icons'." (defun mode-icons--modified-status () "Get modified status icon." (eval `(propertize - ,(let ((mod (format-mode-line "%1+")) + ,(let ((mod (or (and (not (or (and (buffer-file-name) (file-remote-p buffer-file-name)) + (verify-visited-file-modtime (current-buffer)))) + "!") + (format-mode-line "%1+"))) icon-spec) (setq mod (or (cond - ((string= "*" mod) + ((char-equal ?! (aref mod 0)) + (if (setq icon-spec (mode-icons-get-icon-spec 'modified-outside)) + (mode-icons-propertize-mode 'modified-outside icon-spec) + mod)) + ((char-equal ?* (aref mod 0)) (if (setq icon-spec (mode-icons-get-icon-spec 'save)) (mode-icons-propertize-mode 'save icon-spec) mod))