Function: dirvish--render-attrs-1
dirvish--render-attrs-1 is a natively compiled function defined in
dirvish.el.
Signature
(dirvish--render-attrs-1 HEIGHT WIDTH POS REMOTE FNS ALIGN-TO HL W-WIDTH)
Documentation
HEIGHT WIDTH POS REMOTE FNS ALIGN-TO HL W-WIDTH.
Source Code
;; Defined in /nix/store/1gijwny2yx4fggrsb9l110h1ybs1gdk5-emacs-packages-deps/share/emacs/site-lisp/elpa/dirvish-20260725.1520/dirvish.el
(defun dirvish--render-attrs-1
(height width pos remote fns align-to hl w-width)
"HEIGHT WIDTH POS REMOTE FNS ALIGN-TO HL W-WIDTH."
;; jump over subdir header lines where `forward-line' is ignored
(when (cdr dired-subdir-alist) (goto-char (window-start)))
(forward-line (- 0 height))
(cl-dotimes (_ (* 2 height))
(when (eobp) (cl-return))
(let ((f-beg (dired-move-to-filename))
(f-end (dired-move-to-end-of-filename t))
(l-beg (line-beginning-position)) (l-end (line-end-position))
(f-wid 0) f-str f-name f-attrs f-type hl-face left right f-line?)
(setq hl-face (and (eq (or f-beg l-beg) pos) hl))
(when (setq f-line? (and f-beg f-end (eq (char-after l-end) 10)))
(setq f-str (buffer-substring f-beg f-end)
f-wid (string-width f-str)
f-name (concat (if remote (dired-current-directory)
(file-local-name (dired-current-directory)))
f-str)
f-attrs (dirvish-attribute-cache f-name :builtin
(unless remote (ignore-errors (file-attributes f-name))))
f-type (dirvish-attribute-cache f-name :type
(let ((ch (progn (back-to-indentation) (char-after))))
(cond ; ASCII: d -> 100, l -> 108, LF(\n) -> 10
(remote `(,(if (eq ch 100) 'dir 'file) . nil))
((eq ch 100) '(dir . nil))
((eq ch 108) ; use slash for dir check is unreliable
`(,(if (file-directory-p f-name) 'dir 'file) .
,(buffer-substring (+ f-end 4) l-end)))
(t '(file . nil))))))
(unless (get-text-property f-beg 'mouse-face)
(dired-insert-set-properties l-beg l-end)))
(cl-loop
for fn in (if f-line? fns '(dirvish-attribute-hl-line-rd))
for (k . v) = (funcall fn f-beg f-end f-str f-name
f-attrs f-type l-beg l-end hl-face w-width)
do (pcase k ('ov (overlay-put v 'dirvish-a-ov t))
('ovs (dolist (ov v) (overlay-put ov 'dirvish-a-ov t)))
('left (setq left (concat v left)))
('right (setq right (concat v right))))
finally
(prog1 (unless (or left right) (cl-return))
(let* ((len1 (string-width (or right "")))
(remain (- width len1
(or (get-text-property l-beg 'line-prefix) 0)))
(len2 (min (length left) (max 0 (- remain f-wid 1))))
(ovl (make-overlay f-end f-end))
(r-pos (if (> remain f-wid) l-end
(let ((end (+ f-beg remain))
(offset (- f-wid (length f-str))))
(- end offset))))
(spec `(space :align-to (- right-fringe ,len1 ,align-to)))
(spc (propertize " " 'display spec 'face hl-face))
(ovr (make-overlay r-pos r-pos)))
(overlay-put ovl 'dirvish-l-ov t)
(overlay-put ovl 'after-string (substring (or left "") 0 len2))
(overlay-put ovr 'dirvish-r-ov t)
(overlay-put ovr 'after-string (concat spc right))))))
(forward-line 1)))