diff options
Diffstat (limited to 'modeline.el')
-rw-r--r-- | modeline.el | 52 |
1 files changed, 43 insertions, 9 deletions
diff --git a/modeline.el b/modeline.el index ee2c0fd..3af386b 100644 --- a/modeline.el +++ b/modeline.el @@ -24,7 +24,7 @@ ;;; Code: -(defvar modeline-right-offset 6 +(defvar modeline-right-offset 15 "An offset to adjust the modeline alignment.") ;;;###autoload @@ -34,15 +34,17 @@ (right (string-trim-right (modeline-format-right))) (left-len (string-pixel-width left)) (right-len (string-pixel-width right)) + (el-doc-len (string-pixel-width eldoc-mode-line-string)) + (middle-len (max (- (window-pixel-width) + left-len right-len el-doc-len + (- modeline-right-offset)) + 0)) (middle (propertize (string 32) 'display (list 'space - :width - (list - (- (window-pixel-width) left-len right-len - (- modeline-right-offset))))))) + :width (list middle-len))))) (concat left middle right))) (setq-default mode-line-format '("%e" (:eval (modeline-format-main)))) @@ -54,15 +56,18 @@ (right (string-trim-right (modeline-dashboard-format-right))) (left-len (string-pixel-width left)) (right-len (string-pixel-width right)) + (el-doc-len (string-pixel-width eldoc-mode-line-string)) + (middle-len (max (- (window-pixel-width) + left-len right-len el-doc-len + (- modeline-right-offset)) + 0)) (middle (propertize (string 32) 'display (list 'space :width - (list - (- (window-pixel-width) left-len right-len - (- modeline-right-offset))))))) + (list middle-len))))) (concat left middle right))) ;;;###autoload @@ -90,6 +95,35 @@ (format-mode-line global-mode-string face))))) ;;;###autoload +(defun modeline-format-gnus () + "The mode line format for GNUS." + (let* ((left (modeline-gnus-format-left)) + (right (string-trim-right (modeline-format-right))) + (left-len (string-pixel-width left)) + (right-len (string-pixel-width right)) + (middle (propertize + (string 32) + 'display + (list + 'space + :width + (list + (- (window-pixel-width) left-len right-len + (- modeline-right-offset))))))) + (concat left middle right))) + +(defun modeline-gnus-format-left () + "The left part of the mode line for GNUS." + (declare (side-effect-free t) (pure t)) + (concat + (modeline-spc) + (modeline-format-buffer-name) + (modeline-spc) + (modeline-format-keycast) + (modeline-spc) + (modeline-format-minor-modes))) + +;;;###autoload (defun modeline-format-left () "The left mode line format." (concat @@ -578,7 +612,7 @@ string in the mode line.") ('mode-line-inactive)))) (concat (modeline-propertize - (format-mode-line '("%m") face) + (format-mode-line (list mode-name) face) nil "Major mode\nmouse-1: Display major mode menu\nmouse-2:\ Show help for major mode\nmouse-3: Toggle minor modes" |