From: Adam Porter <adam@alphapapa.net>
To: Eli Zaretskii <eliz@gnu.org>,
Eric Marsden <eric.marsden@risk-engineering.org>,
Lars Ingebrigtsen <larsi@gnus.org>
Cc: 69454@debbugs.gnu.org
Subject: bug#69454: Not possible to insert an empty vtable
Date: Mon, 11 Mar 2024 14:57:20 -0500 [thread overview]
Message-ID: <f4afce38-24db-4932-b3de-b947dd805323@alphapapa.net> (raw)
In-Reply-To: <86plw3yecs.fsf@gnu.org>
Hi Eli,
> P.S. Adam, I took the liberty of adding you to this discussion, since
> you seem lately to be interested in vtable.
Thanks for adding me. Indeed, I've found vtable to be very useful in my
new listen.el package.
On 3/9/24 02:54, Eli Zaretskii wrote:
>> Date: Wed, 28 Feb 2024 15:29:11 +0100
>> From: Eric Marsden <eric.marsden@risk-engineering.org>
>>
>> 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'm not sure we want to support zero-size vtables. A better error
> message would be nice, though. What do others think?
I tend to agree with Eric that it would be helpful if vtable could
handle having an empty objects collection value to insert, because it
saves the application from having to wrap the rather large `make-vtable'
form in a `when' block, like here:
https://github.com/alphapapa/listen.el/blob/e9ea67350cf3b6cd870561c5e52d4b5255b04d34/listen-queue.el#L135
Also, it's possible that, after inserting a vtable, the collection of
objects may be modified so that the collection is empty--then if the the
vtable is reverted, it should be able to handle the case of the
collection being empty.
AFAICT there's not much the application could do to avoid errors in that
case, other than working outside of vtable's revert API and calling the
function that tested the collection and conditionally inserted the
vtable in the first place--in which case the vtable revert API would
seem useless.
So IMO, when inserting or reverting a vtable, vtable ought to check
whether the collection is empty; and if so, handle it gracefully,
meaning that an "empty vtable" (whatever that would mean; maybe just one
line of text saying that it's an empty collection) would still be
inserted, and that if the collection became non-nil, it could be
reverted and displayed properly.
next prev parent reply other threads:[~2024-03-11 19:57 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-28 14:29 bug#69454: Not possible to insert an empty vtable Eric Marsden
2024-03-09 8:54 ` Eli Zaretskii
2024-03-11 19:57 ` Adam Porter [this message]
2024-03-14 9:37 ` Eli Zaretskii
2024-03-16 0:14 ` Adam Porter
2024-04-30 9:10 ` Joost Kremers
2024-04-30 12:14 ` Eli Zaretskii
[not found] ` <8f5fb814-5d88-4ad3-b12a-8246325d5d21@alphapapa.net>
2024-05-01 11:54 ` Eli Zaretskii
2024-05-02 7:31 ` Joost Kremers
2024-05-05 12:15 ` Joost Kremers
2024-05-30 21:40 ` Joost Kremers
2024-05-30 21:52 ` Joost Kremers
2024-05-31 5:24 ` Eli Zaretskii
2024-05-31 6:54 ` Joost Kremers
2024-06-02 17:49 ` Adam Porter
2024-06-03 12:13 ` Joost Kremers
2024-06-08 12:34 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f4afce38-24db-4932-b3de-b947dd805323@alphapapa.net \
--to=adam@alphapapa.net \
--cc=69454@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=eric.marsden@risk-engineering.org \
--cc=larsi@gnus.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).