diff options
author | Case Duckworth | 2021-03-12 09:36:15 -0600 |
---|---|---|
committer | Case Duckworth | 2021-03-12 09:36:15 -0600 |
commit | cabd4323dde11411c8285d927510cbc062486571 (patch) | |
tree | d12b4ec5f31c236d7c4c561a801da5cda305c9e6 /lisp | |
parent | Add binding for `hippie-expand' (diff) | |
download | emacs-cabd4323dde11411c8285d927510cbc062486571.tar.gz emacs-cabd4323dde11411c8285d927510cbc062486571.zip |
Configure `simple-modeline'
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/acdw.el | 44 |
1 files changed, 44 insertions, 0 deletions
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 |