summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
authorCase Duckworth2021-03-25 12:21:37 -0500
committerCase Duckworth2021-03-25 12:21:37 -0500
commit07876efe874f0831391bd1ca01d5b6bd8907da89 (patch)
tree8ecee6a05b9cbb0ab501c056c8bf68a56d501ee1 /lisp
parentWhite space (diff)
downloademacs-07876efe874f0831391bd1ca01d5b6bd8907da89.tar.gz
emacs-07876efe874f0831391bd1ca01d5b6bd8907da89.zip
Add god-mode indicator to modeline
... and whitespace...
Diffstat (limited to 'lisp')
-rw-r--r--lisp/acdw-modeline.el83
1 files changed, 44 insertions, 39 deletions
diff --git a/lisp/acdw-modeline.el b/lisp/acdw-modeline.el index 1369d7d..a364cef 100644 --- a/lisp/acdw-modeline.el +++ b/lisp/acdw-modeline.el
@@ -24,44 +24,44 @@
24 24
25;; modified from `simple-modeline' 25;; modified from `simple-modeline'
26(defun acdw-modeline/modified () 26(defun acdw-modeline/modified ()
27 "Displays a color-coded buffer modification/read-only 27 "Displays a color-coded buffer modification/read-only
28indicator in the mode-line." 28indicator in the mode-line."
29 (if (not (string-match-p "\\*.*\\*" (buffer-name))) 29 (if (not (string-match-p "\\*.*\\*" (buffer-name)))
30 (let* ((read-only (and buffer-read-only (buffer-file-name))) 30 (let* ((read-only (and buffer-read-only (buffer-file-name)))
31 (modified (buffer-modified-p))) 31 (modified (buffer-modified-p)))
32 (propertize 32 (propertize
33 (if read-only " =" (if modified " +" " -")) 33 (if read-only " =" (if modified " +" " -"))
34 'help-echo (format 34 'help-echo (format
35 (concat "Buffer is %s and %smodified\n" 35 (concat "Buffer is %s and %smodified\n"
36 "mouse-1: Toggle read-only status.") 36 "mouse-1: Toggle read-only status.")
37 (if read-only "read-only" "writable") 37 (if read-only "read-only" "writable")
38 (if modified "" "not ")) 38 (if modified "" "not "))
39 'local-map (purecopy (simple-modeline-make-mouse-map 39 'local-map (purecopy (simple-modeline-make-mouse-map
40 'mouse-1 40 'mouse-1
41 (lambda (event) 41 (lambda (event)
42 (interactive "e") 42 (interactive "e")
43 (with-selected-window 43 (with-selected-window
44 (posn-window (event-start event)) 44 (posn-window (event-start event))
45 (read-only-mode 'toggle))))) 45 (read-only-mode 'toggle)))))
46 'mouse-face 'mode-line-highlight)))) 46 'mouse-face 'mode-line-highlight))))
47 47
48;; all me, baby 48;; all me, baby
49(defun acdw-modeline/minions () 49(defun acdw-modeline/minions ()
50 "Display a button for `minions-minor-modes-menu'." 50 "Display a button for `minions-minor-modes-menu'."
51 (concat 51 (concat
52 " " 52 " "
53 (propertize 53 (propertize
54 "&" 54 "&"
55 'help-echo (format 55 'help-echo (format
56 "Minor modes menu\nmouse-1: show menu.") 56 "Minor modes menu\nmouse-1: show menu.")
57 'local-map (purecopy (simple-modeline-make-mouse-map 57 'local-map (purecopy (simple-modeline-make-mouse-map
58 'mouse-1 58 'mouse-1
59 (lambda (event) 59 (lambda (event)
60 (interactive "e") 60 (interactive "e")
61 (with-selected-window (posn-window 61 (with-selected-window (posn-window
62 (event-start event)) 62 (event-start event))
63 (minions-minor-modes-menu))))) 63 (minions-minor-modes-menu)))))
64 'mouse-face 'mode-line-highlight))) 64 'mouse-face 'mode-line-highlight)))
65 65
66;; from https://www.gonsie.com/blorg/modeline.html, from Doom 66;; from https://www.gonsie.com/blorg/modeline.html, from Doom
67(defun acdw-modeline/vc-branch () 67(defun acdw-modeline/vc-branch ()
@@ -71,10 +71,15 @@ indicator in the mode-line."
71;; from gonsie 71;; from gonsie
72(defun acdw-modeline/buffer-name () 72(defun acdw-modeline/buffer-name ()
73 (propertize " %b " 73 (propertize " %b "
74 'face 74 'face
75 (if (buffer-modified-p) 75 (if (buffer-modified-p)
76 'font-lock-warning-face 76 'font-lock-warning-face
77 'font-lock-type-face) 77 'font-lock-type-face)
78 'help-echo (buffer-file-name))) 78 'help-echo (buffer-file-name)))
79
80;; god-mode indicator
81(defun acdw-modeline/god-mode-indicator ()
82 (when (bound-and-true-p god-local-mode)
83 " God"))
79 84
80(provide 'acdw-modeline) 85(provide 'acdw-modeline)