diff options
author | Case Duckworth | 2021-08-28 00:23:56 -0500 |
---|---|---|
committer | Case Duckworth | 2021-08-28 00:23:56 -0500 |
commit | 47df2733de3f5e5ba8384cc4e11a31235a9cfc5b (patch) | |
tree | 369c4e08945a46340a8ee39e5f38e4852335e7f8 | |
parent | Comment out all the things (with helpful-mode) (diff) | |
download | emacs-47df2733de3f5e5ba8384cc4e11a31235a9cfc5b.tar.gz emacs-47df2733de3f5e5ba8384cc4e11a31235a9cfc5b.zip |
Buttonize major mode in modeline
-rw-r--r-- | init.el | 2 | ||||
-rw-r--r-- | 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." | |||
1700 | acdw-modeline/winum | 1700 | acdw-modeline/winum |
1701 | acdw-modeline/minions | 1701 | acdw-modeline/minions |
1702 | acdw-modeline/narrowed | 1702 | acdw-modeline/narrowed |
1703 | simple-modeline-segment-major-mode))) | 1703 | acdw-modeline/major-mode))) |
1704 | 1704 | ||
1705 | ;; I've put in a pull request to add the (- 0 right-margin) bit here. | 1705 | ;; I've put in a pull request to add the (- 0 right-margin) bit here. |
1706 | (advice-add 'simple-modeline--format :override | 1706 | (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 @@ | |||
40 | (defun acdw-modeline/god-mode-indicator () | 40 | (defun acdw-modeline/god-mode-indicator () |
41 | "Display an indicator if `god-local-mode' is active." | 41 | "Display an indicator if `god-local-mode' is active." |
42 | (when (bound-and-true-p god-local-mode) | 42 | (when (bound-and-true-p god-local-mode) |
43 | " God")) | 43 | " Ω")) |
44 | |||
45 | (defun acdw-modeline/major-mode () | ||
46 | "Displays the current major mode in the mode-line." | ||
47 | (propertize | ||
48 | (concat " " | ||
49 | (or (and (boundp 'delighted-modes) | ||
50 | (cadr (assq major-mode delighted-modes))) | ||
51 | (format-mode-line mode-name))) | ||
52 | 'face 'bold | ||
53 | 'keymap mode-line-major-mode-keymap | ||
54 | 'mouse-face 'mode-line-highlight)) | ||
55 | |||
56 | (defun acdw-modeline/minions () ; by me | ||
57 | "Display a button for `minions-minor-modes-menu'." | ||
58 | (concat | ||
59 | " " | ||
60 | (propertize | ||
61 | "&" | ||
62 | 'help-echo (format | ||
63 | "Minor modes menu\nmouse-1: show menu.") | ||
64 | 'local-map (purecopy (simple-modeline-make-mouse-map | ||
65 | 'mouse-1 | ||
66 | (lambda (event) | ||
67 | (interactive "e") | ||
68 | (with-selected-window (posn-window | ||
69 | (event-start event)) | ||
70 | (minions-minor-modes-menu))))) | ||
71 | 'mouse-face 'mode-line-highlight))) | ||
44 | 72 | ||
45 | (defun acdw-modeline/modified () ; modified from `simple-modeline' | 73 | (defun acdw-modeline/modified () ; modified from `simple-modeline' |
46 | "Displays a color-coded buffer modification/read-only | 74 | "Displays a color-coded buffer modification/read-only |