about summary refs log tree commit diff stats
path: root/lisp/acdw-modeline.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/acdw-modeline.el')
-rw-r--r--lisp/acdw-modeline.el70
1 files changed, 43 insertions, 27 deletions
diff --git a/lisp/acdw-modeline.el b/lisp/acdw-modeline.el index 5784148..6a11418 100644 --- a/lisp/acdw-modeline.el +++ b/lisp/acdw-modeline.el
@@ -22,6 +22,15 @@
22(require 'simple-modeline) 22(require 'simple-modeline)
23(require 'minions) 23(require 'minions)
24 24
25(defcustom acdw-modeline/word-count-modes
26 (mapcar (lambda (m) (cons m nil)) simple-modeline-word-count-modes)
27 "Alist of modes to functions that `acdw-modeline/word-count' should dispatch.
28If the cdr of the cons cell is nil, use the default function (`count-words').
29Otherwise, cdr should be a function that takes two points (see `count-words')."
30 :type '(alist :key-type (symbol :tag "Major-Mode")
31 :value-type function)
32 :group 'simple-modeline)
33
25(defun acdw-modeline/buffer-name () ; gonsie 34(defun acdw-modeline/buffer-name () ; gonsie
26 "Display the buffer name in a face reflecting its modified status." 35 "Display the buffer name in a face reflecting its modified status."
27 (propertize " %b " 36 (propertize " %b "
@@ -40,7 +49,35 @@
40(defun acdw-modeline/god-mode-indicator () 49(defun acdw-modeline/god-mode-indicator ()
41 "Display an indicator if `god-local-mode' is active." 50 "Display an indicator if `god-local-mode' is active."
42 (when (bound-and-true-p god-local-mode) 51 (when (bound-and-true-p god-local-mode)
43 " God")) 52 " Ω"))
53
54(defun acdw-modeline/major-mode ()
55 "Displays the current major mode in the mode-line."
56 (propertize
57 (concat " "
58 (or (and (boundp 'delighted-modes)
59 (cadr (assq major-mode delighted-modes)))
60 (format-mode-line mode-name)))
61 'face 'bold
62 'keymap mode-line-major-mode-keymap
63 'mouse-face 'mode-line-highlight))
64
65(defun acdw-modeline/minions () ; by me
66 "Display a button for `minions-minor-modes-menu'."
67 (concat
68 " "
69 (propertize
70 "&"
71 'help-echo (format
72 "Minor modes menu\nmouse-1: show menu.")
73 'local-map (purecopy (simple-modeline-make-mouse-map
74 'mouse-1
75 (lambda (event)
76 (interactive "e")
77 (with-selected-window (posn-window
78 (event-start event))
79 (minions-minor-modes-menu)))))
80 'mouse-face 'mode-line-highlight)))
44 81
45(defun acdw-modeline/modified () ; modified from `simple-modeline' 82(defun acdw-modeline/modified () ; modified from `simple-modeline'
46 "Displays a color-coded buffer modification/read-only 83 "Displays a color-coded buffer modification/read-only
@@ -64,23 +101,6 @@ indicator in the mode-line."
64 (read-only-mode 'toggle))))) 101 (read-only-mode 'toggle)))))
65 'mouse-face 'mode-line-highlight)))) 102 'mouse-face 'mode-line-highlight))))
66 103
67(defun acdw-modeline/minions () ; by me
68 "Display a button for `minions-minor-modes-menu'."
69 (concat
70 " "
71 (propertize
72 "&"
73 'help-echo (format
74 "Minor modes menu\nmouse-1: show menu.")
75 'local-map (purecopy (simple-modeline-make-mouse-map
76 'mouse-1
77 (lambda (event)
78 (interactive "e")
79 (with-selected-window (posn-window
80 (event-start event))
81 (minions-minor-modes-menu)))))
82 'mouse-face 'mode-line-highlight)))
83
84(defun acdw-modeline/narrowed () 104(defun acdw-modeline/narrowed ()
85 "Display an indication if the buffer is narrowed." 105 "Display an indication if the buffer is narrowed."
86 (when (buffer-narrowed-p) 106 (when (buffer-narrowed-p)
@@ -135,6 +155,11 @@ is, if point < mark."
135 " (%-d)") 155 " (%-d)")
136 text-scale-mode-amount))) 156 text-scale-mode-amount)))
137 157
158(defun acdw-modeline/track ()
159 "Display `tracking-mode' information."
160 (when tracking-mode
161 tracking-mode-line-buffers))
162
138(defun acdw-modeline/vc-branch () 163(defun acdw-modeline/vc-branch ()
139 "Display the version control branch of the current buffer in the modeline." 164 "Display the version control branch of the current buffer in the modeline."
140 ;; from https://www.gonsie.com/blorg/modeline.html, from Doom 165 ;; from https://www.gonsie.com/blorg/modeline.html, from Doom
@@ -148,15 +173,6 @@ Only shows if there is more than one window."
148 (> winum--window-count 1)) 173 (> winum--window-count 1))
149 (format winum-format (winum-get-number-string)))) 174 (format winum-format (winum-get-number-string))))
150 175
151(defcustom acdw-modeline/word-count-modes
152 (mapcar (lambda (m) (cons m nil)) simple-modeline-word-count-modes)
153 "Alist of modes to functions that `acdw-modeline/word-count' should dispatch.
154If the cdr of the cons cell is nil, use the default function (`count-words').
155Otherwise, cdr should be a function that takes two points (see `count-words')."
156 :type '(alist :key-type (symbol :tag "Major-Mode")
157 :value-type function)
158 :group 'simple-modeline)
159
160(defun acdw-modeline/word-count () 176(defun acdw-modeline/word-count ()
161 "Display a buffer word count, depending on the major mode. 177 "Display a buffer word count, depending on the major mode.
162Uses `acdw-modeline/word-count-modes' to determine which function to use." 178Uses `acdw-modeline/word-count-modes' to determine which function to use."