Subject: bug#73775: closed (Re: bug#73775: 30.0.90; vtable: can't handle 0 data rows)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 09 Nov 2024 10:16:02 +0000

Your bug report

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

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
73775: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=73775
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#73775: 30.0.90; vtable: can't handle 0 data rows
From: Eli Zaretskii <[email-masked]>
To: Joost Kremers <[email-masked]>
Cc: [email-masked], [email-masked], [email-masked]
Date: Sat, 09 Nov 2024 12:15:38 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

> From: Joost Kremers <[email-masked]>
> Cc: [email-masked],  [email-masked],  [email-masked]
> Date: Wed, 06 Nov 2024 09:53:14 +0100
> 
> On Thu, Oct 31 2024, Eli Zaretskii wrote:
> [empty vtable patches]
> > Thanks.  I wanted to install this, but at least the first patch no
> > longer applies; could you please rebase and resubmit?  When you do,
> > please mention the bug number in all the commit log messages.
> 
> Here are the updated patches, including the documentation changes you
> requested and the when-let --> when-let* conversion.

Thanks, installed on the master branch, and closing the bug.

Subject: 30.0.90; vtable: can't handle 0 data rows
From: Augusto Stoffel <[email-masked]>
To: [email-masked]
Date: Sat, 12 Oct 2024 19:22:46 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

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