Is there a way to position a value on the the right end of the modeline?
From my understanding currently the modeline "pushes" its values farther right if the values increase in size. I would prefer it if some values would start on the right side and expand into the middle.
I have tried solutions like powerline, but they seem rather distracting and more complicated in setup to display the same amount of informatioon as the standard modeline.
Here is one way to do it. The trick is to add spaces until the end of the line minus the place needed to display your text (extracted from powerline code on the emacs wiki):
(defun mode-line-fill (face reserve)
"Return empty space using FACE and leaving RESERVE space on the right."
(unless reserve
(setq reserve 20))
(when (and window-system (eq 'right (get-scroll-bar-mode)))
(setq reserve (- reserve 3)))
(propertize " "
'display `((space :align-to (- (+ right right-fringe right-margin) ,reserve)))
'face face))
;; Set the modeline to tell me the filename, hostname, etc..
(setq-default mode-line-format (list
" "
mode-line-mule-info
'mode-line-modified
"- "
'mode-line-buffer-identification
" (%l, %c) "
'mode-line-modes
" -- "
`(vc-mode vc-mode)
;; Fill until the end of line but 10 characters
(mode-line-fill 'mode-line 10)
"Some text"
)
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With