From 07876efe874f0831391bd1ca01d5b6bd8907da89 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Thu, 25 Mar 2021 12:21:37 -0500 Subject: Add god-mode indicator to modeline ... and whitespace... --- init.el | 1 + 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 @@ acdw-modeline/vc-branch simple-modeline-segment-misc-info simple-modeline-segment-process + acdw-modeline/god-mode-indicator acdw-modeline/minions simple-modeline-segment-major-mode)))) :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 @@ ;; modified from `simple-modeline' (defun acdw-modeline/modified () - "Displays a color-coded buffer modification/read-only + "Displays a color-coded buffer modification/read-only indicator in the mode-line." - (if (not (string-match-p "\\*.*\\*" (buffer-name))) - (let* ((read-only (and buffer-read-only (buffer-file-name))) - (modified (buffer-modified-p))) - (propertize - (if read-only " =" (if modified " +" " -")) - 'help-echo (format - (concat "Buffer is %s and %smodified\n" - "mouse-1: Toggle read-only status.") - (if read-only "read-only" "writable") - (if modified "" "not ")) - 'local-map (purecopy (simple-modeline-make-mouse-map - 'mouse-1 - (lambda (event) - (interactive "e") - (with-selected-window - (posn-window (event-start event)) - (read-only-mode 'toggle))))) - 'mouse-face 'mode-line-highlight)))) + (if (not (string-match-p "\\*.*\\*" (buffer-name))) + (let* ((read-only (and buffer-read-only (buffer-file-name))) + (modified (buffer-modified-p))) + (propertize + (if read-only " =" (if modified " +" " -")) + 'help-echo (format + (concat "Buffer is %s and %smodified\n" + "mouse-1: Toggle read-only status.") + (if read-only "read-only" "writable") + (if modified "" "not ")) + 'local-map (purecopy (simple-modeline-make-mouse-map + 'mouse-1 + (lambda (event) + (interactive "e") + (with-selected-window + (posn-window (event-start event)) + (read-only-mode 'toggle))))) + 'mouse-face 'mode-line-highlight)))) ;; all me, baby (defun acdw-modeline/minions () - "Display a button for `minions-minor-modes-menu'." - (concat - " " - (propertize - "&" - 'help-echo (format - "Minor modes menu\nmouse-1: show menu.") - 'local-map (purecopy (simple-modeline-make-mouse-map - 'mouse-1 - (lambda (event) - (interactive "e") - (with-selected-window (posn-window - (event-start event)) - (minions-minor-modes-menu))))) - 'mouse-face 'mode-line-highlight))) + "Display a button for `minions-minor-modes-menu'." + (concat + " " + (propertize + "&" + 'help-echo (format + "Minor modes menu\nmouse-1: show menu.") + 'local-map (purecopy (simple-modeline-make-mouse-map + 'mouse-1 + (lambda (event) + (interactive "e") + (with-selected-window (posn-window + (event-start event)) + (minions-minor-modes-menu))))) + 'mouse-face 'mode-line-highlight))) ;; from https://www.gonsie.com/blorg/modeline.html, from Doom (defun acdw-modeline/vc-branch () @@ -71,10 +71,15 @@ indicator in the mode-line." ;; from gonsie (defun acdw-modeline/buffer-name () (propertize " %b " - 'face - (if (buffer-modified-p) - 'font-lock-warning-face - 'font-lock-type-face) - 'help-echo (buffer-file-name))) + 'face + (if (buffer-modified-p) + 'font-lock-warning-face + 'font-lock-type-face) + 'help-echo (buffer-file-name))) + +;; god-mode indicator +(defun acdw-modeline/god-mode-indicator () + (when (bound-and-true-p god-local-mode) + " God")) (provide 'acdw-modeline) -- cgit 1.4.1-21-gabe81