Further modeline changes

This commit is contained in:
Case Duckworth 2022-05-06 13:16:16 -05:00
parent eaa1c58e1b
commit 222a20c7c1
2 changed files with 23 additions and 16 deletions

View File

@ -2257,9 +2257,7 @@
",")
+modeline-input-method
+modeline-position
,(+modeline-concat
'(+modeline-minions
+modeline-major-mode))
+modeline-major-mode
+modeline-file-percentage
)))
(simple-modeline-mode +1))

View File

@ -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."