Subject: Re: bug#69454: Not possible to insert an empty vtable

From: Joost Kremers <[email-masked]>
Date: Sun, 05 May 2024 14:15:06 +0200

On Tue, Apr 30 2024, Joost Kremers wrote:
> On Sat, Mar 09 2024, Eli Zaretskii wrote:
>>> Date: Wed, 28 Feb 2024 15:29:11 +0100
>>> From: Eric Marsden <[email-masked]>
>>> 
>>> Hello,
>>> 
>>> The following generates an error. It seems to me that it would be 
>>> preferable to insert the header line and show zero rows for the vtable.
>>> 
>>>     (require 'vtable)
>>>     (make-vtable :columns '("tweedle" "dum") :objects (list))
>>> 
>>> Debugger entered--Lisp error: (wrong-number-of-arguments #<subr max> 0)
>>>    max()
>>>    apply(max nil)
>>>    seq-max(nil)
>>
> I ran into this same problem myself, trying to use vtable for my package
> Ebib[1]. I did some digging and found that the cause of the problem is not that
> the vtable is empty, but rather that the column widths cannot be determined.

As I just realised, the problem is actually bigger than that: given the current
implementation of vtable-insert-object, it's not possible to add objects to an
empty vtable. (Specifically, it uses nconc twice, once on the list of objects
and once the cache, both of which fail silently if those are nil, and it uses
setcar on the cache, which yields an error if the cache is nil.)

Just wanted to mention that here for completeness' sake, if anyone ever decides
to fix these issues. For now, the easiest thing to do is probably do disallow
empty vtables altogether.

-- 
Joost Kremers
Life has its moments