diff options
author | Case Duckworth | 2021-03-25 12:21:37 -0500 |
---|---|---|
committer | Case Duckworth | 2021-03-25 12:21:37 -0500 |
commit | 07876efe874f0831391bd1ca01d5b6bd8907da89 (patch) | |
tree | 8ecee6a05b9cbb0ab501c056c8bf68a56d501ee1 | |
parent | White space (diff) | |
download | emacs-07876efe874f0831391bd1ca01d5b6bd8907da89.tar.gz emacs-07876efe874f0831391bd1ca01d5b6bd8907da89.zip |
Add god-mode indicator to modeline
... and whitespace...
-rw-r--r-- | init.el | 1 | ||||
-rw-r--r-- | lisp/acdw-modeline.el | 83 |
2 files changed, 45 insertions, 39 deletions
diff --git a/init.el b/init.el index 7be1c30..c9886eb 100644 --- a/init.el +++ b/init.el | |||
@@ -338,6 +338,7 @@ | |||
338 | acdw-modeline/vc-branch | 338 | acdw-modeline/vc-branch |
339 | simple-modeline-segment-misc-info | 339 | simple-modeline-segment-misc-info |
340 | simple-modeline-segment-process | 340 | simple-modeline-segment-process |
341 | acdw-modeline/god-mode-indicator | ||
341 | acdw-modeline/minions | 342 | acdw-modeline/minions |
342 | simple-modeline-segment-major-mode)))) | 343 | simple-modeline-segment-major-mode)))) |
343 | :now ((require 'acdw-modeline) | 344 | :now ((require 'acdw-modeline) |
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 |
28 | indicator in the mode-line." | 28 | indicator 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) |