From 222a20c7c1cc93e8eb4efc71505ca1ce3313ed3c Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Fri, 6 May 2022 13:16:16 -0500 Subject: Further modeline changes --- lisp/+modeline.el | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) (limited to 'lisp/+modeline.el') diff --git a/lisp/+modeline.el b/lisp/+modeline.el index e5b5bc6..df9d504 100644 --- a/lisp/+modeline.el +++ b/lisp/+modeline.el @@ -126,9 +126,18 @@ and appended with `truncate-string-ellipsis'." (propertize ;; (+string-truncate (format-mode-line mode-name) 16) (format-mode-line mode-name) 'face 'font-lock-keyword-face - 'keymap mode-line-major-mode-keymap - 'help-echo (concat (format-mode-line mode-name) - " mode\nmouse-1: show menu.") + 'keymap (let ((map (make-sparse-keymap))) + (bindings--define-key map [mode-line down-mouse-1] + `(menu-item "Menu Bar" ignore + :filter ,(lambda (_) (mouse-menu-major-mode-map)))) + (define-key map [mode-line mouse-2] 'describe-mode) + (bindings--define-key map [mode-line down-mouse-3] + `(menu-item "Minions" minions-minor-modes-menu)) + map) + 'help-echo (+concat (list (format-mode-line mode-name) " mode") + "mouse-1: show menu" + "mouse-2: describe mode" + "mouse-3: display minor modes") 'mouse-face 'mode-line-highlight))) (defcustom +modeline-modified-icon-alist '((ephemeral . "*") @@ -302,9 +311,10 @@ The order of elements matters: whichever one matches first is applied." (defun +modeline-line-column (&optional spacer) ; adapted from `simple-modeline' "Display the current cursor line and column depending on modes." - (funcall (+modeline-concat '(+modeline-line - +modeline-column) - "|"))) + (concat (or spacer +modeline-default-spacer) + (+modeline-line "") + "|" + (+modeline-column ""))) (defcustom +modeline-position-function nil "Function to use instead of `+modeline-position' in modeline." @@ -312,17 +322,16 @@ The order of elements matters: whichever one matches first is applied." function) :local t) -(defun +modeline-position (&optional _) +(defun +modeline-position (&optional spacer) "Display the current cursor position. See `line-number-mode', `column-number-mode', and `file-percentage-mode'. If `+modeline-position-function' is set to a function in the current buffer, call that function instead." - (funcall (if +modeline-position-function - +modeline-position-function - (+modeline-concat '(+modeline-region - +modeline-line-column - ;; +modeline-file-percentage - ))))) + (concat (or spacer +modeline-default-spacer) + (if +modeline-position-function + (funcall +modeline-position-function) + (concat (+modeline-region) + (+modeline-line-column))))) (defun +modeline-vc (&optional spacer) "Display the version control branch of the current buffer in the modeline." -- cgit 1.4.1-21-gabe81