From 47df2733de3f5e5ba8384cc4e11a31235a9cfc5b Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sat, 28 Aug 2021 00:23:56 -0500 Subject: Buttonize major mode in modeline --- init.el | 2 +- lisp/acdw-modeline.el | 30 +++++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/init.el b/init.el index 04abefa..e174823 100644 --- a/init.el +++ b/init.el @@ -1700,7 +1700,7 @@ successive invocations." acdw-modeline/winum acdw-modeline/minions acdw-modeline/narrowed - simple-modeline-segment-major-mode))) + acdw-modeline/major-mode))) ;; I've put in a pull request to add the (- 0 right-margin) bit here. (advice-add 'simple-modeline--format :override diff --git a/lisp/acdw-modeline.el b/lisp/acdw-modeline.el index 5784148..00eb056 100644 --- a/lisp/acdw-modeline.el +++ b/lisp/acdw-modeline.el @@ -40,7 +40,35 @@ (defun acdw-modeline/god-mode-indicator () "Display an indicator if `god-local-mode' is active." (when (bound-and-true-p god-local-mode) - " God")) + " Ω")) + +(defun acdw-modeline/major-mode () + "Displays the current major mode in the mode-line." + (propertize + (concat " " + (or (and (boundp 'delighted-modes) + (cadr (assq major-mode delighted-modes))) + (format-mode-line mode-name))) + 'face 'bold + 'keymap mode-line-major-mode-keymap + 'mouse-face 'mode-line-highlight)) + +(defun acdw-modeline/minions () ; by me + "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))) (defun acdw-modeline/modified () ; modified from `simple-modeline' "Displays a color-coded buffer modification/read-only -- cgit 1.4.1-21-gabe81