Subject: bug#73775: 30.0.90; vtable: can't handle 0 data rows

From: Augusto Stoffel <[email-masked]>
Date: Sat, 12 Oct 2024 19:22:46 +0200

This call produces the error (wrong-number-of-arguments #<subr max> 0):

    (make-vtable
     :use-header-line nil
     :columns (mapcar (lambda (name) (list :name name :min-width 10))
     '("A" "B" "C"))
     :objects nil)

The following would get rid of the error, but the resulting table
misbehaves slightly (say when I press S on it to sort).  Perhaps someone
else has a better idea.

modified   lisp/emacs-lisp/vtable.el
@@ -861,9 +861,10 @@ vtable--compute-widths
                    (vtable--compute-width table (vtable-column-width column)))
               ;; Compute based on the displayed widths of
               ;; the data.
-              (seq-max (seq-map (lambda (elem)
+              (seq-max (or (seq-map (lambda (elem)
                                   (nth 1 (elt (cdr elem) index)))
-                                cache)))))
+                                    cache)
+                           '(0))))))
         ;; Let min-width/max-width specs have their say.
         (when-let ((min-width (and (vtable-column-min-width column)
                                    (vtable--compute-width