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.el92
1 files changed, 44 insertions, 48 deletions
diff --git a/lisp/acdw-modeline.el b/lisp/acdw-modeline.el index c7b904f..79249bb 100644 --- a/lisp/acdw-modeline.el +++ b/lisp/acdw-modeline.el
@@ -22,64 +22,60 @@
22(require 'simple-modeline) 22(require 'simple-modeline)
23(require 'minions) 23(require 'minions)
24 24
25;; modified from `simple-modeline' 25(defun acdw-modeline/buffer-name () ; gonsie
26(defun acdw-modeline/modified () 26 (propertize " %b "
27 "Displays a color-coded buffer modification/read-only 27 'face
28 (if (buffer-modified-p)
29 'font-lock-warning-face
30 'font-lock-type-face)
31 'help-echo (buffer-file-name)))
32
33(defun acdw-modeline/god-mode-indicator ()
34 (when (bound-and-true-p god-local-mode)
35 " God"))
36
37(defun acdw-modeline/modified () ; modified from `simple-modeline'
38 "Displays a color-coded buffer modification/read-only
28indicator in the mode-line." 39indicator in the mode-line."
29 (if (not (string-match-p "\\*.*\\*" (buffer-name))) 40 (if (not (string-match-p "\\*.*\\*" (buffer-name)))
30 (let* ((read-only (and buffer-read-only (buffer-file-name))) 41 (let* ((read-only (and buffer-read-only (buffer-file-name)))
31 (modified (buffer-modified-p))) 42 (modified (buffer-modified-p)))
32 (propertize 43 (propertize
33 (if read-only " =" (if modified " +" " -")) 44 (if read-only " =" (if modified " +" " -"))
34 'help-echo (format 45 'help-echo (format
35 (concat "Buffer is %s and %smodified\n" 46 (concat "Buffer is %s and %smodified\n"
36 "mouse-1: Toggle read-only status.") 47 "mouse-1: Toggle read-only status.")
37 (if read-only "read-only" "writable") 48 (if read-only "read-only" "writable")
38 (if modified "" "not ")) 49 (if modified "" "not "))
39 'local-map (purecopy (simple-modeline-make-mouse-map 50 'local-map (purecopy (simple-modeline-make-mouse-map
40 'mouse-1 51 'mouse-1
41 (lambda (event) 52 (lambda (event)
42 (interactive "e") 53 (interactive "e")
43 (with-selected-window 54 (with-selected-window
44 (posn-window (event-start event)) 55 (posn-window (event-start event))
45 (read-only-mode 'toggle))))) 56 (read-only-mode 'toggle)))))
46 'mouse-face 'mode-line-highlight)))) 57 'mouse-face 'mode-line-highlight))))
47 58
48;; all me, baby 59(defun acdw-modeline/minions () ; by me
49(defun acdw-modeline/minions () 60 "Display a button for `minions-minor-modes-menu'."
50 "Display a button for `minions-minor-modes-menu'." 61 (concat
51 (concat 62 " "
52 " " 63 (propertize
53 (propertize 64 "&"
54 "&" 65 'help-echo (format
55 'help-echo (format 66 "Minor modes menu\nmouse-1: show menu.")
56 "Minor modes menu\nmouse-1: show menu.") 67 'local-map (purecopy (simple-modeline-make-mouse-map
57 'local-map (purecopy (simple-modeline-make-mouse-map 68 'mouse-1
58 'mouse-1 69 (lambda (event)
59 (lambda (event) 70 (interactive "e")
60 (interactive "e") 71 (with-selected-window (posn-window
61 (with-selected-window (posn-window 72 (event-start event))
62 (event-start event)) 73 (minions-minor-modes-menu)))))
63 (minions-minor-modes-menu))))) 74 'mouse-face 'mode-line-highlight)))
64 'mouse-face 'mode-line-highlight)))
65 75
66;; from https://www.gonsie.com/blorg/modeline.html, from Doom
67(defun acdw-modeline/vc-branch () 76(defun acdw-modeline/vc-branch ()
77 ;; from https://www.gonsie.com/blorg/modeline.html, from Doom
68 (if-let ((backend (vc-backend buffer-file-name))) 78 (if-let ((backend (vc-backend buffer-file-name)))
69 (substring vc-mode (+ (if (eq backend 'Hg) 2 3) 2)))) 79 (substring vc-mode (+ (if (eq backend 'Hg) 2 3) 2))))
70
71;; from gonsie
72(defun acdw-modeline/buffer-name ()
73 (propertize " %b "
74 'face
75 (if (buffer-modified-p)
76 'font-lock-warning-face
77 'font-lock-type-face)
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"))
84 80
85(provide 'acdw-modeline) 81(provide 'acdw-modeline)