diff options
Diffstat (limited to 'lisp/acdw-modeline.el')
-rw-r--r-- | lisp/acdw-modeline.el | 72 |
1 files changed, 39 insertions, 33 deletions
diff --git a/lisp/acdw-modeline.el b/lisp/acdw-modeline.el index adfcb44..d9b1c8b 100644 --- a/lisp/acdw-modeline.el +++ b/lisp/acdw-modeline.el | |||
@@ -33,13 +33,18 @@ Otherwise, cdr should be a function that takes two points (see `count-words')." | |||
33 | 33 | ||
34 | (defun acdw-modeline/buffer-name () ; gonsie | 34 | (defun acdw-modeline/buffer-name () ; gonsie |
35 | "Display the buffer name in a face reflecting its modified status." | 35 | "Display the buffer name in a face reflecting its modified status." |
36 | (propertize (concat (format " %-20s" (truncate-string 20 (buffer-name) "~"))) | 36 | (propertize |
37 | 'face 'bold | 37 | (concat |
38 | ;; (if (buffer-modified-p) | 38 | (format " %-20s" |
39 | ;; 'font-lock-warning-face | 39 | (truncate-string 20 |
40 | ;; 'font-lock-type-face) | 40 | (string-trim (buffer-name) "*" "*") |
41 | 'help-echo (or (buffer-file-name) | 41 | "~"))) |
42 | (buffer-name)))) | 42 | 'face 'bold |
43 | ;; (if (buffer-modified-p) | ||
44 | ;; 'font-lock-warning-face | ||
45 | ;; 'font-lock-type-face) | ||
46 | 'help-echo (or (buffer-file-name) | ||
47 | (buffer-name)))) | ||
43 | 48 | ||
44 | (defun acdw-modeline/erc () | 49 | (defun acdw-modeline/erc () |
45 | "ERC indicator for the modeline." | 50 | "ERC indicator for the modeline." |
@@ -90,31 +95,32 @@ Otherwise, cdr should be a function that takes two points (see `count-words')." | |||
90 | (defun acdw-modeline/modified () ; modified from `simple-modeline' | 95 | (defun acdw-modeline/modified () ; modified from `simple-modeline' |
91 | "Displays a color-coded buffer modification/read-only | 96 | "Displays a color-coded buffer modification/read-only |
92 | indicator in the mode-line." | 97 | indicator in the mode-line." |
93 | (if (not (string-match-p "\\*.*\\*" (buffer-name))) | 98 | (let* ((read-only (and buffer-read-only (buffer-file-name))) |
94 | (let* ((read-only (and buffer-read-only (buffer-file-name))) | 99 | (modified (buffer-modified-p))) |
95 | (modified (buffer-modified-p))) | 100 | (propertize |
96 | (propertize | 101 | (concat " " |
97 | (concat " " | 102 | (cond |
98 | (cond | 103 | ((string-match-p "\\*.*\\*" (buffer-name)) |
99 | ((derived-mode-p 'special-mode | 104 | "*") |
100 | 'lui-mode) | 105 | ((derived-mode-p 'special-mode |
101 | "~") | 106 | 'lui-mode) |
102 | (read-only "=") | 107 | "~") |
103 | (modified "+") | 108 | (read-only "=") |
104 | (t "-"))) | 109 | (modified "+") |
105 | 'help-echo (format | 110 | (t "-"))) |
106 | (concat "Buffer is %s and %smodified\n" | 111 | 'help-echo (format |
107 | "mouse-1: Toggle read-only status.") | 112 | (concat "Buffer is %s and %smodified\n" |
108 | (if read-only "read-only" "writable") | 113 | "mouse-1: Toggle read-only status.") |
109 | (if modified "" "not ")) | 114 | (if read-only "read-only" "writable") |
110 | 'local-map (purecopy (simple-modeline-make-mouse-map | 115 | (if modified "" "not ")) |
111 | 'mouse-1 | 116 | 'local-map (purecopy (simple-modeline-make-mouse-map |
112 | (lambda (event) | 117 | 'mouse-1 |
113 | (interactive "e") | 118 | (lambda (event) |
114 | (with-selected-window | 119 | (interactive "e") |
115 | (posn-window (event-start event)) | 120 | (with-selected-window |
116 | (read-only-mode 'toggle))))) | 121 | (posn-window (event-start event)) |
117 | 'mouse-face 'mode-line-highlight)))) | 122 | (read-only-mode 'toggle))))) |
123 | 'mouse-face 'mode-line-highlight))) | ||
118 | 124 | ||
119 | (defun acdw-modeline/narrowed () | 125 | (defun acdw-modeline/narrowed () |
120 | "Display an indication if the buffer is narrowed." | 126 | "Display an indication if the buffer is narrowed." |
@@ -195,7 +201,7 @@ is, if point < mark." | |||
195 | (defun acdw-modeline/wc () | 201 | (defun acdw-modeline/wc () |
196 | "Display current `wc-buffer-stats'." | 202 | "Display current `wc-buffer-stats'." |
197 | (when (bound-and-true-p wc-mode) | 203 | (when (bound-and-true-p wc-mode) |
198 | (or wc-buffer-stats " [w]"))) | 204 | (format "%8s" (or (cadr wc-buffer-stats) "[w]")))) |
199 | 205 | ||
200 | (defun acdw-modeline/winum () | 206 | (defun acdw-modeline/winum () |
201 | "Show the `winum' number of the current window in the modeline. | 207 | "Show the `winum' number of the current window in the modeline. |