about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2021-03-12 09:36:15 -0600
committerCase Duckworth2021-03-12 09:36:15 -0600
commitcabd4323dde11411c8285d927510cbc062486571 (patch)
treed12b4ec5f31c236d7c4c561a801da5cda305c9e6
parentAdd binding for `hippie-expand' (diff)
downloademacs-cabd4323dde11411c8285d927510cbc062486571.tar.gz
emacs-cabd4323dde11411c8285d927510cbc062486571.zip
Configure `simple-modeline'
-rw-r--r--init.el13
-rw-r--r--lisp/acdw.el44
2 files changed, 56 insertions, 1 deletions
diff --git a/init.el b/init.el index 3aca829..d945e4c 100644 --- a/init.el +++ b/init.el
@@ -305,7 +305,18 @@
305 305
306;; Simple mode line 306;; Simple mode line
307(acdw/pkg simple-modeline 307(acdw/pkg simple-modeline
308 :now ((simple-modeline-mode +1))) 308 :now ((acdw/set '((simple-modeline-segments
309 ((;; left
310 acdw/modeline-modified
311 simple-modeline-segment-buffer-name
312 simple-modeline-segment-position)
313 (;; right
314 simple-modeline-segment-vc
315 simple-modeline-segment-misc-info
316 simple-modeline-segment-process
317 acdw/modeline-minions
318 simple-modeline-segment-major-mode)))))
319 (simple-modeline-mode +1)))
309 320
310;;; Magit 321;;; Magit
311 322
diff --git a/lisp/acdw.el b/lisp/acdw.el index 971eabe..3ae480d 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el
@@ -21,6 +21,9 @@
21;; 21;;
22;;; Code: 22;;; Code:
23 23
24(require 'simple-modeline)
25(require 'minions)
26
24;;; Utilities 27;;; Utilities
25 28
26(defun acdw/when-unfocused (func &rest args) 29(defun acdw/when-unfocused (func &rest args)
@@ -51,6 +54,47 @@ Ready for use with `after-focus-change-function'."
51 (run-at-time sunset-time (* 60 60 24) sunset-command) 54 (run-at-time sunset-time (* 60 60 24) sunset-command)
52 (run-at-time "12:00am" (* 60 60 24) sunset-command))) 55 (run-at-time "12:00am" (* 60 60 24) sunset-command)))
53 56
57;;; Mode line segments (for `simple-modeline')
58(defun acdw/modeline-modified ()
59 "Displays a color-coded buffer modification/read-only indicator in the mode-line."
60 (if (not (string-match-p "\\*.*\\*" (buffer-name)))
61 (let* ((read-only (and buffer-read-only (buffer-file-name)))
62 (modified (buffer-modified-p)))
63 (propertize
64 (if read-only " ×" (if modified " ●" " ○"))
65 'face `(:inherit
66 ,(if modified 'simple-modeline-status-modified
67 (if read-only 'simple-modeline-status-error
68 'simple-modeline-unimportant)))
69 'help-echo (format
70 "Buffer is %s and %smodified\nmouse-1: Toggle read-only status."
71 (if read-only "read-only" "writable")
72 (if modified "" "not "))
73 'local-map (purecopy (simple-modeline-make-mouse-map
74 'mouse-1
75 (lambda (event)
76 (interactive "e")
77 (with-selected-window (posn-window (event-start event))
78 (read-only-mode 'toggle)))))
79 'mouse-face 'mode-line-highlight))))
80
81(defun acdw/modeline-minions ()
82 "Display a button for `minions-minor-modes-menu'."
83 (concat
84 " "
85 (propertize
86 "ⱷ"
87 'help-echo (format
88 "Minor modes menu\nmouse-1: show menu.")
89 'local-map (purecopy (simple-modeline-make-mouse-map
90 'mouse-1
91 (lambda (event)
92 (interactive "e")
93 (with-selected-window (posn-window (event-start
94 event))
95 (minions-minor-modes-menu)))))
96 'mouse-face 'mode-line-highlight)))
97
54;;; Directories (think `no-littering') 98;;; Directories (think `no-littering')
55 99
56(defvar acdw/dir (expand-file-name 100(defvar acdw/dir (expand-file-name