Function: vtable--compute-widths

vtable--compute-widths is a byte-compiled function defined in vtable.el.gz.

Signature

(vtable--compute-widths TABLE CACHE)

Documentation

Compute the display widths for TABLE.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/vtable.el.gz
(defun vtable--compute-widths (table cache)
  "Compute the display widths for TABLE."
  (seq-into
   (seq-map-indexed
    (lambda (column index)
      (let ((width
             (or
              ;; Explicit widths.
              (and (vtable-column-width column)
                   (vtable--compute-width table (vtable-column-width column)))
              ;; Compute based on the displayed widths of
              ;; the data.
              (seq-max (seq-map (lambda (elem)
                                  (nth 1 (elt (cdr elem) index)))
                                cache)))))
        ;; Let min-width/max-width specs have their say.
        (when-let ((min-width (and (vtable-column-min-width column)
                                   (vtable--compute-width
                                    table (vtable-column-min-width column)))))
          (setq width (max width min-width)))
        (when-let ((max-width (and (vtable-column-max-width column)
                                   (vtable--compute-width
                                    table (vtable-column-max-width column)))))
          (setq width (min width max-width)))
        width))
    (vtable-columns table))
   'vector))