Function: dirvish--mode-line-composer
dirvish--mode-line-composer is a natively compiled function defined in
dirvish.el.
Signature
(dirvish--mode-line-composer LEFT RIGHT &optional HEADER)
Documentation
Compose mode-line-format from LEFT and RIGHT segments.
If HEADER, the format is used for header-line-format.
Source Code
;; Defined in /nix/store/1gijwny2yx4fggrsb9l110h1ybs1gdk5-emacs-packages-deps/share/emacs/site-lisp/elpa/dirvish-20260725.1520/dirvish.el
(defun dirvish--mode-line-composer (left right &optional header)
"Compose `mode-line-format' from LEFT and RIGHT segments.
If HEADER, the format is used for `header-line-format'."
`((:eval
(let* ((dv (dirvish-curr))
(fullframe-p (and dv (dv-curr-layout dv)))
(buf (if fullframe-p (cdr (dv-index dv)) (current-buffer)))
(expand
(lambda (segs)
(cl-loop for s in segs collect
(if (stringp s) s
`(:eval (,(intern (format "dirvish-%s-ml" s))))))))
(face ',(if header 'header-line 'mode-line-inactive))
(default (face-attribute 'default :height))
(ml-height (face-attribute face :height))
(scale (cond ((floatp ml-height) ml-height)
((integerp ml-height) (/ (float ml-height) default))
(t 1)))
(win-width (floor (/ (window-width) scale)))
(str-l (if dv " DIRVISH: context buffer is a killed buffer"
" DIRVISH: failed to get current session"))
(str-r (propertize "WARNING " 'face 'dired-warning))
(len-r 8))
(when (buffer-live-p buf)
(setq str-l (format-mode-line (funcall expand ',left) nil nil buf))
(setq str-r (format-mode-line (funcall expand ',right) nil nil buf))
(setq len-r (string-width str-r)))
(concat
(dirvish--mode-line-bar-img fullframe-p ,header)
(if (< (+ (string-width str-l) len-r) win-width)
str-l
(let ((trim (1- (- win-width len-r))))
(if (>= trim 0)
(substring str-l 0 (min trim (1- (length str-l))))
"")))
(propertize
" " 'display `((space :align-to (- (+ right right-fringe right-margin)
,(ceiling (* scale len-r))))))
str-r)))))