emacs - fix the bug modeline modified indicator not show readly when the
authorPeng Li <seudut@gmail.com>
Sat, 30 Jul 2016 08:26:07 +0000 (16:26 +0800)
committerPeng Li <seudut@gmail.com>
Sat, 30 Jul 2016 08:26:07 +0000 (16:26 +0800)
buufer is readonly

emacs.d/config.org

index 1b0eb73..f0a8f95 100644 (file)
@@ -437,7 +437,7 @@ Revised powerline-center-theme
     :group 'powerline)
 
   ;; Don't show buffer modified for scratch and eshell mode
-  (defun sd/buffer-show-modified ()
+  (defun sd/buffer-is-eshel-or-scratch ()
     "Dot not show modified indicator for buffers"
     (interactive)
     (unless (or (string-match "*scratch*" (buffer-name))
@@ -454,7 +454,7 @@ Revised powerline-center-theme
                             (mode-line-buffer-id (if active 'sd/mode-line-buffer-id 'mode-line-buffer-id-inactive))
                             (mode-line (if active 'mode-line 'mode-line-inactive))
                             (my-face1 (if active 'sd/powerline-active1 'powerline-inactive1))
-                            (my-face-buffer-modified (if (and (sd/buffer-show-modified) (buffer-modified-p)) 
+                            (my-face-buffer-modified (if (and (sd/buffer-is-eshel-or-scratch) (buffer-modified-p) (not buffer-read-only)) 
                                                          'sd/buffer-modified-active1
                                                        (if buffer-read-only 'sd/buffer-view-active1
                                                          my-face1)))