From ebfc7ae51895d7dc468c737f2fe403fbd398d5e8 Mon Sep 17 00:00:00 2001 From: Joost Kremers Date: Mon, 3 Jun 2024 14:07:43 +0200 Subject: [PATCH 4/4] Update vtable documentation and NEWS * doc/misc/vtable.texi: Add note about empty vtables; add note about column width in empty vtables. * etc/NEWS: Add note about empty vtables. --- doc/misc/vtable.texi | 11 +++++++++++ etc/NEWS | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/doc/misc/vtable.texi b/doc/misc/vtable.texi index 6003435385f..061547f5deb 100644 --- a/doc/misc/vtable.texi +++ b/doc/misc/vtable.texi @@ -264,6 +264,10 @@ Making A Table more elements in the sequence than there is in @code{:columns}, only the @code{:columns} first elements are displayed. +If the @code{:objects} list is empty (and no @code{:objects-function} is +defined), an empty vtable is created. In this case, a @code{:columns} +spec must be provided. + @item :objects-function It's often convenient to generate the objects dynamically (for instance, to make reversion work automatically). In that case, this @@ -295,6 +299,11 @@ Making A Table @var{n} percent of the window's width. @end table +If no @code{width} is provided, the width is calculated based on the +column data (provided in the @code{:objects} list or through the +@code{:objects-function}) or, if there is no data, on the basis of the +window width. + @item min-width This uses the same format as @code{width}, but specifies the minimum width (and overrides @code{width} if @code{width} is smaller than this. @@ -569,6 +578,8 @@ Interface Functions index is too small, or appended if it is too large. In this case, @var{before} is ignored. +If @var{table} is empty, @var{location} and @var{before} are ignored. + This also updates the displayed table. @end defun diff --git a/etc/NEWS b/etc/NEWS index 5a1f7f3e443..7089b27ed75 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2806,6 +2806,14 @@ this was not possible.) In addition, LOCATION can be an integer, a (zero-based) index into the table at which the new object is inserted (BEFORE is ignored in this case). +** 'make-vtable' can create empty vtable +It is now possible to create a vtable without data, by leaving the +':objects' list empty, or by providing a ':objects-function' that +(initially) produces no data. In such a case, it is necessary to +provide a ':columns' spec, so that the number of columns and their +widths can be determined. Columns widths can be set explicitly, or they +will be calculated based on the window width. + ** JSON --- -- 2.45.2