From unknown Fri Aug 15 20:54:25 2025 X-Loop: help-debbugs@gnu.org Subject: bug#73775: 30.0.90; vtable: can't handle 0 data rows Resent-From: Augusto Stoffel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 12 Oct 2024 17:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 73775 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 73775@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.172875379423473 (code B ref -1); Sat, 12 Oct 2024 17:24:02 +0000 Received: (at submit) by debbugs.gnu.org; 12 Oct 2024 17:23:14 +0000 Received: from localhost ([127.0.0.1]:53563 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1szfpi-00066V-AU for submit@debbugs.gnu.org; Sat, 12 Oct 2024 13:23:14 -0400 Received: from lists.gnu.org ([209.51.188.17]:51022) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1szfpg-00066M-24 for submit@debbugs.gnu.org; Sat, 12 Oct 2024 13:23:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1szfpR-0005IP-Af for bug-gnu-emacs@gnu.org; Sat, 12 Oct 2024 13:22:57 -0400 Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1szfpP-0007hL-1Q for bug-gnu-emacs@gnu.org; Sat, 12 Oct 2024 13:22:57 -0400 Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-5c9428152c0so3245980a12.1 for ; Sat, 12 Oct 2024 10:22:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728753771; x=1729358571; darn=gnu.org; h=mime-version:user-agent:message-id:date:subject:to:from:from:to:cc :subject:date:message-id:reply-to; bh=G4K9nJ9XhVqrMiN4BGAea9aln8t7o4hJsaXHP3mBLjI=; b=eHPqkJf0ERKBr1UtZV82zvW8O2kGY8EQfHd2ww2I1hTJHvxDkITqk1scGvpxTWGGKw uh9gPYnyZycHjcui7PeIPAYtuH4pd33a2tcVSUlMzhEb8LZpPUrANTBseUxUdw+vQzNm 9KJU14SxDVy3VQOVPenY85aeAaxO2BTNYNF+Gd+yBIptgF9AOSDPvBomFE2GgYWFS75F 1AML7n0oFgKbEulJ1iVJy1WTI7v6x5LGZbd82tg+YFSLBM2gx8SK8ryGflyCqBBylRHn NPORDD3yJowu1u7O9+UOfdLX8xs61ntsUsq0kI02fGgdHi7IjxOTlq+M/exzeWo5cDew Bs0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728753771; x=1729358571; h=mime-version:user-agent:message-id:date:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=G4K9nJ9XhVqrMiN4BGAea9aln8t7o4hJsaXHP3mBLjI=; b=gnJR5/xs0eKQ4pVjreegQrUZ1MGRs9s1cWb/6++wZ3BZc4MgUOwesuHfa05EMxjviT N9+nUimXBoAN8qk7bb6GpM2qer5cEoVSbYPK6TKb5mJ6m2xXWoF9PPt62Yxt1mS4IzFQ NXVI/RLqdd3CiiLh2f0NqmIT3tidYc/EXZRO5yEn2nua8mH4E/p3024iWVB4J/2ALXxH e+t1J8NAOyd9tR/628wK1Dl8Lc2c9rPquHCz7dJJPYHEXErXRzYNDuA4nhFLlX42RQmr l4+oKkkrRAeCUyj2mS8E9MNA9hp2TzbxG0jQ1T5GkFED5aaWQivy6uCUPBl85jviHSj4 OEHw== X-Gm-Message-State: AOJu0YxRGGhCWpkNCdKxtGhoIQt/8fRjVbZk15tI7UmTHO+IthjFDte6 l508Ot1gYA4E9D2DseUYQxE7+rQ1QCBdVVxvmN88M07O7UqveJqx4lQhmg== X-Google-Smtp-Source: AGHT+IGFd6Ej+sEeOKWdpxWlPtQ71eEgO+BLxyDOaAqdgLLWm1KQ+lkvZElSA5GrPOwoAaVs8rADhQ== X-Received: by 2002:a05:6402:5c8:b0:5c9:6312:afab with SMTP id 4fb4d7f45d1cf-5c96312b56bmr1327448a12.36.1728753770537; Sat, 12 Oct 2024 10:22:50 -0700 (PDT) Received: from ars3 ([2a02:8109:8a87:ff00::d6f6]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c9370d273fsm3157130a12.16.2024.10.12.10.22.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Oct 2024 10:22:48 -0700 (PDT) From: Augusto Stoffel Date: Sat, 12 Oct 2024 19:22:46 +0200 Message-ID: <87ttdhdymx.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2a00:1450:4864:20::533; envelope-from=arstoffel@gmail.com; helo=mail-ed1-x533.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) This call produces the error (wrong-number-of-arguments # 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 From unknown Fri Aug 15 20:54:25 2025 X-Loop: help-debbugs@gnu.org Subject: bug#73775: 30.0.90; vtable: can't handle 0 data rows Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 12 Oct 2024 18:41:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73775 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Augusto Stoffel , Adam Porter Cc: 73775@debbugs.gnu.org Received: via spool by 73775-submit@debbugs.gnu.org id=B73775.17287584129614 (code B ref 73775); Sat, 12 Oct 2024 18:41:04 +0000 Received: (at 73775) by debbugs.gnu.org; 12 Oct 2024 18:40:12 +0000 Received: from localhost ([127.0.0.1]:56650 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1szh2B-0002Uu-R4 for submit@debbugs.gnu.org; Sat, 12 Oct 2024 14:40:12 -0400 Received: from eggs.gnu.org ([209.51.188.92]:42794) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1szh27-0002Th-Gr for 73775@debbugs.gnu.org; Sat, 12 Oct 2024 14:40:07 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1szgmr-000672-8O; Sat, 12 Oct 2024 14:24:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=Rf/qVfqpu+q8fUL3lRrIVSZrCEdiayeiIyQQ8OkCokQ=; b=FdFmdu68P0mZ 5qn3T41JZInVVV36w4/+YW3P7BtFNeYHPpJ3L5Xy8BxBeb2sSPfOrO01PJugacN8TMy4syD9A3LS8 j9ayevOaklNt7nthQOol5CBtU1CpeYXdDTOswqZ29O2rTRZZcTv6LxNnHexgKDkCyLqOya6hpeREv PEFE5nGAvtVY2C5AlueR/dZ5MQxrt8c2tUpqHXpY75UfWoEx0Uqd2D7+Vs1/jELc6r5iwrCIClV6H FhqBsw5k5RkymMWvQGMT6Jkbc03wdK1AU4MKUNY41JeCezZcpzA0lna1rsYSz8ldXWaRt/h2RpIYv q9CACYiKEhqo/AXkxcOJjw==; Date: Sat, 12 Oct 2024 21:24:18 +0300 Message-Id: <86jzeduqlp.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <87ttdhdymx.fsf@gmail.com> (message from Augusto Stoffel on Sat, 12 Oct 2024 19:22:46 +0200) References: <87ttdhdymx.fsf@gmail.com> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Augusto Stoffel > Date: Sat, 12 Oct 2024 19:22:46 +0200 > > This call produces the error (wrong-number-of-arguments # 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 > > Adam, any comments or suggestions? From unknown Fri Aug 15 20:54:25 2025 X-Loop: help-debbugs@gnu.org Subject: bug#73775: 30.0.90; vtable: can't handle 0 data rows Resent-From: Adam Porter Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 13 Oct 2024 00:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73775 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii , Augusto Stoffel Cc: 73775@debbugs.gnu.org Received: via spool by 73775-submit@debbugs.gnu.org id=B73775.172877839127772 (code B ref 73775); Sun, 13 Oct 2024 00:14:01 +0000 Received: (at 73775) by debbugs.gnu.org; 13 Oct 2024 00:13:11 +0000 Received: from localhost ([127.0.0.1]:42545 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1szmER-0007Dq-6b for submit@debbugs.gnu.org; Sat, 12 Oct 2024 20:13:11 -0400 Received: from cyan.ash.relay.mailchannels.net ([23.83.222.47]:11147) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1szmEP-0007Dc-2l for 73775@debbugs.gnu.org; Sat, 12 Oct 2024 20:13:10 -0400 X-Sender-Id: dreamhost|x-authsender|adam@alphapapa.net Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id A96D1247B1; Sun, 13 Oct 2024 00:12:52 +0000 (UTC) Received: from pdx1-sub0-mail-a256.dreamhost.com (100-101-192-204.trex-nlb.outbound.svc.cluster.local [100.101.192.204]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 408E724598; Sun, 13 Oct 2024 00:12:52 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1728778372; a=rsa-sha256; cv=none; b=wl/i0CdqIA5niZBKIfjdRJBzTDw9AsHez6nd3lAL2ig3j7xRZpVA5N1CQiPxqR+UFKu07S 5nh95ks/BNDWO5RXwvQtnu0MQAmB4pTevVxfcnLo5yvzZ/Rz6v2i4ULPXAz6Oh9t1mX1o0 R/3HgSu95SFC8LVdZ2grz47zvBjj3hLrT1nP/ALJLvIItuU9rHzbjOtWmQKX+Yuvluyaor uXG5wzFkw3enndJMeaMqnqezttAQYSG7UX5nXrOrXHZDASRAz+g/yU4ypy0nQCUHelJOeQ +d4DcIrO5QZIjC+pu4ZT1RB5wr5mGtORihRR84mss7W1W48rxof8MAIF33+16g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1728778372; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=tC7B1n0D2f8ZypowaQjq+IThGppSZOBH22zvX6vXCsc=; b=2YOqhVetjclUd9AAgFqhzR/OUVi6VOGKU5iiymTD2NlNHQh0zGrDy46jvZ+teWnehqwqBQ ZR0R1xIpOEl5pAL/DRz/O+gfneZiG8DYUj26q42Pa+2t3RN9+lzOMNumqsbiFiTCAplgP1 sA7/+y0//jwRS9Jox0abjnburg13OatV6W3OmT86X+hLg3xfnkH0Cv8hbgu+NkcnTFVldG NjCdzAP1uLKFtTcoNcqZNTX1+RU9ignBVWzumG9awbJBa7pmNnki6FaVRin8F7n6MKr8X+ qQyxzykZzk+INYpcqUz2KJtc42tgDQQiWpWqScchdRoPSoXRYM+IBLPSz1NVmQ== ARC-Authentication-Results: i=1; rspamd-6b8cf4b767-645xn; auth=pass smtp.auth=dreamhost smtp.mailfrom=adam@alphapapa.net X-Sender-Id: dreamhost|x-authsender|adam@alphapapa.net X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|adam@alphapapa.net X-MailChannels-Auth-Id: dreamhost X-Drop-Zesty: 5ecf2cfb6e91b5a4_1728778372482_2716231876 X-MC-Loop-Signature: 1728778372482:2044527983 X-MC-Ingress-Time: 1728778372482 Received: from pdx1-sub0-mail-a256.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.101.192.204 (trex/7.0.2); Sun, 13 Oct 2024 00:12:52 +0000 Received: from [10.66.59.93] (unknown [91.193.232.98]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: adam@alphapapa.net) by pdx1-sub0-mail-a256.dreamhost.com (Postfix) with ESMTPSA id 4XR15v4z0szL7; Sat, 12 Oct 2024 17:12:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alphapapa.net; s=dreamhost; t=1728778372; bh=tC7B1n0D2f8ZypowaQjq+IThGppSZOBH22zvX6vXCsc=; h=Date:Subject:To:Cc:From:Content-Type:Content-Transfer-Encoding; b=FJ6opTFkaOjNACfYKIldjGU+bm0Hs5DMUZ3C3pRPG3tqpHnPUgMR4Q7pqXQ6NtKH3 LPuEfAceglvxyOkOV2npT798/QfvzkZ/PJ3BjvjihofkOIxnHH7pNw8uN0Hvyx2+xu q7FCWnD2U9hmx6xUBZZZGo+/9RGFwL+dDZ5zFB42pmAMO0OJRZ2lzYmE3E2TSKyd1n LEf1LQmhS/vZZNdsVNSrR7P8b3ODL6MDQnJe1llL5XE03E/6sSSj+aZurJ8Mj1iFoG QEGWWlxQQvdBnZS1C+z409IU7v94JXl7TMDhwWWIKVpLOxQnRf4fZx6VjYlnWDd2Kz YwSzOe13sTgpQ== Message-ID: <04511bb6-0832-47af-8067-2d44ed790f52@alphapapa.net> Date: Sat, 12 Oct 2024 19:12:50 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird References: <87ttdhdymx.fsf@gmail.com> <86jzeduqlp.fsf@gnu.org> Content-Language: en-US From: Adam Porter In-Reply-To: <86jzeduqlp.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.3 (/) Hi Eli, Augusto, On 10/12/24 13:24, Eli Zaretskii wrote: >> From: Augusto Stoffel >> Date: Sat, 12 Oct 2024 19:22:46 +0200 >> >> This call produces the error (wrong-number-of-arguments # 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 >> >> > > Adam, any comments or suggestions? I may be mistaken, but this seems like a duplicate of bug#69454. --Adam From unknown Fri Aug 15 20:54:25 2025 X-Loop: help-debbugs@gnu.org Subject: bug#73775: 30.0.90; vtable: can't handle 0 data rows Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 13 Oct 2024 05:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73775 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Adam Porter , Joost Kremers Cc: 73775@debbugs.gnu.org, arstoffel@gmail.com Received: via spool by 73775-submit@debbugs.gnu.org id=B73775.17287972613555 (code B ref 73775); Sun, 13 Oct 2024 05:28:02 +0000 Received: (at 73775) by debbugs.gnu.org; 13 Oct 2024 05:27:41 +0000 Received: from localhost ([127.0.0.1]:49913 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1szr8n-0000vH-Dq for submit@debbugs.gnu.org; Sun, 13 Oct 2024 01:27:41 -0400 Received: from eggs.gnu.org ([209.51.188.92]:48976) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1szr8k-0000v3-SM for 73775@debbugs.gnu.org; Sun, 13 Oct 2024 01:27:39 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1szr8P-0003IV-Qt; Sun, 13 Oct 2024 01:27:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=nrvHehqfRUvFLXBcyiFlQ9ZqssuB7FYiw/h1hIcmjlw=; b=XATQ+j7kS39T zTFn29VOHnD0Gf2QZFFJp9ztObekcpxVeFoUu8i/saDJTHnh1eiGyER2VsmKdHTRd8fBHPxdeYE0T e+5C9qpmw4HwzzyoN3lY6PkH/80t6Izzjm23n4+Zhk57RxVtBXkVOHY1d8rBuDntHNW1MP1nKzrBK T4gJZLfs56ASxZEBgZKm4gmyCRHfZIj987pRbkYU1gb6MbE6MTKj6TgPJ/esomvtmKgKZBSmcgTIQ NnwutLmXKRvFgS13bP/jIQHFrFHbMvZmOlBrPMkbXyyVCIjt1AZXSMi+a8/7J7+Qim4Fr8AbBpFbJ REkSmOo10PpC/AUL2zyHfw==; Date: Sun, 13 Oct 2024 08:27:15 +0300 Message-Id: <864j5gvah8.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <04511bb6-0832-47af-8067-2d44ed790f52@alphapapa.net> (message from Adam Porter on Sat, 12 Oct 2024 19:12:50 -0500) References: <87ttdhdymx.fsf@gmail.com> <86jzeduqlp.fsf@gnu.org> <04511bb6-0832-47af-8067-2d44ed790f52@alphapapa.net> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Sat, 12 Oct 2024 19:12:50 -0500 > Cc: 73775@debbugs.gnu.org > From: Adam Porter > > > Adam, any comments or suggestions? > > I may be mistaken, but this seems like a duplicate of bug#69454. II had a vague memory this was already discussed, but couldn't find such a bug. Thanks for pointing this out. We seem to have dropped the ball on that one. Joost, would you please rebase on the current master and resubmit? Augusto, do the patches there solve the problem in your case? From unknown Fri Aug 15 20:54:25 2025 X-Loop: help-debbugs@gnu.org Subject: bug#73775: 30.0.90; vtable: can't handle 0 data rows Resent-From: Joost Kremers Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 13 Oct 2024 08:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73775 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: Adam Porter , 73775@debbugs.gnu.org, arstoffel@gmail.com Received: via spool by 73775-submit@debbugs.gnu.org id=B73775.17288064534754 (code B ref 73775); Sun, 13 Oct 2024 08:01:02 +0000 Received: (at 73775) by debbugs.gnu.org; 13 Oct 2024 08:00:53 +0000 Received: from localhost ([127.0.0.1]:50094 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sztX2-0001Eb-HW for submit@debbugs.gnu.org; Sun, 13 Oct 2024 04:00:52 -0400 Received: from fhigh-a7-smtp.messagingengine.com ([103.168.172.158]:57627) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sztWz-0001ED-Ue for 73775@debbugs.gnu.org; Sun, 13 Oct 2024 04:00:50 -0400 Received: from phl-compute-12.internal (phl-compute-12.phl.internal [10.202.2.52]) by mailfhigh.phl.internal (Postfix) with ESMTP id 0DBB11140219; Sun, 13 Oct 2024 04:00:29 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-12.internal (MEProxy); Sun, 13 Oct 2024 04:00:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.fm; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1728806429; x=1728892829; bh=bEGSQVZo10 nPqU+UK3vZ402WyIynBz8GJdUX2uqajxs=; b=fdaFvhAZC/3QVoecyzJK1qtuF5 GScDKzMGvnIp605AUYahxwJnsXSGpcGsLMDPNwl5Al5j+Hd93uOyZe/zyNFhXC5m N5nTrMD12wvPY8L9iAqiUQJs7jcK2Ks9oVJAwjXTchUob/h6GMfLF8pF+bjUm+my F74RYfKnmrH0csPk7Hcc2k4KOTzMg3ALwaJUmIzy90X5sxhHT/RZJB07kneRTR4T JAYC7iHbMWKIPJ24528vVjK1F/nGqYo9rtm/qJeud5yXC1K9C6K1zUzh9dSapEgj 6rMRyFNPD3gQuiJaR+FJemqiVVaapxyPIZFzJBsnSAAaQ7oluYlq8j0IASnw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1728806429; x=1728892829; bh=bEGSQVZo10nPqU+UK3vZ402WyIyn Bz8GJdUX2uqajxs=; b=F8Wx23W/BSCDQ9imp8fD6Uf8FjK5FHUONqbKI3u2Fi6E uzEAFwThTpwE1nOhSmQt7DOo8gXz14TQV1aafM5D1PfRvcPn46dWoGdnQ6dlOH7p waVqd9oYz1jgRffAsE3gNagsJxlBXBh62l9HSq0hW3ZgdCX8O+pRypMtc7q+1eAS hBhTzAG2VtBTz4N1K9IcT/yJLs+KrbijLLFz0yHxxHW84kEw+M6n3fQmBGbjm6LH dI2ygdsrJWdr/XQ48YQ6/qDjJE3qq1MGa8kEXTqk8MIbeqeGdovQHwlAfUCkQ7dV 2jSQuQee0GeMrwI+Ows6aY2cHuAmFfAVtgHQoqLGRw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdegvddguddvjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhvfevufgjfhffkfggtgesthdtredttddttden ucfhrhhomheplfhoohhsthcumfhrvghmvghrshcuoehjohhoshhtkhhrvghmvghrshesfh grshhtmhgrihhlrdhfmheqnecuggftrfgrthhtvghrnhepkeevleeiueeltedtfeeugedv udekhfegveeludevieelteekgefgkefhueffffeinecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepjhhoohhsthhkrhgvmhgvrhhssehfrghsthhm rghilhdrfhhmpdhnsggprhgtphhtthhopeegpdhmohguvgepshhmthhpohhuthdprhgtph htthhopeejfeejjeehseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtoheprghr shhtohhffhgvlhesghhmrghilhdrtghomhdprhgtphhtthhopegruggrmhesrghlphhhrg hprghprgdrnhgvthdprhgtphhtthhopegvlhhiiiesghhnuhdrohhrgh X-ME-Proxy: Feedback-ID: ie15541ac:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 13 Oct 2024 04:00:27 -0400 (EDT) From: Joost Kremers In-Reply-To: <864j5gvah8.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 13 Oct 2024 08:27:15 +0300") References: <87ttdhdymx.fsf@gmail.com> <86jzeduqlp.fsf@gnu.org> <04511bb6-0832-47af-8067-2d44ed790f52@alphapapa.net> <864j5gvah8.fsf@gnu.org> Date: Sun, 13 Oct 2024 10:00:24 +0200 Message-ID: <86msj8bffr.fsf@fastmail.fm> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) On Sun, Oct 13 2024, Eli Zaretskii wrote: >> Date: Sat, 12 Oct 2024 19:12:50 -0500 >> Cc: 73775@debbugs.gnu.org >> From: Adam Porter >> >> > Adam, any comments or suggestions? >> >> I may be mistaken, but this seems like a duplicate of bug#69454. > > II had a vague memory this was already discussed, but couldn't find > such a bug. Thanks for pointing this out. > > We seem to have dropped the ball on that one. Joost, would you please > rebase on the current master and resubmit? Sure, will do. Just give me a day or two to find some time. -- Joost Kremers Life has its moments From unknown Fri Aug 15 20:54:25 2025 X-Loop: help-debbugs@gnu.org Subject: bug#73775: 30.0.90; vtable: can't handle 0 data rows Resent-From: Joost Kremers Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 14 Oct 2024 11:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73775 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: Adam Porter , 73775@debbugs.gnu.org, arstoffel@gmail.com Received: via spool by 73775-submit@debbugs.gnu.org id=B73775.172890515411152 (code B ref 73775); Mon, 14 Oct 2024 11:26:02 +0000 Received: (at 73775) by debbugs.gnu.org; 14 Oct 2024 11:25:54 +0000 Received: from localhost ([127.0.0.1]:35565 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t0JCz-0002tm-5G for submit@debbugs.gnu.org; Mon, 14 Oct 2024 07:25:54 -0400 Received: from fout-a2-smtp.messagingengine.com ([103.168.172.145]:41903) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t0JCt-0002tP-UO for 73775@debbugs.gnu.org; Mon, 14 Oct 2024 07:25:51 -0400 Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfout.phl.internal (Postfix) with ESMTP id 0AE88138026B; Mon, 14 Oct 2024 07:25:26 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-01.internal (MEProxy); Mon, 14 Oct 2024 07:25:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.fm; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1728905126; x=1728991526; bh=xs60Ooyt9X 2co3gQUCSxu+FVMrtLRLrcMhYpcDWLvhs=; b=pJBq0t7u/R3dimysHuF0vkgQua FwLZIzDbHtePge0bEXufMxL2bSDJPA+uJjV/gE2zjCM7Q/6RVKKzWebozHwjEZvV OwU1pVQWwb4Xrp095oIqnsqkRQC0XTUjCRlMMC0JntJ/yd9Omme3KkjiKcobOYil Vpqlrzu5/G2CWegI5ZrXgWLqh5PuRGzz4PYe6fhS5v07+e83Zxm5v0gCSOSsLTtd ieVQVEnRJTKpBW/f8mMINtMsPXZvkWzXADLU4L+CRPCdW+Q2hsHqdimXin2lfIHK 53OXCPOpSDe1em5yuu3Z7Q5JZSLn8Vx3/ODk+eXm0O1mWLY8aFXCz+EYcPHw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1728905126; x=1728991526; bh=xs60Ooyt9X2co3gQUCSxu+FVMrtL RLrcMhYpcDWLvhs=; b=RoJ83E7oX7375OQ8+5HaHjRBQuuBgnNEqRM4OqyHQ2So zws2ZRHx80rogEKCqwSP3sH658k1jfFFjL9HOAZWtMRdmn7Rxliy+bBFAjGz78G7 RFjj3zgPTYJ65i1NBt0UZd7mYeM3NW7+TTk5J8mbJsvQfAqLBHKEHY1D1NOUrl5d FPIp83ExirwS5gzbp+2Ci0LfcDJXb/p3mUQqlGyc9uEFUF6XifscT7L98Hy1aHl6 vqEMYwIbPMmt+KSoAo6CRjhsso98YjpdluBabCI6tIDZSG9x8ppwKaiPBKbLdRr1 d/dd708W37q/fYMSzeed2FbCOdIMuxbA75+/REC+WA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdeghedgfeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhephffvvefujghffffkgggtsehmtderredttddtnecu hfhrohhmpeflohhoshhtucfmrhgvmhgvrhhsuceojhhoohhsthhkrhgvmhgvrhhssehfrg hsthhmrghilhdrfhhmqeenucggtffrrghtthgvrhhnpedvuedugffhtdevtddtledvledu leehheefveffgfdvheejvdeiieevkeejieekgfenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehjohhoshhtkhhrvghmvghrshesfhgrshhtmhgr ihhlrdhfmhdpnhgspghrtghpthhtohepgedpmhhouggvpehsmhhtphhouhhtpdhrtghpth htohepjeefjeejheesuggvsggsuhhgshdrghhnuhdrohhrghdprhgtphhtthhopegrrhhs thhofhhfvghlsehgmhgrihhlrdgtohhmpdhrtghpthhtoheprggurghmsegrlhhphhgrph grphgrrdhnvghtpdhrtghpthhtohepvghlihiisehgnhhurdhorhhg X-ME-Proxy: Feedback-ID: ie15541ac:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 14 Oct 2024 07:25:24 -0400 (EDT) From: Joost Kremers In-Reply-To: <864j5gvah8.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 13 Oct 2024 08:27:15 +0300") References: <87ttdhdymx.fsf@gmail.com> <86jzeduqlp.fsf@gnu.org> <04511bb6-0832-47af-8067-2d44ed790f52@alphapapa.net> <864j5gvah8.fsf@gnu.org> Date: Mon, 14 Oct 2024 13:25:22 +0200 Message-ID: <86jzebj599.fsf@fastmail.fm> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-=-= Content-Type: text/plain On Sun, Oct 13 2024, Eli Zaretskii wrote: >> Date: Sat, 12 Oct 2024 19:12:50 -0500 >> Cc: 73775@debbugs.gnu.org >> From: Adam Porter >> >> > Adam, any comments or suggestions? >> >> I may be mistaken, but this seems like a duplicate of bug#69454. > > II had a vague memory this was already discussed, but couldn't find > such a bug. Thanks for pointing this out. > > We seem to have dropped the ball on that one. Joost, would you please > rebase on the current master and resubmit? Here is the patch again, rebased on current master (or what was current master earlier today... :D ) As before, there are three patches, because they solve different issues that stood in the way of having empty vtables. I could squash them into one, of course. Also, the documentation and NEWS update are separate. Regards, Joost -- Joost Kremers Life has its moments --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Allow-empty-vtable.patch >From c6aa49efb559875be10e0558dcd6dc3067333f6a Mon Sep 17 00:00:00 2001 From: Joost Kremers Date: Thu, 30 May 2024 13:28:00 +0200 Subject: [PATCH 1/4] Allow empty vtable * lisp/emacs-lisp/vtable.el (vtable--compute-widths): Set default width for columns that have no explicit width and no data. --- lisp/emacs-lisp/vtable.el | 67 ++++++++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 26 deletions(-) diff --git a/lisp/emacs-lisp/vtable.el b/lisp/emacs-lisp/vtable.el index d58c6894c16..ddb7b342a3e 100644 --- a/lisp/emacs-lisp/vtable.el +++ b/lisp/emacs-lisp/vtable.el @@ -850,32 +850,47 @@ vtable--compute-width (error "Invalid spec: %s" spec)))) (defun vtable--compute-widths (table cache) - "Compute the display widths for TABLE." - (seq-into - (seq-map-indexed - (lambda (column index) - (let ((width - (or - ;; Explicit widths. - (and (vtable-column-width column) - (vtable--compute-width table (vtable-column-width column))) - ;; Compute based on the displayed widths of - ;; the data. - (seq-max (seq-map (lambda (elem) - (nth 1 (elt (cdr elem) index))) - cache))))) - ;; Let min-width/max-width specs have their say. - (when-let ((min-width (and (vtable-column-min-width column) - (vtable--compute-width - table (vtable-column-min-width column))))) - (setq width (max width min-width))) - (when-let ((max-width (and (vtable-column-max-width column) - (vtable--compute-width - table (vtable-column-max-width column))))) - (setq width (min width max-width))) - width)) - (vtable-columns table)) - 'vector)) + "Compute the display widths for TABLE. +CACHE is TABLE's cache data as returned by `vtable--compute-cache'." + (let ((widths (seq-map-indexed + (lambda (column index) + (let ((width + (or + ;; Explicit widths. + (and (vtable-column-width column) + (vtable--compute-width table (vtable-column-width column))) + ;; If the vtable is empty and no explicit width is given, + ;; set its width to 0 and deal with it below. + (if (null cache) + 0) + ;; Otherwise, compute based on the displayed widths of the + ;; data. + (seq-max (seq-map (lambda (elem) + (nth 1 (elt (cdr elem) index))) + cache))))) + ;; Let min-width/max-width specs have their say. + (when-let ((min-width (and (vtable-column-min-width column) + (vtable--compute-width + table (vtable-column-min-width column))))) + (setq width (max width min-width))) + (when-let ((max-width (and (vtable-column-max-width column) + (vtable--compute-width + table (vtable-column-max-width column))))) + (setq width (min width max-width))) + width)) + (vtable-columns table)))) + ;; If there are any zero-width columns, divide the remaining window + ;; width evenly over them. + (when (member 0 widths) + (let* ((combined-width (apply #'+ widths)) + (n-0cols (length (seq-keep #'zerop widths))) + (default-width (/ (- (window-width nil t) combined-width) n-0cols))) + (setq widths (mapcar (lambda (width) + (if (zerop width) + default-width + width)) + widths)))) + (seq-into widths 'vector))) (defun vtable--compute-cache (table) (seq-map -- 2.47.0 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0002-Enable-inserting-new-objects-into-empty-vtable.patch >From 272773f89ccd287fb5de15f3d9feff043afe091e Mon Sep 17 00:00:00 2001 From: Joost Kremers Date: Thu, 30 May 2024 23:20:00 +0200 Subject: [PATCH 2/4] Enable inserting new objects into empty vtable * lisp/emacs-lisp/vtable.el (vtable-insert-object): If the vtable is empty, add the new object and recreate + redisplay the table. --- lisp/emacs-lisp/vtable.el | 151 +++++++++++++++++++------------------- 1 file changed, 77 insertions(+), 74 deletions(-) diff --git a/lisp/emacs-lisp/vtable.el b/lisp/emacs-lisp/vtable.el index ddb7b342a3e..0a399f636eb 100644 --- a/lisp/emacs-lisp/vtable.el +++ b/lisp/emacs-lisp/vtable.el @@ -368,86 +368,89 @@ vtable-insert-object case. This also updates the displayed table." - ;; FIXME: Inserting an object into an empty vtable currently isn't - ;; possible. `nconc' fails silently (twice), and `setcar' on the cache - ;; raises an error. + ;; If the vtable is empty, just add the object and regenerate the + ;; table. (if (null (vtable-objects table)) - (error "[vtable] Cannot insert object into empty vtable")) - ;; First insert into the objects. - (let ((pos (if location - (if (integerp location) - (prog1 - (nthcdr location (vtable-objects table)) - ;; Do not prepend if index is too large: - (setq before nil)) - (or (memq location (vtable-objects table)) - ;; Prepend if `location' is not found and - ;; `before' is non-nil: - (and before (vtable-objects table)))) - ;; If `location' is nil and `before' is non-nil, we - ;; prepend the new object. - (if before (vtable-objects table))))) - (if (or before ; If `before' is non-nil, `pos' should be, as well. - (and pos (integerp location))) - ;; Add the new object before. - (let ((old-object (car pos))) - (setcar pos object) - (setcdr pos (cons old-object (cdr pos)))) - ;; Otherwise, add the object after. - (if pos - ;; Splice the object into the list. - (setcdr pos (cons object (cdr pos))) - ;; Otherwise, append the object. - (nconc (vtable-objects table) (list object))))) - ;; Then adjust the cache and display. - (save-excursion - (vtable-goto-table table) - (let* ((cache (vtable--cache table)) - (inhibit-read-only t) - (keymap (get-text-property (point) 'keymap)) - (ellipsis (if (vtable-ellipsis table) - (propertize (truncate-string-ellipsis) - 'face (vtable-face table)) - "")) - (ellipsis-width (string-pixel-width ellipsis)) - (elem (if location ; This binding mirrors the binding of `pos' above. - (if (integerp location) - (nth location (car cache)) - (or (assq location (car cache)) - (and before (caar cache)))) - (if before (caar cache)))) - (pos (memq elem (car cache))) - (line (cons object (vtable--compute-cached-line table object)))) - (if (or before + (progn + (setf (vtable-objects table) (list object)) + (vtable--recompute-numerical table (vtable--compute-cached-line table object)) + (vtable-goto-table table) + (vtable-revert-command)) + ;; First insert into the objects. + (let ((pos (if location + (if (integerp location) + (prog1 + (nthcdr location (vtable-objects table)) + ;; Do not prepend if index is too large: + (setq before nil)) + (or (memq location (vtable-objects table)) + ;; Prepend if `location' is not found and + ;; `before' is non-nil: + (and before (vtable-objects table)))) + ;; If `location' is nil and `before' is non-nil, we + ;; prepend the new object. + (if before (vtable-objects table))))) + (if (or before ; If `before' is non-nil, `pos' should be, as well. (and pos (integerp location))) - ;; Add the new object before:. - (let ((old-line (car pos))) - (setcar pos line) - (setcdr pos (cons old-line (cdr pos))) - (unless (vtable-goto-object (car elem)) - (vtable-beginning-of-table))) + ;; Add the new object before. + (let ((old-object (car pos))) + (setcar pos object) + (setcdr pos (cons old-object (cdr pos)))) ;; Otherwise, add the object after. (if pos ;; Splice the object into the list. - (progn - (setcdr pos (cons line (cdr pos))) - (if (vtable-goto-object location) - (forward-line 1) ; Insert *after*. - (vtable-end-of-table))) + (setcdr pos (cons object (cdr pos))) ;; Otherwise, append the object. - (setcar cache (nconc (car cache) (list line))) - (vtable-end-of-table))) - (let ((start (point))) - ;; FIXME: We have to adjust colors in lines below this if we - ;; have :row-colors. - (vtable--insert-line table line 0 - (nth 1 cache) (vtable--spacer table) - ellipsis ellipsis-width) - (add-text-properties start (point) (list 'keymap keymap - 'vtable table))) - ;; We may have inserted a non-numerical value into a previously - ;; all-numerical table, so recompute. - (vtable--recompute-numerical table (cdr line))))) + (nconc (vtable-objects table) (list object))))) + ;; Then adjust the cache and display. + (save-excursion + (vtable-goto-table table) + (let* ((cache (vtable--cache table)) + (inhibit-read-only t) + (keymap (get-text-property (point) 'keymap)) + (ellipsis (if (vtable-ellipsis table) + (propertize (truncate-string-ellipsis) + 'face (vtable-face table)) + "")) + (ellipsis-width (string-pixel-width ellipsis)) + (elem (if location ; This binding mirrors the binding of `pos' above. + (if (integerp location) + (nth location (car cache)) + (or (assq location (car cache)) + (and before (caar cache)))) + (if before (caar cache)))) + (pos (memq elem (car cache))) + (line (cons object (vtable--compute-cached-line table object)))) + (if (or before + (and pos (integerp location))) + ;; Add the new object before:. + (let ((old-line (car pos))) + (setcar pos line) + (setcdr pos (cons old-line (cdr pos))) + (unless (vtable-goto-object (car elem)) + (vtable-beginning-of-table))) + ;; Otherwise, add the object after. + (if pos + ;; Splice the object into the list. + (progn + (setcdr pos (cons line (cdr pos))) + (if (vtable-goto-object location) + (forward-line 1) ; Insert *after*. + (vtable-end-of-table))) + ;; Otherwise, append the object. + (setcar cache (nconc (car cache) (list line))) + (vtable-end-of-table))) + (let ((start (point))) + ;; FIXME: We have to adjust colors in lines below this if we + ;; have :row-colors. + (vtable--insert-line table line 0 + (nth 1 cache) (vtable--spacer table) + ellipsis ellipsis-width) + (add-text-properties start (point) (list 'keymap keymap + 'vtable table))) + ;; We may have inserted a non-numerical value into a previously + ;; all-numerical table, so recompute. + (vtable--recompute-numerical table (cdr line)))))) (defun vtable-column (table index) "Return the name of the INDEXth column in TABLE." -- 2.47.0 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0003-vtable-allow-resetting-column-alignment-when-table-d.patch >From abd9d2b02381e35a81188757099bb7d4343a067a Mon Sep 17 00:00:00 2001 From: Joost Kremers Date: Fri, 31 May 2024 01:38:54 +0200 Subject: [PATCH 3/4] vtable: allow resetting column alignment when table data changes * lisp/emacs-lisp/vtable.el (vtable--compute-columns): if a column was not created with an explicit 'align' property, allow changing this property when the column data changes from numeric to non-numeric (or vice versa). This makes it possible to add data to an empty table, because in a table without data all columns are assumed to be numeric and right-aligned. --- lisp/emacs-lisp/vtable.el | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/lisp/emacs-lisp/vtable.el b/lisp/emacs-lisp/vtable.el index 0a399f636eb..b14b9510fb1 100644 --- a/lisp/emacs-lisp/vtable.el +++ b/lisp/emacs-lisp/vtable.el @@ -45,7 +45,8 @@ vtable-column getter formatter displayer - -numerical) + -numerical + -aligned) (defclass vtable () ((columns :initarg :columns :accessor vtable-columns) @@ -473,7 +474,17 @@ vtable--get-value (t (elt object index)))) -(defun vtable--compute-columns (table) +(defun vtable--compute-columns (table &optional recompute) + "Compute column specs for TABLE. +Set the `align', `-aligned' and `-numerical' properties of each column. +If the column contains only numerical data, set `-numerical' to t, +otherwise to nil. `-aligned' indicates whether the column has an +`align' property set by the user. If it does, `align' is not touched, +otherwise it is set to `right' for numeric columns and to `left' for +non-numeric columns. + +If RECOMPUTE is non-nil, do not set `-aligned'. This can be used to +recompute the column specs when the table data has changed." (let ((numerical (make-vector (length (vtable-columns table)) t)) (columns (vtable-columns table))) ;; First determine whether there are any all-numerical columns. @@ -484,11 +495,16 @@ vtable--compute-columns table)) (setf (elt numerical index) nil))) (vtable-columns table))) + ;; Check if any columns have an explicit `align' property. + (unless recompute + (dolist (column (vtable-columns table)) + (if (vtable-column-align column) + (setf (vtable-column--aligned column) t)))) ;; Then fill in defaults. (seq-map-indexed (lambda (column index) ;; This is used when displaying. - (unless (vtable-column-align column) + (unless (vtable-column--aligned column) (setf (vtable-column-align column) (if (elt numerical index) 'right @@ -813,7 +829,7 @@ vtable--recompute-numerical (setq recompute t))) line) (when recompute - (vtable--compute-columns table)))) + (vtable--compute-columns table t)))) (defun vtable--set-header-line (table widths spacer) (setq header-line-format -- 2.47.0 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0004-Update-vtable-documentation.patch >From a60d29310c900086b17f05d802a9854f3e708b6e Mon Sep 17 00:00:00 2001 From: Joost Kremers Date: Mon, 14 Oct 2024 13:10:57 +0200 Subject: [PATCH 4/4] Update vtable documentation * docs/misc/vtable.texi: Document creation of empty vtables. * etc/NEWS: Announce empty vtables. --- doc/misc/vtable.texi | 11 +++++++++++ etc/NEWS | 9 +++++++++ 2 files changed, 20 insertions(+) diff --git a/doc/misc/vtable.texi b/doc/misc/vtable.texi index 795d7fad037..b2ead47d0bc 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. @@ -576,6 +585,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 4346fb4aedd..ecd22499767 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -662,6 +662,15 @@ This lets a Lisp program access the core functionality of the program, choosing the program according to the operating system's conventions. +** 'make-vtable' can create an 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. + + * Changes in Emacs 31.1 on Non-Free Operating Systems -- 2.47.0 --=-=-=-- From unknown Fri Aug 15 20:54:25 2025 X-Loop: help-debbugs@gnu.org Subject: bug#73775: 30.0.90; vtable: can't handle 0 data rows Resent-From: Adam Porter Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 16 Oct 2024 04:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73775 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Joost Kremers , Eli Zaretskii Cc: 73775@debbugs.gnu.org, arstoffel@gmail.com Received: via spool by 73775-submit@debbugs.gnu.org id=B73775.172905195432524 (code B ref 73775); Wed, 16 Oct 2024 04:13:02 +0000 Received: (at 73775) by debbugs.gnu.org; 16 Oct 2024 04:12:34 +0000 Received: from localhost ([127.0.0.1]:58105 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t0vOk-0008SW-2w for submit@debbugs.gnu.org; Wed, 16 Oct 2024 00:12:34 -0400 Received: from cow.ash.relay.mailchannels.net ([23.83.222.41]:54063) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t0vOi-0008SK-0T for 73775@debbugs.gnu.org; Wed, 16 Oct 2024 00:12:32 -0400 X-Sender-Id: dreamhost|x-authsender|adam@alphapapa.net Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 25424904295; Wed, 16 Oct 2024 04:12:11 +0000 (UTC) Received: from pdx1-sub0-mail-a236.dreamhost.com (100-98-255-245.trex-nlb.outbound.svc.cluster.local [100.98.255.245]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id BBCC3902DF4; Wed, 16 Oct 2024 04:12:10 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1729051930; a=rsa-sha256; cv=none; b=PGNYGUrSmePf8npjKAMTXdGYsCAnTLVLbGtSojqAn/v6ULdEZ/fc6OGWsNYeEpoG3cC9wK pSekBgcEBCSyAwlgRLuYTvVqE247/eqbfIFUVVkY1yepwO31jCe3auoPdehkoL8Q7zy56O shWRXElmf6V36Zydj0aLJbfAy9KHONqznafSWFYeNeGQsS3xFnoZ8ShivPcG7Z3fG2rWm7 K6c5GsOgcpywzL/P8c652bU4u6v9Y+wixJ6xDWsiOIOaSvU4x53HH+UARM03a3sVLXKIUP dSM8PY11d72Bu1L8S2EL/FLEroc+nWAGovSqMll4lSFPdIH9Cz+GsBK0e+jusg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1729051930; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=cx8e4G8fJzY09zEn2bwck5FSNYwQCvKGiL5LXWhptyU=; b=79Kqt7ROcVRQPIlYj4kfHUAHlb+qnWkVvhU7HO0Ttv7dUXbjkr6jNXiy3KmkY8yK4oNzt+ vAUjSTu3iizIUTTTlZjLHEtvQkrnV+WfKDhlBG1m12cp5xTJYWd7g5fuxiz1IQHvSYND52 DQhbLPEgkCcJRcN59qIxfZ8Ifqs1TvfvMqGAY1Vpn4jYKrBuEgNmMOhb4dcxSI9aFock8K 4SOXtNj6S05cOi+l7LxIv/hSvTs1/yz/VScSg4ULtLDSwb/wgiq88Q3bfz2FzTO00BHYhF ltpZbtBYLsRouWSKTYjpPxsHPK4nfAhbfPGWO9SBtILeNmXq8rM7m+pMDCAS3g== ARC-Authentication-Results: i=1; rspamd-5b4c8788b8-c8qkv; auth=pass smtp.auth=dreamhost smtp.mailfrom=adam@alphapapa.net X-Sender-Id: dreamhost|x-authsender|adam@alphapapa.net X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|adam@alphapapa.net X-MailChannels-Auth-Id: dreamhost X-Cold-Abiding: 13cc658b204c6ad6_1729051930997_3146101158 X-MC-Loop-Signature: 1729051930997:3378169794 X-MC-Ingress-Time: 1729051930997 Received: from pdx1-sub0-mail-a236.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.98.255.245 (trex/7.0.2); Wed, 16 Oct 2024 04:12:10 +0000 Received: from [10.43.78.85] (unknown [193.56.116.15]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: adam@alphapapa.net) by pdx1-sub0-mail-a236.dreamhost.com (Postfix) with ESMTPSA id 4XSyGd718jzB3; Tue, 15 Oct 2024 21:12:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alphapapa.net; s=dreamhost; t=1729051930; bh=cx8e4G8fJzY09zEn2bwck5FSNYwQCvKGiL5LXWhptyU=; h=Date:Subject:To:Cc:From:Content-Type:Content-Transfer-Encoding; b=Zehue3et/k7w6HFj0tK3GlssSrAAjcLozhslT4UEqd9X724mAbEvyZd2HtVPcutw9 YGsWfcXmdeRPAf0iqKuR76xRYcSeIAuBRHkbAzIPKsdTK5Vry76xSJFx36cQKkPjO6 pxMHazQ01Un8uyiItw2ya+QWo5jlC4PLu9KH6EFx6MP54Soe7+kdvgKGDLGn/eAs5+ yycxo39ssEzz0aH+D6SBh53B3GFjQIKavJhopU2EIGEdhrhMIPR0VN+nrQ9P8vB2/m KRSabr/R1GS3uJEbm3NPIFt12s2aMWwEnxe0oJtZcLERM3EKftnCcGa6VKZ2leXPhF NpYMvjcbIBHAQ== Message-ID: Date: Tue, 15 Oct 2024 23:12:08 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird References: <87ttdhdymx.fsf@gmail.com> <86jzeduqlp.fsf@gnu.org> <04511bb6-0832-47af-8067-2d44ed790f52@alphapapa.net> <864j5gvah8.fsf@gnu.org> <86jzebj599.fsf@fastmail.fm> Content-Language: en-US From: Adam Porter In-Reply-To: <86jzebj599.fsf@fastmail.fm> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.3 (/) Hi Joost, On 10/14/24 06:25, Joost Kremers wrote: > On Sun, Oct 13 2024, Eli Zaretskii wrote: >>> Date: Sat, 12 Oct 2024 19:12:50 -0500 >>> Cc: 73775@debbugs.gnu.org >>> From: Adam Porter >>> >>>> Adam, any comments or suggestions? >>> >>> I may be mistaken, but this seems like a duplicate of bug#69454. >> >> II had a vague memory this was already discussed, but couldn't find >> such a bug. Thanks for pointing this out. >> >> We seem to have dropped the ball on that one. Joost, would you please >> rebase on the current master and resubmit? > > Here is the patch again, rebased on current master (or what was current > master earlier today... :D ) > > As before, there are three patches, because they solve different issues > that stood in the way of having empty vtables. I could squash them into > one, of course. Also, the documentation and NEWS update are separate. Just a few minor suggestions: + "Compute the display widths for TABLE. +CACHE is TABLE's cache data as returned by `vtable--compute-cache'." + (let ((widths (seq-map-indexed + (lambda (column index) + (let ((width + (or + ;; Explicit widths. + (and (vtable-column-width column) + (vtable--compute-width table (vtable-column-width column))) + ;; If the vtable is empty and no explicit width is given, + ;; set its width to 0 and deal with it below. + (if (null cache) I may be mistaken (as I haven't examined all of the relevant code), but if CACHE is nil when this function is called, won't it always be null? If so, you could check its value once, at first, rather than each time through this loop. + ;; If there are any zero-width columns, divide the remaining window + ;; width evenly over them. + (when (member 0 widths) + (let* ((combined-width (apply #'+ widths)) + (n-0cols (length (seq-keep #'zerop widths))) You could use SEQ-COUNT here, which would avoid consing a new list. @@ -484,3 +495,8 @@ vtable--compute-columns table)) (setf (elt numerical index) nil))) (vtable-columns table))) + ;; Check if any columns have an explicit `align' property. + (unless recompute + (dolist (column (vtable-columns table)) + (if (vtable-column-align column) + (setf (vtable-column--aligned column) t)))) This could be a WHEN instead of a "one-armed IF". :) From unknown Fri Aug 15 20:54:25 2025 X-Loop: help-debbugs@gnu.org Subject: bug#73775: 30.0.90; vtable: can't handle 0 data rows Resent-From: Joost Kremers Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 16 Oct 2024 16:21:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73775 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Adam Porter Cc: Eli Zaretskii , arstoffel@gmail.com, 73775@debbugs.gnu.org Received: via spool by 73775-submit@debbugs.gnu.org id=B73775.17290956292779 (code B ref 73775); Wed, 16 Oct 2024 16:21:01 +0000 Received: (at 73775) by debbugs.gnu.org; 16 Oct 2024 16:20:29 +0000 Received: from localhost ([127.0.0.1]:60185 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t16l9-0000ik-Sw for submit@debbugs.gnu.org; Wed, 16 Oct 2024 12:20:29 -0400 Received: from fhigh-a8-smtp.messagingengine.com ([103.168.172.159]:55707) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t16l6-0000iM-Gr for 73775@debbugs.gnu.org; Wed, 16 Oct 2024 12:20:26 -0400 Received: from phl-compute-03.internal (phl-compute-03.phl.internal [10.202.2.43]) by mailfhigh.phl.internal (Postfix) with ESMTP id 506251140169; Wed, 16 Oct 2024 12:19:47 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-03.internal (MEProxy); Wed, 16 Oct 2024 12:19:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.fm; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1729095587; x=1729181987; bh=lYt2JCYk/z 7vN86DgRWwrMG7muMnQLvDmIiTRkhHZ68=; b=RKotG7EVcPRssj0nVzi4dUr5s5 oDvm1NjNIOqENNk9TEc1f+bQpnsuLvtyRPVaLbdB3WbRH2dATQ17xqk+Ui2A0XhG NtyQuDwIKWi0j0Iau+vBdSeLNHokXseB/u6U134cdTHeB/qy0UMpygyfBYGe3ybl quFl2LPP/t0D9XGoBpfP09cz49PAK2nAEsdBgPEMtJI8YR32Y2g9EfTZ85Gf9a+k BPphR4Syfb6/n519fymflLL/6RsxeyTl5Xnkw9C4bA9Phlkw6F1TJlp1EhQwkDGi /GQWM3WjLtcrsZwAFrUl2aqUwD856PX/iUcoYnWHsThHMYPq6YUkxMVmjYgg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1729095587; x=1729181987; bh=lYt2JCYk/z7vN86DgRWwrMG7muMn QLvDmIiTRkhHZ68=; b=PZxmTSAkV+y6qnli6KxirdTwJR30V7lCmqvPi9NznrCr XiOuAgQCk13h72gFa6vdeQ1/JOQt63tla73xHB/Sc4djjn+l1NxY7B4bvLo+BddN mmJzp7lSj8VPh3YpGTiBi96bVuZhuLJhTFDZgGTuZrxPussVHQd8rxfK+5AipebO BoDNcUvaH71Wb6aZpVIB94QhIsGljqiUWffwuSzrZn9EvaCBY+GArLwV5XrgI3xr 7ROu3n+wOCqCsaTAD9zeCC3NklWG4RxU9CeJrslaICCbN+CwWTQ1SNR8tSGQshUz 9NSq6wwWMNFOgATo2+l4x9Rd7pqfd09Df+VwmD0aFQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdegledgleelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhephffvvefujghffffkgggtsehmtderredttdejnecu hfhrohhmpeflohhoshhtucfmrhgvmhgvrhhsuceojhhoohhsthhkrhgvmhgvrhhssehfrg hsthhmrghilhdrfhhmqeenucggtffrrghtthgvrhhnpefgfeeuleevuddtteeggfduuefh tdelvdetudffgffggeetkeektdeliefghfejteenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehjohhoshhtkhhrvghmvghrshesfhgrshhtmhgr ihhlrdhfmhdpnhgspghrtghpthhtohepgedpmhhouggvpehsmhhtphhouhhtpdhrtghpth htohepjeefjeejheesuggvsggsuhhgshdrghhnuhdrohhrghdprhgtphhtthhopegrrhhs thhofhhfvghlsehgmhgrihhlrdgtohhmpdhrtghpthhtohepvghlihiisehgnhhurdhorh hgpdhrtghpthhtoheprggurghmsegrlhhphhgrphgrphgrrdhnvght X-ME-Proxy: Feedback-ID: ie15541ac:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 16 Oct 2024 12:19:45 -0400 (EDT) From: Joost Kremers In-Reply-To: (Adam Porter's message of "Tue, 15 Oct 2024 23:12:08 -0500") References: <87ttdhdymx.fsf@gmail.com> <86jzeduqlp.fsf@gnu.org> <04511bb6-0832-47af-8067-2d44ed790f52@alphapapa.net> <864j5gvah8.fsf@gnu.org> <86jzebj599.fsf@fastmail.fm> Date: Wed, 16 Oct 2024 18:19:41 +0200 Message-ID: <86h69cf2aq.fsf@fastmail.fm> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Adam, Thanks for looking at this. On Tue, Oct 15 2024, Adam Porter wrote: > Just a few minor suggestions: > > + "Compute the display widths for TABLE. > +CACHE is TABLE's cache data as returned by `vtable--compute-cache'." > + (let ((widths (seq-map-indexed > + (lambda (column index) > + (let ((width > + (or > + ;; Explicit widths. > + (and (vtable-column-width column) > + (vtable--compute-width table > (vtable-column-width column))) > + ;; If the vtable is empty and no explicit wid= th > is given, > + ;; set its width to 0 and deal with it below. > + (if (null cache) > > I may be mistaken (as I haven't examined all of the relevant code), but if > CACHE is nil when this function is called, won't it always be null? If so, > you could check its value once, at first, rather than each time through > this loop. Unfortunately, it has to be checked anew in every iteration, because it determines for each column individually if we need to (temporarily) set its width to 0. It also needs to keep the following `seq-max` from erroring out (due to `seq-map` returning `nil`). > + ;; If there are any zero-width columns, divide the remaining window > + ;; width evenly over them. > + (when (member 0 widths) > + (let* ((combined-width (apply #'+ widths)) > + (n-0cols (length (seq-keep #'zerop widths))) > > You could use SEQ-COUNT here, which would avoid consing a new list. There may even be a better way. If I keep track of the number of zero-width columns in the loop above, I don't even need to count them here. I've implemented that in the updated patch attached to this message. > @@ -484,3 +495,8 @@ vtable--compute-columns > table)) > (setf (elt numerical index) nil))) > (vtable-columns table))) > + ;; Check if any columns have an explicit `align' property. > + (unless recompute > + (dolist (column (vtable-columns table)) > + (if (vtable-column-align column) > + (setf (vtable-column--aligned column) t)))) > > This could be a WHEN instead of a "one-armed IF". :) Yes, sirree! (I don't really agree with the "one-armed if should be when"-stance, but I'd be hard-pressed to say when I prefer "if" and when "when", and it's hardly a hill I want to die on, so I made the change. =F0= =9F=98=86 ) --=20 Joost Kremers Life has its moments --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Allow-empty-vtable.patch >From 319fdd16081962aa0a716c0b861baacf41a0f534 Mon Sep 17 00:00:00 2001 From: Joost Kremers Date: Thu, 30 May 2024 13:28:00 +0200 Subject: [PATCH 1/4] Allow empty vtable * lisp/emacs-lisp/vtable.el (vtable--compute-widths): Set default width for columns that have no explicit width and no data. --- lisp/emacs-lisp/vtable.el | 68 ++++++++++++++++++++++++--------------- 1 file changed, 42 insertions(+), 26 deletions(-) diff --git a/lisp/emacs-lisp/vtable.el b/lisp/emacs-lisp/vtable.el index d58c6894c16..b4c01cdfe6c 100644 --- a/lisp/emacs-lisp/vtable.el +++ b/lisp/emacs-lisp/vtable.el @@ -850,32 +850,48 @@ vtable--compute-width (error "Invalid spec: %s" spec)))) (defun vtable--compute-widths (table cache) - "Compute the display widths for TABLE." - (seq-into - (seq-map-indexed - (lambda (column index) - (let ((width - (or - ;; Explicit widths. - (and (vtable-column-width column) - (vtable--compute-width table (vtable-column-width column))) - ;; Compute based on the displayed widths of - ;; the data. - (seq-max (seq-map (lambda (elem) - (nth 1 (elt (cdr elem) index))) - cache))))) - ;; Let min-width/max-width specs have their say. - (when-let ((min-width (and (vtable-column-min-width column) - (vtable--compute-width - table (vtable-column-min-width column))))) - (setq width (max width min-width))) - (when-let ((max-width (and (vtable-column-max-width column) - (vtable--compute-width - table (vtable-column-max-width column))))) - (setq width (min width max-width))) - width)) - (vtable-columns table)) - 'vector)) + "Compute the display widths for TABLE. +CACHE is TABLE's cache data as returned by `vtable--compute-cache'." + (let* ((n-0cols 0) ; Count the number of zero-width columns. + (widths (seq-map-indexed + (lambda (column index) + (let ((width + (or + ;; Explicit widths. + (and (vtable-column-width column) + (vtable--compute-width table (vtable-column-width column))) + ;; If the vtable is empty and no explicit width is given, + ;; set its width to 0 and deal with it below. + (when (null cache) + (setq n-0cols (1+ n-0cols)) + 0) + ;; Otherwise, compute based on the displayed widths of the + ;; data. + (seq-max (seq-map (lambda (elem) + (nth 1 (elt (cdr elem) index))) + cache))))) + ;; Let min-width/max-width specs have their say. + (when-let ((min-width (and (vtable-column-min-width column) + (vtable--compute-width + table (vtable-column-min-width column))))) + (setq width (max width min-width))) + (when-let ((max-width (and (vtable-column-max-width column) + (vtable--compute-width + table (vtable-column-max-width column))))) + (setq width (min width max-width))) + width)) + (vtable-columns table)))) + ;; If there are any zero-width columns, divide the remaining window + ;; width evenly over them. + (when (> n-0cols 0) + (let* ((combined-width (apply #'+ widths)) + (default-width (/ (- (window-width nil t) combined-width) n-0cols))) + (setq widths (mapcar (lambda (width) + (if (zerop width) + default-width + width)) + widths)))) + (seq-into widths 'vector))) (defun vtable--compute-cache (table) (seq-map -- 2.47.0 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0002-Enable-inserting-new-objects-into-empty-vtable.patch >From 9b0509d0b3a5ae78135c63971d2b99ff0bd07ed5 Mon Sep 17 00:00:00 2001 From: Joost Kremers Date: Thu, 30 May 2024 23:20:00 +0200 Subject: [PATCH 2/4] Enable inserting new objects into empty vtable * lisp/emacs-lisp/vtable.el (vtable-insert-object): If the vtable is empty, add the new object and recreate + redisplay the table. --- lisp/emacs-lisp/vtable.el | 151 +++++++++++++++++++------------------- 1 file changed, 77 insertions(+), 74 deletions(-) diff --git a/lisp/emacs-lisp/vtable.el b/lisp/emacs-lisp/vtable.el index b4c01cdfe6c..0aa3b4c5e76 100644 --- a/lisp/emacs-lisp/vtable.el +++ b/lisp/emacs-lisp/vtable.el @@ -368,86 +368,89 @@ vtable-insert-object case. This also updates the displayed table." - ;; FIXME: Inserting an object into an empty vtable currently isn't - ;; possible. `nconc' fails silently (twice), and `setcar' on the cache - ;; raises an error. + ;; If the vtable is empty, just add the object and regenerate the + ;; table. (if (null (vtable-objects table)) - (error "[vtable] Cannot insert object into empty vtable")) - ;; First insert into the objects. - (let ((pos (if location - (if (integerp location) - (prog1 - (nthcdr location (vtable-objects table)) - ;; Do not prepend if index is too large: - (setq before nil)) - (or (memq location (vtable-objects table)) - ;; Prepend if `location' is not found and - ;; `before' is non-nil: - (and before (vtable-objects table)))) - ;; If `location' is nil and `before' is non-nil, we - ;; prepend the new object. - (if before (vtable-objects table))))) - (if (or before ; If `before' is non-nil, `pos' should be, as well. - (and pos (integerp location))) - ;; Add the new object before. - (let ((old-object (car pos))) - (setcar pos object) - (setcdr pos (cons old-object (cdr pos)))) - ;; Otherwise, add the object after. - (if pos - ;; Splice the object into the list. - (setcdr pos (cons object (cdr pos))) - ;; Otherwise, append the object. - (nconc (vtable-objects table) (list object))))) - ;; Then adjust the cache and display. - (save-excursion - (vtable-goto-table table) - (let* ((cache (vtable--cache table)) - (inhibit-read-only t) - (keymap (get-text-property (point) 'keymap)) - (ellipsis (if (vtable-ellipsis table) - (propertize (truncate-string-ellipsis) - 'face (vtable-face table)) - "")) - (ellipsis-width (string-pixel-width ellipsis)) - (elem (if location ; This binding mirrors the binding of `pos' above. - (if (integerp location) - (nth location (car cache)) - (or (assq location (car cache)) - (and before (caar cache)))) - (if before (caar cache)))) - (pos (memq elem (car cache))) - (line (cons object (vtable--compute-cached-line table object)))) - (if (or before + (progn + (setf (vtable-objects table) (list object)) + (vtable--recompute-numerical table (vtable--compute-cached-line table object)) + (vtable-goto-table table) + (vtable-revert-command)) + ;; First insert into the objects. + (let ((pos (if location + (if (integerp location) + (prog1 + (nthcdr location (vtable-objects table)) + ;; Do not prepend if index is too large: + (setq before nil)) + (or (memq location (vtable-objects table)) + ;; Prepend if `location' is not found and + ;; `before' is non-nil: + (and before (vtable-objects table)))) + ;; If `location' is nil and `before' is non-nil, we + ;; prepend the new object. + (if before (vtable-objects table))))) + (if (or before ; If `before' is non-nil, `pos' should be, as well. (and pos (integerp location))) - ;; Add the new object before:. - (let ((old-line (car pos))) - (setcar pos line) - (setcdr pos (cons old-line (cdr pos))) - (unless (vtable-goto-object (car elem)) - (vtable-beginning-of-table))) + ;; Add the new object before. + (let ((old-object (car pos))) + (setcar pos object) + (setcdr pos (cons old-object (cdr pos)))) ;; Otherwise, add the object after. (if pos ;; Splice the object into the list. - (progn - (setcdr pos (cons line (cdr pos))) - (if (vtable-goto-object location) - (forward-line 1) ; Insert *after*. - (vtable-end-of-table))) + (setcdr pos (cons object (cdr pos))) ;; Otherwise, append the object. - (setcar cache (nconc (car cache) (list line))) - (vtable-end-of-table))) - (let ((start (point))) - ;; FIXME: We have to adjust colors in lines below this if we - ;; have :row-colors. - (vtable--insert-line table line 0 - (nth 1 cache) (vtable--spacer table) - ellipsis ellipsis-width) - (add-text-properties start (point) (list 'keymap keymap - 'vtable table))) - ;; We may have inserted a non-numerical value into a previously - ;; all-numerical table, so recompute. - (vtable--recompute-numerical table (cdr line))))) + (nconc (vtable-objects table) (list object))))) + ;; Then adjust the cache and display. + (save-excursion + (vtable-goto-table table) + (let* ((cache (vtable--cache table)) + (inhibit-read-only t) + (keymap (get-text-property (point) 'keymap)) + (ellipsis (if (vtable-ellipsis table) + (propertize (truncate-string-ellipsis) + 'face (vtable-face table)) + "")) + (ellipsis-width (string-pixel-width ellipsis)) + (elem (if location ; This binding mirrors the binding of `pos' above. + (if (integerp location) + (nth location (car cache)) + (or (assq location (car cache)) + (and before (caar cache)))) + (if before (caar cache)))) + (pos (memq elem (car cache))) + (line (cons object (vtable--compute-cached-line table object)))) + (if (or before + (and pos (integerp location))) + ;; Add the new object before:. + (let ((old-line (car pos))) + (setcar pos line) + (setcdr pos (cons old-line (cdr pos))) + (unless (vtable-goto-object (car elem)) + (vtable-beginning-of-table))) + ;; Otherwise, add the object after. + (if pos + ;; Splice the object into the list. + (progn + (setcdr pos (cons line (cdr pos))) + (if (vtable-goto-object location) + (forward-line 1) ; Insert *after*. + (vtable-end-of-table))) + ;; Otherwise, append the object. + (setcar cache (nconc (car cache) (list line))) + (vtable-end-of-table))) + (let ((start (point))) + ;; FIXME: We have to adjust colors in lines below this if we + ;; have :row-colors. + (vtable--insert-line table line 0 + (nth 1 cache) (vtable--spacer table) + ellipsis ellipsis-width) + (add-text-properties start (point) (list 'keymap keymap + 'vtable table))) + ;; We may have inserted a non-numerical value into a previously + ;; all-numerical table, so recompute. + (vtable--recompute-numerical table (cdr line)))))) (defun vtable-column (table index) "Return the name of the INDEXth column in TABLE." -- 2.47.0 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0003-vtable-allow-resetting-column-alignment-when-table-d.patch >From bfd6dcd2c8052af091824877bf92c3169962ed8c Mon Sep 17 00:00:00 2001 From: Joost Kremers Date: Fri, 31 May 2024 01:38:54 +0200 Subject: [PATCH 3/4] vtable: allow resetting column alignment when table data changes * lisp/emacs-lisp/vtable.el (vtable--compute-columns): if a column was not created with an explicit 'align' property, allow changing this property when the column data changes from numeric to non-numeric (or vice versa). This makes it possible to add data to an empty table, because in a table without data all columns are assumed to be numeric and right-aligned. --- lisp/emacs-lisp/vtable.el | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/lisp/emacs-lisp/vtable.el b/lisp/emacs-lisp/vtable.el index 0aa3b4c5e76..6b6487847b9 100644 --- a/lisp/emacs-lisp/vtable.el +++ b/lisp/emacs-lisp/vtable.el @@ -45,7 +45,8 @@ vtable-column getter formatter displayer - -numerical) + -numerical + -aligned) (defclass vtable () ((columns :initarg :columns :accessor vtable-columns) @@ -473,7 +474,17 @@ vtable--get-value (t (elt object index)))) -(defun vtable--compute-columns (table) +(defun vtable--compute-columns (table &optional recompute) + "Compute column specs for TABLE. +Set the `align', `-aligned' and `-numerical' properties of each column. +If the column contains only numerical data, set `-numerical' to t, +otherwise to nil. `-aligned' indicates whether the column has an +`align' property set by the user. If it does, `align' is not touched, +otherwise it is set to `right' for numeric columns and to `left' for +non-numeric columns. + +If RECOMPUTE is non-nil, do not set `-aligned'. This can be used to +recompute the column specs when the table data has changed." (let ((numerical (make-vector (length (vtable-columns table)) t)) (columns (vtable-columns table))) ;; First determine whether there are any all-numerical columns. @@ -484,11 +495,16 @@ vtable--compute-columns table)) (setf (elt numerical index) nil))) (vtable-columns table))) + ;; Check if any columns have an explicit `align' property. + (unless recompute + (dolist (column (vtable-columns table)) + (when (vtable-column-align column) + (setf (vtable-column--aligned column) t)))) ;; Then fill in defaults. (seq-map-indexed (lambda (column index) ;; This is used when displaying. - (unless (vtable-column-align column) + (unless (vtable-column--aligned column) (setf (vtable-column-align column) (if (elt numerical index) 'right @@ -813,7 +829,7 @@ vtable--recompute-numerical (setq recompute t))) line) (when recompute - (vtable--compute-columns table)))) + (vtable--compute-columns table t)))) (defun vtable--set-header-line (table widths spacer) (setq header-line-format -- 2.47.0 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0004-Update-vtable-documentation.patch >From da903db0bcf310376d4ff7aaf3578bb576cfa1b7 Mon Sep 17 00:00:00 2001 From: Joost Kremers Date: Mon, 14 Oct 2024 13:10:57 +0200 Subject: [PATCH 4/4] Update vtable documentation * docs/misc/vtable.texi: Document creation of empty vtables. * etc/NEWS: Announce empty vtables. --- doc/misc/vtable.texi | 11 +++++++++++ etc/NEWS | 9 +++++++++ 2 files changed, 20 insertions(+) diff --git a/doc/misc/vtable.texi b/doc/misc/vtable.texi index 795d7fad037..b2ead47d0bc 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. @@ -576,6 +585,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 4346fb4aedd..ecd22499767 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -662,6 +662,15 @@ This lets a Lisp program access the core functionality of the program, choosing the program according to the operating system's conventions. +** 'make-vtable' can create an 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. + + * Changes in Emacs 31.1 on Non-Free Operating Systems -- 2.47.0 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 25 11:43:06 2024 Received: (at control) by debbugs.gnu.org; 25 Oct 2024 15:43:06 +0000 Received: from localhost ([127.0.0.1]:39232 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t4MSv-0002dO-QG for submit@debbugs.gnu.org; Fri, 25 Oct 2024 11:43:06 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51908) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t4MSs-0002ce-2V; Fri, 25 Oct 2024 11:43:02 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t4MQA-0002JU-E6; Fri, 25 Oct 2024 11:40:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=J0Fb9+W8LylsUmZMxlPw1uBaJ6BKwaqWagNHpfvSTgM=; b=KdJrSs4xyW4Z 1X//npR+ic9xAnUbPzqOy1iFGskCifozVJ4C/mcU7jEQEwkKBml5hxm+G1g+CbyWvx48K3uFgHUuJ rLhGNlJwDC6Xfe7QiOKwt5dTm9i8Pq/aV/39/tjJKR/I3yh3Zw+WVtOHpTsrKVNLYZ9hN+gGsjdql 4BoxAlBVHDBRa/42rc5+w+QO+C+F0OKnGDn6pdye7KHE9MxQVZHLtEvfCF4fdJWwNZB44SubCaIKJ 1LVOKRRQYBo+AMeJJpabGwGT+r3s1ohe3knlwrWXjNldDGwzdrBCpZ3AfgMgaiqTmfk6gVA4AApqD eAQPDoN3Gya+m8fYHmX5Ew==; Date: Fri, 25 Oct 2024 18:40:11 +0300 Message-Id: <86frokb38k.fsf@gnu.org> From: Eli Zaretskii To: Spencer Baugh In-Reply-To: (bug-gnu-emacs@gnu.org) Subject: Re: bug#74013: 31.0.50; make-vtable errors on an empty list of objects References: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control Cc: larsi@gnus.org, 74013@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) merge 74013 73775 thanks > Cc: Lars Ingebrigtsen > Date: Fri, 25 Oct 2024 11:23:35 -0400 > From: Spencer Baugh via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > > 1. emacs -Q > 2. M-: (make-vtable :columns '("column") :objects '()) > 3. Observe an error like (wrong-number-of-arguments # 0) > > I ran into this when trying to display a list which can sometimes be > empty. At the very least it would be nice for this to provide a better > error message. I think this is a duplicate of bug#73775. From unknown Fri Aug 15 20:54:25 2025 X-Loop: help-debbugs@gnu.org Subject: bug#73775: 30.0.90; vtable: can't handle 0 data rows Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 27 Oct 2024 10:36:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73775 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: adam@alphapapa.net, Joost Kremers Cc: 73775@debbugs.gnu.org, arstoffel@gmail.com Received: via spool by 73775-submit@debbugs.gnu.org id=B73775.173002532024902 (code B ref 73775); Sun, 27 Oct 2024 10:36:01 +0000 Received: (at 73775) by debbugs.gnu.org; 27 Oct 2024 10:35:20 +0000 Received: from localhost ([127.0.0.1]:43952 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t50cB-0006Ta-Oz for submit@debbugs.gnu.org; Sun, 27 Oct 2024 06:35:20 -0400 Received: from eggs.gnu.org ([209.51.188.92]:54856) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t50c9-0006TK-BV for 73775@debbugs.gnu.org; Sun, 27 Oct 2024 06:35:17 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t50bU-0004mV-OA; Sun, 27 Oct 2024 06:34:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=oWAgKeo/D3lGc9xChFqWyHa1w/lh4OuGx/icfjE4ynE=; b=gBECqcpNHXg7ZHXVkPrL u+qX0O3uZuIjTQFp3wyWuUGKmR5DIA7FZqzanEymIZ/sGKs4kxwO51OwF6Dq9KU/O9J/rB+8J2QM+ av7cQqo1h/PMtLkO+aMgNGZJrHJ9MSHqcjAjhFiMh/8uVMmEc6z+/e9ZRvdWPHKKezx0VeA1SybRH RxZ7wUDnrz9F5qneP0q2OZgEuDXiof318QPmvXYGPedM3h6K1WFiMjahJ1bLrDkG3XZXQi7Sq2Gve D97MvEDjQxxxj8aveyfJtiOR0DxamO2NP6YttxQxfqojFdd+gUS8pTuoFFB3+v7XGbcChWg/BjU5h 8bs9P03Q6+iqbQ==; Date: Sun, 27 Oct 2024 12:34:34 +0200 Message-Id: <86frohal6t.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <86h69cf2aq.fsf@fastmail.fm> (message from Joost Kremers on Wed, 16 Oct 2024 18:19:41 +0200) References: <87ttdhdymx.fsf@gmail.com> <86jzeduqlp.fsf@gnu.org> <04511bb6-0832-47af-8067-2d44ed790f52@alphapapa.net> <864j5gvah8.fsf@gnu.org> <86jzebj599.fsf@fastmail.fm> <86h69cf2aq.fsf@fastmail.fm> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Joost Kremers > Cc: Eli Zaretskii , arstoffel@gmail.com, 73775@debbugs.gnu.org > Date: Wed, 16 Oct 2024 18:19:41 +0200 > > Hi Adam, > > Thanks for looking at this. > > On Tue, Oct 15 2024, Adam Porter wrote: > > Just a few minor suggestions: > > > > + "Compute the display widths for TABLE. > > +CACHE is TABLE's cache data as returned by `vtable--compute-cache'." > > + (let ((widths (seq-map-indexed > > + (lambda (column index) > > + (let ((width > > + (or > > + ;; Explicit widths. > > + (and (vtable-column-width column) > > + (vtable--compute-width table > > (vtable-column-width column))) > > + ;; If the vtable is empty and no explicit width > > is given, > > + ;; set its width to 0 and deal with it below. > > + (if (null cache) > > > > I may be mistaken (as I haven't examined all of the relevant code), but if > > CACHE is nil when this function is called, won't it always be null? If so, > > you could check its value once, at first, rather than each time through > > this loop. > > Unfortunately, it has to be checked anew in every iteration, because it > determines for each column individually if we need to (temporarily) set its > width to 0. It also needs to keep the following `seq-max` from erroring out > (due to `seq-map` returning `nil`). > > > + ;; If there are any zero-width columns, divide the remaining window > > + ;; width evenly over them. > > + (when (member 0 widths) > > + (let* ((combined-width (apply #'+ widths)) > > + (n-0cols (length (seq-keep #'zerop widths))) > > > > You could use SEQ-COUNT here, which would avoid consing a new list. > > There may even be a better way. If I keep track of the number of zero-width > columns in the loop above, I don't even need to count them here. I've > implemented that in the updated patch attached to this message. > > > @@ -484,3 +495,8 @@ vtable--compute-columns > > table)) > > (setf (elt numerical index) nil))) > > (vtable-columns table))) > > + ;; Check if any columns have an explicit `align' property. > > + (unless recompute > > + (dolist (column (vtable-columns table)) > > + (if (vtable-column-align column) > > + (setf (vtable-column--aligned column) t)))) > > > > This could be a WHEN instead of a "one-armed IF". :) > > Yes, sirree! (I don't really agree with the "one-armed if should be > when"-stance, but I'd be hard-pressed to say when I prefer "if" and when > "when", and it's hardly a hill I want to die on, so I made the change. 😆 ) Adam, any further comments? Or should I install this? From unknown Fri Aug 15 20:54:25 2025 X-Loop: help-debbugs@gnu.org Subject: bug#73775: 30.0.90; vtable: can't handle 0 data rows Resent-From: Adam Porter Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 29 Oct 2024 23:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73775 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii , Joost Kremers Cc: 73775@debbugs.gnu.org, arstoffel@gmail.com Received: via spool by 73775-submit@debbugs.gnu.org id=B73775.173024519429699 (code B ref 73775); Tue, 29 Oct 2024 23:40:02 +0000 Received: (at 73775) by debbugs.gnu.org; 29 Oct 2024 23:39:54 +0000 Received: from localhost ([127.0.0.1]:59655 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t5voY-0007ix-8j for submit@debbugs.gnu.org; Tue, 29 Oct 2024 19:39:54 -0400 Received: from black.elm.relay.mailchannels.net ([23.83.212.19]:3595) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t5voW-0007ir-AW for 73775@debbugs.gnu.org; Tue, 29 Oct 2024 19:39:53 -0400 X-Sender-Id: dreamhost|x-authsender|adam@alphapapa.net Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 9C641814B4; Tue, 29 Oct 2024 23:39:50 +0000 (UTC) Received: from pdx1-sub0-mail-a258.dreamhost.com (100-101-211-194.trex-nlb.outbound.svc.cluster.local [100.101.211.194]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 3E90880F34; Tue, 29 Oct 2024 23:39:50 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1730245190; a=rsa-sha256; cv=none; b=MPNwWZawo08gGKbujDALpcHBx/BdG/i7Cn9m586+iQW5X97ADTp3pkqd/f3F82BYktzb6k NWi0ZSTC/K31sBmzk8zCTxGyJaW6Hpxww/3caWLMU4gpXYiJTzCnGkr5s/qEpnEanCxxDS wMehsljRohbdAs6YP070Ur7r7CWSZEWk++Br1LKDLagEbirFYrTeHAfEIwLTl48PJqgTsZ DzJ+sumYeU8CtveR4Nj96ObNaUqAJx/Gf/bK0J28nJibh5u0ke+G5kL1bceWZIvx/oTq3u RyoUe6S7+3i/vS4vtSaxyQSxKZiBwxuik5Dc2Ffd/tKdazVPRshM9kUpCjtXfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1730245190; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=n6abfngH/MZWPYDp9jmrJn2ty0vvVMELIhZULUY52QU=; b=e0UdnjierJXDrCUW/ir3b3zzVxdkhDpXnPemhrhZ0VqDXyshlSdKYx41U2LB4nHSPTSwlN F7PylCmww16oKjb631BUtq3YhamhWeo2yiN/7WTj8Xy+zUlo9mvCuCXqe8x/KMTHx/GHUI 8oRt+UcQX2X1Hg/YoCoOoubHz7WZNX1wuOz0ughNNZMKzp9Hi57IiR1+zqzdk9JiK0OYiM 2fAXqMoXdb45ByDGMnR452dnTEbk3cl0A+70EuRM6pdMfytDrHezEz5mi5JS/HrBRkY1fd vanHDo8Zu9sHqFAW22bLgyVhRIhMlHlTucVNYAF3L8qD9UTWXIUkxAI518h9vg== ARC-Authentication-Results: i=1; rspamd-bdb96867f-mwr9v; auth=pass smtp.auth=dreamhost smtp.mailfrom=adam@alphapapa.net X-Sender-Id: dreamhost|x-authsender|adam@alphapapa.net X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|adam@alphapapa.net X-MailChannels-Auth-Id: dreamhost X-Wipe-Harbor: 01290bf32851c187_1730245190485_671754876 X-MC-Loop-Signature: 1730245190485:1066957118 X-MC-Ingress-Time: 1730245190485 Received: from pdx1-sub0-mail-a258.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.101.211.194 (trex/7.0.2); Tue, 29 Oct 2024 23:39:50 +0000 Received: from [10.66.70.77] (unknown [91.193.232.98]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: adam@alphapapa.net) by pdx1-sub0-mail-a258.dreamhost.com (Postfix) with ESMTPSA id 4XdRYx3vZwz4D; Tue, 29 Oct 2024 16:39:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alphapapa.net; s=dreamhost; t=1730245190; bh=n6abfngH/MZWPYDp9jmrJn2ty0vvVMELIhZULUY52QU=; h=Date:Subject:To:Cc:From:Content-Type:Content-Transfer-Encoding; b=gM2/eByO5tq89JYjXGBxi7cF2wHYD0G5CGYZvLyPM5dnApk7pSph/Zu7xXwpsE5K1 MLs/N6O5APQZI8icOqnN7ZfKzSIByJqCLdGRZLVHrCoC2pDtaIPX4q4Sjid2qsSTua U2WbW6SrOWP/YblvR7XGFw5lQTov/x5ADFfiKB8mEh5SrNBz5t/Ccg3QOPG6C7FlJt 0CrsI5ldugmWzuNEILX1uwDnWDFL9JO2mSwY+BzGuu3jJtI9sjeIOydpfj+v0a4PPZ vw/0oqHz/rnCaZqmTc3u+Hz4AXVxrPzHxFGTElRKA7NWx/EQSxaSlRVAa2OeNRigkb 9uMAn2l4zMFfA== Message-ID: Date: Tue, 29 Oct 2024 18:39:48 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird References: <87ttdhdymx.fsf@gmail.com> <86jzeduqlp.fsf@gnu.org> <04511bb6-0832-47af-8067-2d44ed790f52@alphapapa.net> <864j5gvah8.fsf@gnu.org> <86jzebj599.fsf@fastmail.fm> <86h69cf2aq.fsf@fastmail.fm> <86frohal6t.fsf@gnu.org> Content-Language: en-US From: Adam Porter In-Reply-To: <86frohal6t.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.3 (/) Hi Eli, On 10/27/24 05:34, Eli Zaretskii wrote: > > Adam, any further comments? Or should I install this? I confess that I haven't tested the patch, but assuming that it works as intended, I have no objections. :) If you want me to test it, let me know; have been pretty busy lately, so I haven't taken the time. --Adam From unknown Fri Aug 15 20:54:25 2025 X-Loop: help-debbugs@gnu.org Subject: bug#73775: 30.0.90; vtable: can't handle 0 data rows Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 31 Oct 2024 10:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73775 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Joost Kremers Cc: adam@alphapapa.net, 73775@debbugs.gnu.org, arstoffel@gmail.com Received: via spool by 73775-submit@debbugs.gnu.org id=B73775.173037062511146 (code B ref 73775); Thu, 31 Oct 2024 10:31:02 +0000 Received: (at 73775) by debbugs.gnu.org; 31 Oct 2024 10:30:25 +0000 Received: from localhost ([127.0.0.1]:41505 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t6SRc-0002ti-ME for submit@debbugs.gnu.org; Thu, 31 Oct 2024 06:30:25 -0400 Received: from eggs.gnu.org ([209.51.188.92]:43014) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t6SRY-0002tT-NP for 73775@debbugs.gnu.org; Thu, 31 Oct 2024 06:30:23 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t6SRS-0006sn-O3; Thu, 31 Oct 2024 06:30:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=Qsu1PZG9lVRYJzvL+nZN6PC0/u/P4HFxtArUs5gpIOM=; b=Kzw/9nC9U9n/tHIzYMWS DWzvLJCypGzJuZ9aV2On2euX/2RnnajkVqcpOvoqhOMXR9VGMwFVit6iVd2OcxRJ4MIFbIKjWgbZz RW+/Z7Y/0j49uwdEVc9Lm0D5I4ElLKEDokiqJ2F1aTLvIUQHhjvGcRfdCYYyMiOS0L9qoLuoAEq8u 8DWnl+JbX/4f3ZxKWQDxT7lcTYZ6f/YI9CvkD7+E/Dyvmags5Kur/Q7x5bWiE1DGqIQxke3Axol6y bjOo2QkI9Yd4WvCGCc43TDjrr8V4SaoL7GJX0KsxSRjrE2jviY4K0pHhSQ8cXfMmhxCn7kajj2dHE AxaDzKIuB3uQhQ==; Date: Thu, 31 Oct 2024 12:30:09 +0200 Message-Id: <86msik36q6.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <86h69cf2aq.fsf@fastmail.fm> (message from Joost Kremers on Wed, 16 Oct 2024 18:19:41 +0200) References: <87ttdhdymx.fsf@gmail.com> <86jzeduqlp.fsf@gnu.org> <04511bb6-0832-47af-8067-2d44ed790f52@alphapapa.net> <864j5gvah8.fsf@gnu.org> <86jzebj599.fsf@fastmail.fm> <86h69cf2aq.fsf@fastmail.fm> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Joost Kremers > Cc: Eli Zaretskii , arstoffel@gmail.com, 73775@debbugs.gnu.org > Date: Wed, 16 Oct 2024 18:19:41 +0200 > > Hi Adam, > > Thanks for looking at this. > > On Tue, Oct 15 2024, Adam Porter wrote: > > Just a few minor suggestions: > > > > + "Compute the display widths for TABLE. > > +CACHE is TABLE's cache data as returned by `vtable--compute-cache'." > > + (let ((widths (seq-map-indexed > > + (lambda (column index) > > + (let ((width > > + (or > > + ;; Explicit widths. > > + (and (vtable-column-width column) > > + (vtable--compute-width table > > (vtable-column-width column))) > > + ;; If the vtable is empty and no explicit width > > is given, > > + ;; set its width to 0 and deal with it below. > > + (if (null cache) > > > > I may be mistaken (as I haven't examined all of the relevant code), but if > > CACHE is nil when this function is called, won't it always be null? If so, > > you could check its value once, at first, rather than each time through > > this loop. > > Unfortunately, it has to be checked anew in every iteration, because it > determines for each column individually if we need to (temporarily) set its > width to 0. It also needs to keep the following `seq-max` from erroring out > (due to `seq-map` returning `nil`). > > > + ;; If there are any zero-width columns, divide the remaining window > > + ;; width evenly over them. > > + (when (member 0 widths) > > + (let* ((combined-width (apply #'+ widths)) > > + (n-0cols (length (seq-keep #'zerop widths))) > > > > You could use SEQ-COUNT here, which would avoid consing a new list. > > There may even be a better way. If I keep track of the number of zero-width > columns in the loop above, I don't even need to count them here. I've > implemented that in the updated patch attached to this message. > > > @@ -484,3 +495,8 @@ vtable--compute-columns > > table)) > > (setf (elt numerical index) nil))) > > (vtable-columns table))) > > + ;; Check if any columns have an explicit `align' property. > > + (unless recompute > > + (dolist (column (vtable-columns table)) > > + (if (vtable-column-align column) > > + (setf (vtable-column--aligned column) t)))) > > > > This could be a WHEN instead of a "one-armed IF". :) > > Yes, sirree! (I don't really agree with the "one-armed if should be > when"-stance, but I'd be hard-pressed to say when I prefer "if" and when > "when", and it's hardly a hill I want to die on, so I made the change. 😆 ) 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. > * lisp/emacs-lisp/vtable.el (vtable--compute-columns): if a column was > not created with an explicit 'align' property, allow changing this > property when the column data changes from numeric to non-numeric (or > vice versa). This makes it possible to add data to an empty table, > because in a table without data all columns are assumed to be numeric > and right-aligned. This should be reformatted according to our conventions: start with a capital letter, leave two spaces between sentences, and not to indent lines. > +** 'make-vtable' can create an empty vtable This should end in a period. Also, please mark the entry with "+++", since the manuals were updated. From unknown Fri Aug 15 20:54:25 2025 X-Loop: help-debbugs@gnu.org Subject: bug#73775: 30.0.90; vtable: can't handle 0 data rows Resent-From: Joost Kremers Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 06 Nov 2024 08:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73775 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: adam@alphapapa.net, 73775@debbugs.gnu.org, arstoffel@gmail.com Received: via spool by 73775-submit@debbugs.gnu.org id=B73775.173088320915624 (code B ref 73775); Wed, 06 Nov 2024 08:54:02 +0000 Received: (at 73775) by debbugs.gnu.org; 6 Nov 2024 08:53:29 +0000 Received: from localhost ([127.0.0.1]:39577 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t8bn6-00043v-D1 for submit@debbugs.gnu.org; Wed, 06 Nov 2024 03:53:29 -0500 Received: from fout-b2-smtp.messagingengine.com ([202.12.124.145]:43157) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t8bn3-00043d-Jx for 73775@debbugs.gnu.org; Wed, 06 Nov 2024 03:53:27 -0500 Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44]) by mailfout.stl.internal (Postfix) with ESMTP id 495E51140175; Wed, 6 Nov 2024 03:53:20 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Wed, 06 Nov 2024 03:53:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.fm; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1730883200; x=1730969600; bh=3Z4aDTIw73 yTOwfBuFJnKXP7J9Xd01ffEUW52TrtPlo=; b=FtuuSznnHztkq0NXMtWZ/JGaTC aP5b/TquGqZ3C0uirnNtRpzymD6srxZq2VkesD10eDAIcIut1mJ9MFetcpa9T54T wLiaHpO2K7n6ma1rfkprX1+pI797YsWFKDQbJHuFlnLx2EdVcUMXhwxI+Simr/Xe bkftspdrgy24caJLC+NoN5dJVycBujW9H3ia4EhGS23wpKLqmkX4Qoa62TsUSkKy awVfTy7F3kcCPeqye0fS+u3pQpBgU//4kIwe5xlFEO0s1fQvCcxBeRy1mgytsHi7 c8BSxIpnsBFlZeSBgFUu3vnDvfRcHs2xDi82SkxT0b8fO1wDLJm1o1SE22bw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1730883200; x=1730969600; bh=3Z4aDTIw73yTOwfBuFJnKXP7J9Xd01ffEUW 52TrtPlo=; b=bCk5ipt0Uld6a8TcvTUtjPTVjrZ5Owsl4tfOW0ajH6xCXFu9VT8 MLKhScS+ys/4OIskw6gSiiXE45sxymR0V22G6/RQRrvhC7kxxkMaag1l4NjxHz72 k2gxzLpCwjjN8ow+yn55vaAmwnCH/tHAFiAqGXMH/VUIc6pSRl2TlNMsQVZ22E2P cLR5sXplCZIziraBzjRvshZpQ4pLMjmUM96ZIhFwgRWhbuDnesPPN4AGlNkMTyre HdENJaD8KZFjU68o34arfSbfb1csx43yXHlxk3U5/PvdcJehlctmR/o7CGAo84rg WDSc0nM1fpy+PE4DJBLXMUSOS1sLRRS6F0w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrtddugdduvdeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhephffvvefujghffffkgggtsehmtderredttddtnecu hfhrohhmpeflohhoshhtucfmrhgvmhgvrhhsuceojhhoohhsthhkrhgvmhgvrhhssehfrg hsthhmrghilhdrfhhmqeenucggtffrrghtthgvrhhnpedvuedugffhtdevtddtledvledu leehheefveffgfdvheejvdeiieevkeejieekgfenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehjohhoshhtkhhrvghmvghrshesfhgrshhtmhgr ihhlrdhfmhdpnhgspghrtghpthhtohepgedpmhhouggvpehsmhhtphhouhhtpdhrtghpth htohepjeefjeejheesuggvsggsuhhgshdrghhnuhdrohhrghdprhgtphhtthhopegrrhhs thhofhhfvghlsehgmhgrihhlrdgtohhmpdhrtghpthhtoheprggurghmsegrlhhphhgrph grphgrrdhnvghtpdhrtghpthhtohepvghlihiisehgnhhurdhorhhg X-ME-Proxy: Feedback-ID: ie15541ac:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 6 Nov 2024 03:53:17 -0500 (EST) From: Joost Kremers In-Reply-To: <86msik36q6.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 31 Oct 2024 12:30:09 +0200") References: <87ttdhdymx.fsf@gmail.com> <86jzeduqlp.fsf@gnu.org> <04511bb6-0832-47af-8067-2d44ed790f52@alphapapa.net> <864j5gvah8.fsf@gnu.org> <86jzebj599.fsf@fastmail.fm> <86h69cf2aq.fsf@fastmail.fm> <86msik36q6.fsf@gnu.org> Date: Wed, 06 Nov 2024 09:53:14 +0100 Message-ID: <86y11wrbet.fsf@fastmail.fm> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-=-= Content-Type: text/plain 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. Regards, Joost -- Joost Kremers Life has its moments --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Allow-empty-vtable.patch >From f62683ac7ba0ed71b21db543ac0ab716d0dbae5c Mon Sep 17 00:00:00 2001 From: Joost Kremers Date: Wed, 6 Nov 2024 09:46:00 +0100 Subject: [PATCH 1/4] Allow empty vtable * lisp/emacs-lisp/vtable.el (vtable--compute-widths): Set default width for columns that have no explicit width and no data. --- lisp/emacs-lisp/vtable.el | 68 ++++++++++++++++++++++++--------------- 1 file changed, 42 insertions(+), 26 deletions(-) diff --git a/lisp/emacs-lisp/vtable.el b/lisp/emacs-lisp/vtable.el index 925961f012c..043b9ca55c4 100644 --- a/lisp/emacs-lisp/vtable.el +++ b/lisp/emacs-lisp/vtable.el @@ -850,32 +850,48 @@ vtable--compute-width (error "Invalid spec: %s" spec)))) (defun vtable--compute-widths (table cache) - "Compute the display widths for TABLE." - (seq-into - (seq-map-indexed - (lambda (column index) - (let ((width - (or - ;; Explicit widths. - (and (vtable-column-width column) - (vtable--compute-width table (vtable-column-width column))) - ;; Compute based on the displayed widths of - ;; the data. - (seq-max (seq-map (lambda (elem) - (nth 1 (elt (cdr elem) index))) - cache))))) - ;; Let min-width/max-width specs have their say. - (when-let* ((min-width (and (vtable-column-min-width column) - (vtable--compute-width - table (vtable-column-min-width column))))) - (setq width (max width min-width))) - (when-let* ((max-width (and (vtable-column-max-width column) - (vtable--compute-width - table (vtable-column-max-width column))))) - (setq width (min width max-width))) - width)) - (vtable-columns table)) - 'vector)) + "Compute the display widths for TABLE. +CACHE is TABLE's cache data as returned by `vtable--compute-cache'." + (let* ((n-0cols 0) ; Count the number of zero-width columns. + (widths (seq-map-indexed + (lambda (column index) + (let ((width + (or + ;; Explicit widths. + (and (vtable-column-width column) + (vtable--compute-width table (vtable-column-width column))) + ;; If the vtable is empty and no explicit width is given, + ;; set its width to 0 and deal with it below. + (when (null cache) + (setq n-0cols (1+ n-0cols)) + 0) + ;; Otherwise, compute based on the displayed widths of the + ;; data. + (seq-max (seq-map (lambda (elem) + (nth 1 (elt (cdr elem) index))) + cache))))) + ;; Let min-width/max-width specs have their say. + (when-let* ((min-width (and (vtable-column-min-width column) + (vtable--compute-width + table (vtable-column-min-width column))))) + (setq width (max width min-width))) + (when-let* ((max-width (and (vtable-column-max-width column) + (vtable--compute-width + table (vtable-column-max-width column))))) + (setq width (min width max-width))) + width)) + (vtable-columns table)))) + ;; If there are any zero-width columns, divide the remaining window + ;; width evenly over them. + (when (> n-0cols 0) + (let* ((combined-width (apply #'+ widths)) + (default-width (/ (- (window-width nil t) combined-width) n-0cols))) + (setq widths (mapcar (lambda (width) + (if (zerop width) + default-width + width)) + widths)))) + (seq-into widths 'vector))) (defun vtable--compute-cache (table) (seq-map -- 2.47.0 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0002-Enable-inserting-new-objects-into-empty-vtable.patch >From 608a16eb04883a63e306466c5a2c4b553fcf4e0e Mon Sep 17 00:00:00 2001 From: Joost Kremers Date: Thu, 30 May 2024 23:20:00 +0200 Subject: [PATCH 2/4] Enable inserting new objects into empty vtable * lisp/emacs-lisp/vtable.el (vtable-insert-object): If the vtable is empty, add the new object and recreate + redisplay the table. --- lisp/emacs-lisp/vtable.el | 151 +++++++++++++++++++------------------- 1 file changed, 77 insertions(+), 74 deletions(-) diff --git a/lisp/emacs-lisp/vtable.el b/lisp/emacs-lisp/vtable.el index 043b9ca55c4..cd874e7c2c1 100644 --- a/lisp/emacs-lisp/vtable.el +++ b/lisp/emacs-lisp/vtable.el @@ -368,86 +368,89 @@ vtable-insert-object case. This also updates the displayed table." - ;; FIXME: Inserting an object into an empty vtable currently isn't - ;; possible. `nconc' fails silently (twice), and `setcar' on the cache - ;; raises an error. + ;; If the vtable is empty, just add the object and regenerate the + ;; table. (if (null (vtable-objects table)) - (error "[vtable] Cannot insert object into empty vtable")) - ;; First insert into the objects. - (let ((pos (if location - (if (integerp location) - (prog1 - (nthcdr location (vtable-objects table)) - ;; Do not prepend if index is too large: - (setq before nil)) - (or (memq location (vtable-objects table)) - ;; Prepend if `location' is not found and - ;; `before' is non-nil: - (and before (vtable-objects table)))) - ;; If `location' is nil and `before' is non-nil, we - ;; prepend the new object. - (if before (vtable-objects table))))) - (if (or before ; If `before' is non-nil, `pos' should be, as well. - (and pos (integerp location))) - ;; Add the new object before. - (let ((old-object (car pos))) - (setcar pos object) - (setcdr pos (cons old-object (cdr pos)))) - ;; Otherwise, add the object after. - (if pos - ;; Splice the object into the list. - (setcdr pos (cons object (cdr pos))) - ;; Otherwise, append the object. - (nconc (vtable-objects table) (list object))))) - ;; Then adjust the cache and display. - (save-excursion - (vtable-goto-table table) - (let* ((cache (vtable--cache table)) - (inhibit-read-only t) - (keymap (get-text-property (point) 'keymap)) - (ellipsis (if (vtable-ellipsis table) - (propertize (truncate-string-ellipsis) - 'face (vtable-face table)) - "")) - (ellipsis-width (string-pixel-width ellipsis)) - (elem (if location ; This binding mirrors the binding of `pos' above. - (if (integerp location) - (nth location (car cache)) - (or (assq location (car cache)) - (and before (caar cache)))) - (if before (caar cache)))) - (pos (memq elem (car cache))) - (line (cons object (vtable--compute-cached-line table object)))) - (if (or before + (progn + (setf (vtable-objects table) (list object)) + (vtable--recompute-numerical table (vtable--compute-cached-line table object)) + (vtable-goto-table table) + (vtable-revert-command)) + ;; First insert into the objects. + (let ((pos (if location + (if (integerp location) + (prog1 + (nthcdr location (vtable-objects table)) + ;; Do not prepend if index is too large: + (setq before nil)) + (or (memq location (vtable-objects table)) + ;; Prepend if `location' is not found and + ;; `before' is non-nil: + (and before (vtable-objects table)))) + ;; If `location' is nil and `before' is non-nil, we + ;; prepend the new object. + (if before (vtable-objects table))))) + (if (or before ; If `before' is non-nil, `pos' should be, as well. (and pos (integerp location))) - ;; Add the new object before:. - (let ((old-line (car pos))) - (setcar pos line) - (setcdr pos (cons old-line (cdr pos))) - (unless (vtable-goto-object (car elem)) - (vtable-beginning-of-table))) + ;; Add the new object before. + (let ((old-object (car pos))) + (setcar pos object) + (setcdr pos (cons old-object (cdr pos)))) ;; Otherwise, add the object after. (if pos ;; Splice the object into the list. - (progn - (setcdr pos (cons line (cdr pos))) - (if (vtable-goto-object location) - (forward-line 1) ; Insert *after*. - (vtable-end-of-table))) + (setcdr pos (cons object (cdr pos))) ;; Otherwise, append the object. - (setcar cache (nconc (car cache) (list line))) - (vtable-end-of-table))) - (let ((start (point))) - ;; FIXME: We have to adjust colors in lines below this if we - ;; have :row-colors. - (vtable--insert-line table line 0 - (nth 1 cache) (vtable--spacer table) - ellipsis ellipsis-width) - (add-text-properties start (point) (list 'keymap keymap - 'vtable table))) - ;; We may have inserted a non-numerical value into a previously - ;; all-numerical table, so recompute. - (vtable--recompute-numerical table (cdr line))))) + (nconc (vtable-objects table) (list object))))) + ;; Then adjust the cache and display. + (save-excursion + (vtable-goto-table table) + (let* ((cache (vtable--cache table)) + (inhibit-read-only t) + (keymap (get-text-property (point) 'keymap)) + (ellipsis (if (vtable-ellipsis table) + (propertize (truncate-string-ellipsis) + 'face (vtable-face table)) + "")) + (ellipsis-width (string-pixel-width ellipsis)) + (elem (if location ; This binding mirrors the binding of `pos' above. + (if (integerp location) + (nth location (car cache)) + (or (assq location (car cache)) + (and before (caar cache)))) + (if before (caar cache)))) + (pos (memq elem (car cache))) + (line (cons object (vtable--compute-cached-line table object)))) + (if (or before + (and pos (integerp location))) + ;; Add the new object before:. + (let ((old-line (car pos))) + (setcar pos line) + (setcdr pos (cons old-line (cdr pos))) + (unless (vtable-goto-object (car elem)) + (vtable-beginning-of-table))) + ;; Otherwise, add the object after. + (if pos + ;; Splice the object into the list. + (progn + (setcdr pos (cons line (cdr pos))) + (if (vtable-goto-object location) + (forward-line 1) ; Insert *after*. + (vtable-end-of-table))) + ;; Otherwise, append the object. + (setcar cache (nconc (car cache) (list line))) + (vtable-end-of-table))) + (let ((start (point))) + ;; FIXME: We have to adjust colors in lines below this if we + ;; have :row-colors. + (vtable--insert-line table line 0 + (nth 1 cache) (vtable--spacer table) + ellipsis ellipsis-width) + (add-text-properties start (point) (list 'keymap keymap + 'vtable table))) + ;; We may have inserted a non-numerical value into a previously + ;; all-numerical table, so recompute. + (vtable--recompute-numerical table (cdr line)))))) (defun vtable-column (table index) "Return the name of the INDEXth column in TABLE." -- 2.47.0 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0003-vtable-allow-resetting-column-alignment-when-table-d.patch >From 8c2749fb983b7be94e929c3cb165bbf3a7da1100 Mon Sep 17 00:00:00 2001 From: Joost Kremers Date: Fri, 31 May 2024 01:38:54 +0200 Subject: [PATCH 3/4] vtable: allow resetting column alignment when table data changes * lisp/emacs-lisp/vtable.el (vtable--compute-columns): If a column was not created with an explicit 'align' property, allow changing this property when the column data changes from numeric to non-numeric (or vice versa). This makes it possible to add data to an empty table, because in a table without data all columns are assumed to be numeric and right-aligned. --- lisp/emacs-lisp/vtable.el | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/lisp/emacs-lisp/vtable.el b/lisp/emacs-lisp/vtable.el index cd874e7c2c1..a839f3d70b8 100644 --- a/lisp/emacs-lisp/vtable.el +++ b/lisp/emacs-lisp/vtable.el @@ -45,7 +45,8 @@ vtable-column getter formatter displayer - -numerical) + -numerical + -aligned) (defclass vtable () ((columns :initarg :columns :accessor vtable-columns) @@ -473,7 +474,17 @@ vtable--get-value (t (elt object index)))) -(defun vtable--compute-columns (table) +(defun vtable--compute-columns (table &optional recompute) + "Compute column specs for TABLE. +Set the `align', `-aligned' and `-numerical' properties of each column. +If the column contains only numerical data, set `-numerical' to t, +otherwise to nil. `-aligned' indicates whether the column has an +`align' property set by the user. If it does, `align' is not touched, +otherwise it is set to `right' for numeric columns and to `left' for +non-numeric columns. + +If RECOMPUTE is non-nil, do not set `-aligned'. This can be used to +recompute the column specs when the table data has changed." (let ((numerical (make-vector (length (vtable-columns table)) t)) (columns (vtable-columns table))) ;; First determine whether there are any all-numerical columns. @@ -484,11 +495,16 @@ vtable--compute-columns table)) (setf (elt numerical index) nil))) (vtable-columns table))) + ;; Check if any columns have an explicit `align' property. + (unless recompute + (dolist (column (vtable-columns table)) + (when (vtable-column-align column) + (setf (vtable-column--aligned column) t)))) ;; Then fill in defaults. (seq-map-indexed (lambda (column index) ;; This is used when displaying. - (unless (vtable-column-align column) + (unless (vtable-column--aligned column) (setf (vtable-column-align column) (if (elt numerical index) 'right @@ -813,7 +829,7 @@ vtable--recompute-numerical (setq recompute t))) line) (when recompute - (vtable--compute-columns table)))) + (vtable--compute-columns table t)))) (defun vtable--set-header-line (table widths spacer) (setq header-line-format -- 2.47.0 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0004-Update-vtable-documentation.patch >From dbbfa4356cf22d9e123c94c632622777bad6e660 Mon Sep 17 00:00:00 2001 From: Joost Kremers Date: Mon, 14 Oct 2024 13:10:57 +0200 Subject: [PATCH 4/4] Update vtable documentation * docs/misc/vtable.texi: Document creation of empty vtables. * etc/NEWS: Announce empty vtables. --- doc/misc/vtable.texi | 11 +++++++++++ etc/NEWS | 10 ++++++++++ 2 files changed, 21 insertions(+) diff --git a/doc/misc/vtable.texi b/doc/misc/vtable.texi index 795d7fad037..b2ead47d0bc 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. @@ -576,6 +585,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 af6259a68c8..e1b3b3eedfa 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -790,6 +790,16 @@ This lets a Lisp program access the core functionality of the program, choosing the program according to the operating system's conventions. ++++ +** 'make-vtable' can create an 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. + + * Changes in Emacs 31.1 on Non-Free Operating Systems -- 2.47.0 --=-=-=-- From unknown Fri Aug 15 20:54:25 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Augusto Stoffel Subject: bug#73775: closed (Re: bug#73775: 30.0.90; vtable: can't handle 0 data rows) Message-ID: References: <86o72on25x.fsf@gnu.org> <87ttdhdymx.fsf@gmail.com> X-Gnu-PR-Message: they-closed 73775 X-Gnu-PR-Package: emacs Reply-To: 73775@debbugs.gnu.org Date: Sat, 09 Nov 2024 10:16:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1731147362-16284-1" This is a multi-part message in MIME format... ------------=_1731147362-16284-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 73775@debbugs.gnu.org. --=20 73775: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D73775 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1731147362-16284-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 73775-done) by debbugs.gnu.org; 9 Nov 2024 10:15:53 +0000 Received: from localhost ([127.0.0.1]:53514 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t9iVU-0004EF-Fx for submit@debbugs.gnu.org; Sat, 09 Nov 2024 05:15:52 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54746) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t9iVS-0004E0-Gg for 73775-done@debbugs.gnu.org; Sat, 09 Nov 2024 05:15:51 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t9iVJ-0007rX-RK; Sat, 09 Nov 2024 05:15:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=rDIQ+BOHnIsrI50IBnXi/hcwl+XfW8LGZgVhWW7iOk4=; b=kqX3/PnKcU+q bDL3ZJcVbnzn4hchFoGljKYKHOgTvFx6AakrFKy5pJq3yyeONu0dRU83W6HMBmOO0kVqiAPA3EFD+ aoabBErjty0I0hUyb3Xx1/ksOCnxIHVsvRtdNZVTNUjuel+63Ho9da1rDloibINGnQJoQY+MvpvIl 4mb7c2J5iVUhTZFQc+O7kduj74MIpcmIXEEjOQTZAbejkdGFz6bFcwfoO/9XnpGIRVeqdT9OnVFiW FRjDe9PxxRsEHzI4F2X4QZU4hoR3JLHVYWLzYIAPJ1ZabX1yr4uxoTMHiprUW7uI2mYVGTNVAjsJJ 9ke3TR/dOw7CKuISv8tHKQ==; Date: Sat, 09 Nov 2024 12:15:38 +0200 Message-Id: <86o72on25x.fsf@gnu.org> From: Eli Zaretskii To: Joost Kremers In-Reply-To: <86y11wrbet.fsf@fastmail.fm> (message from Joost Kremers on Wed, 06 Nov 2024 09:53:14 +0100) Subject: Re: bug#73775: 30.0.90; vtable: can't handle 0 data rows References: <87ttdhdymx.fsf@gmail.com> <86jzeduqlp.fsf@gnu.org> <04511bb6-0832-47af-8067-2d44ed790f52@alphapapa.net> <864j5gvah8.fsf@gnu.org> <86jzebj599.fsf@fastmail.fm> <86h69cf2aq.fsf@fastmail.fm> <86msik36q6.fsf@gnu.org> <86y11wrbet.fsf@fastmail.fm> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 73775-done Cc: adam@alphapapa.net, 73775-done@debbugs.gnu.org, arstoffel@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Joost Kremers > Cc: adam@alphapapa.net, arstoffel@gmail.com, 73775@debbugs.gnu.org > 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. ------------=_1731147362-16284-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 12 Oct 2024 17:23:14 +0000 Received: from localhost ([127.0.0.1]:53563 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1szfpi-00066V-AU for submit@debbugs.gnu.org; Sat, 12 Oct 2024 13:23:14 -0400 Received: from lists.gnu.org ([209.51.188.17]:51022) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1szfpg-00066M-24 for submit@debbugs.gnu.org; Sat, 12 Oct 2024 13:23:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1szfpR-0005IP-Af for bug-gnu-emacs@gnu.org; Sat, 12 Oct 2024 13:22:57 -0400 Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1szfpP-0007hL-1Q for bug-gnu-emacs@gnu.org; Sat, 12 Oct 2024 13:22:57 -0400 Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-5c9428152c0so3245980a12.1 for ; Sat, 12 Oct 2024 10:22:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728753771; x=1729358571; darn=gnu.org; h=mime-version:user-agent:message-id:date:subject:to:from:from:to:cc :subject:date:message-id:reply-to; bh=G4K9nJ9XhVqrMiN4BGAea9aln8t7o4hJsaXHP3mBLjI=; b=eHPqkJf0ERKBr1UtZV82zvW8O2kGY8EQfHd2ww2I1hTJHvxDkITqk1scGvpxTWGGKw uh9gPYnyZycHjcui7PeIPAYtuH4pd33a2tcVSUlMzhEb8LZpPUrANTBseUxUdw+vQzNm 9KJU14SxDVy3VQOVPenY85aeAaxO2BTNYNF+Gd+yBIptgF9AOSDPvBomFE2GgYWFS75F 1AML7n0oFgKbEulJ1iVJy1WTI7v6x5LGZbd82tg+YFSLBM2gx8SK8ryGflyCqBBylRHn NPORDD3yJowu1u7O9+UOfdLX8xs61ntsUsq0kI02fGgdHi7IjxOTlq+M/exzeWo5cDew Bs0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728753771; x=1729358571; h=mime-version:user-agent:message-id:date:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=G4K9nJ9XhVqrMiN4BGAea9aln8t7o4hJsaXHP3mBLjI=; b=gnJR5/xs0eKQ4pVjreegQrUZ1MGRs9s1cWb/6++wZ3BZc4MgUOwesuHfa05EMxjviT N9+nUimXBoAN8qk7bb6GpM2qer5cEoVSbYPK6TKb5mJ6m2xXWoF9PPt62Yxt1mS4IzFQ NXVI/RLqdd3CiiLh2f0NqmIT3tidYc/EXZRO5yEn2nua8mH4E/p3024iWVB4J/2ALXxH e+t1J8NAOyd9tR/628wK1Dl8Lc2c9rPquHCz7dJJPYHEXErXRzYNDuA4nhFLlX42RQmr l4+oKkkrRAeCUyj2mS8E9MNA9hp2TzbxG0jQ1T5GkFED5aaWQivy6uCUPBl85jviHSj4 OEHw== X-Gm-Message-State: AOJu0YxRGGhCWpkNCdKxtGhoIQt/8fRjVbZk15tI7UmTHO+IthjFDte6 l508Ot1gYA4E9D2DseUYQxE7+rQ1QCBdVVxvmN88M07O7UqveJqx4lQhmg== X-Google-Smtp-Source: AGHT+IGFd6Ej+sEeOKWdpxWlPtQ71eEgO+BLxyDOaAqdgLLWm1KQ+lkvZElSA5GrPOwoAaVs8rADhQ== X-Received: by 2002:a05:6402:5c8:b0:5c9:6312:afab with SMTP id 4fb4d7f45d1cf-5c96312b56bmr1327448a12.36.1728753770537; Sat, 12 Oct 2024 10:22:50 -0700 (PDT) Received: from ars3 ([2a02:8109:8a87:ff00::d6f6]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c9370d273fsm3157130a12.16.2024.10.12.10.22.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Oct 2024 10:22:48 -0700 (PDT) From: Augusto Stoffel To: bug-gnu-emacs@gnu.org Subject: 30.0.90; vtable: can't handle 0 data rows X-Debbugs-Cc: Date: Sat, 12 Oct 2024 19:22:46 +0200 Message-ID: <87ttdhdymx.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2a00:1450:4864:20::533; envelope-from=arstoffel@gmail.com; helo=mail-ed1-x533.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) This call produces the error (wrong-number-of-arguments # 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 ------------=_1731147362-16284-1-- From unknown Fri Aug 15 20:54:25 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Spencer Baugh Subject: bug#74013: closed (Re: bug#73775: 30.0.90; vtable: can't handle 0 data rows) Message-ID: References: <86o72on25x.fsf@gnu.org> X-Gnu-PR-Message: they-closed 74013 X-Gnu-PR-Package: emacs Reply-To: 74013@debbugs.gnu.org Date: Sat, 09 Nov 2024 10:16:03 +0000 Content-Type: multipart/mixed; boundary="----------=_1731147363-16284-3" This is a multi-part message in MIME format... ------------=_1731147363-16284-3 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #73775: 31.0.50; make-vtable errors on an empty list of objects 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 74013@debbugs.gnu.org. --=20 73775: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D73775 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1731147363-16284-3 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 73775-done) by debbugs.gnu.org; 9 Nov 2024 10:15:53 +0000 Received: from localhost ([127.0.0.1]:53514 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t9iVU-0004EF-Fx for submit@debbugs.gnu.org; Sat, 09 Nov 2024 05:15:52 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54746) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t9iVS-0004E0-Gg for 73775-done@debbugs.gnu.org; Sat, 09 Nov 2024 05:15:51 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t9iVJ-0007rX-RK; Sat, 09 Nov 2024 05:15:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=rDIQ+BOHnIsrI50IBnXi/hcwl+XfW8LGZgVhWW7iOk4=; b=kqX3/PnKcU+q bDL3ZJcVbnzn4hchFoGljKYKHOgTvFx6AakrFKy5pJq3yyeONu0dRU83W6HMBmOO0kVqiAPA3EFD+ aoabBErjty0I0hUyb3Xx1/ksOCnxIHVsvRtdNZVTNUjuel+63Ho9da1rDloibINGnQJoQY+MvpvIl 4mb7c2J5iVUhTZFQc+O7kduj74MIpcmIXEEjOQTZAbejkdGFz6bFcwfoO/9XnpGIRVeqdT9OnVFiW FRjDe9PxxRsEHzI4F2X4QZU4hoR3JLHVYWLzYIAPJ1ZabX1yr4uxoTMHiprUW7uI2mYVGTNVAjsJJ 9ke3TR/dOw7CKuISv8tHKQ==; Date: Sat, 09 Nov 2024 12:15:38 +0200 Message-Id: <86o72on25x.fsf@gnu.org> From: Eli Zaretskii To: Joost Kremers In-Reply-To: <86y11wrbet.fsf@fastmail.fm> (message from Joost Kremers on Wed, 06 Nov 2024 09:53:14 +0100) Subject: Re: bug#73775: 30.0.90; vtable: can't handle 0 data rows References: <87ttdhdymx.fsf@gmail.com> <86jzeduqlp.fsf@gnu.org> <04511bb6-0832-47af-8067-2d44ed790f52@alphapapa.net> <864j5gvah8.fsf@gnu.org> <86jzebj599.fsf@fastmail.fm> <86h69cf2aq.fsf@fastmail.fm> <86msik36q6.fsf@gnu.org> <86y11wrbet.fsf@fastmail.fm> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 73775-done Cc: adam@alphapapa.net, 73775-done@debbugs.gnu.org, arstoffel@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Joost Kremers > Cc: adam@alphapapa.net, arstoffel@gmail.com, 73775@debbugs.gnu.org > 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. ------------=_1731147363-16284-3 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 25 Oct 2024 15:24:16 +0000 Received: from localhost ([127.0.0.1]:39196 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t4MAh-0001jW-Vt for submit@debbugs.gnu.org; Fri, 25 Oct 2024 11:24:16 -0400 Received: from lists.gnu.org ([209.51.188.17]:57184) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t4MAd-0001jM-FI for submit@debbugs.gnu.org; Fri, 25 Oct 2024 11:24:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t4MA7-0004KN-06 for bug-gnu-emacs@gnu.org; Fri, 25 Oct 2024 11:23:39 -0400 Received: from mxout1.mail.janestreet.com ([38.105.200.78]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t4MA5-00087T-8d for bug-gnu-emacs@gnu.org; Fri, 25 Oct 2024 11:23:38 -0400 From: Spencer Baugh To: bug-gnu-emacs@gnu.org Subject: 31.0.50; make-vtable errors on an empty list of objects X-Debbugs-Cc: Date: Fri, 25 Oct 2024 11:23:35 -0400 Message-ID: MIME-Version: 1.0 Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=waixah; t=1729869815; bh=NYWTb2RWBBX9HoF/bb3xIWRjIsG+sfvzGIkviYP+eR8=; h=From:To:Cc:Subject:Date; b=iqCdSNSAdtJHEKGbyeH8jYq2E2GhlPWt6zl7l7ZAwJ3p9cm5KXuw6KxlgxU5eogYo yxO9vZ1uRYgVOnxNmnDHT1Nrxq1LdatvhjkreOEgBFat81GrF5X+BDUMq1cX+ny/vk T0hQuwSf9CBtK2uv0GOjH7R3ejF7/IeW3ftdFiq48IyzhVGWlvvSqqIEIgHQZi/1jf QE6OUCrnibRjPnPJeFW6WQ7tdjCRwNis2zdzM0q2czN4EOF1o1s4KJyI3+xXig4y8o rOc3WU3n92NYZFQkWTspp/3ykTPwUzrX0irGOtYah6CfcFuWKgiKMsXrfFW5BC6GX8 lak3RsOCQ0Mtg== Received-SPF: pass client-ip=38.105.200.78; envelope-from=sbaugh@janestreet.com; helo=mxout1.mail.janestreet.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit Cc: Lars Ingebrigtsen X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) 1. emacs -Q 2. M-: (make-vtable :columns '("column") :objects '()) 3. Observe an error like (wrong-number-of-arguments # 0) I ran into this when trying to display a list which can sometimes be empty. At the very least it would be nice for this to provide a better error message. In GNU Emacs 31.0.50 (build 12, x86_64-pc-linux-gnu, X toolkit, cairo version 1.15.12, Xaw scroll bars) of 2024-10-15 built on igm-qws-u22796a Repository revision: 46f52c3cc480ffe36f892e3519bfd9ebc3915f28 Repository branch: iap-1 Windowing system distributor 'The X.Org Foundation', version 11.0.12011000 System Description: Rocky Linux 8.10 (Green Obsidian) Configured using: 'configure -C --with-gif=no --with-x-toolkit=lucid --with-native-compilation=yes --prefix=/home/sbaugh/prefix-jane-emacs' Configured features: CAIRO DBUS FREETYPE GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XINPUT2 XPM LUCID ZLIB Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t minibuffer-regexp-mode: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message mailcap yank-media puny dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068 epg-config gnus-util time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils cl-extra vtable cl-seq mule-util eieio eieio-core cl-macs compile text-property-search comint subr-x ansi-osc ansi-color ring comp-run comp-common rx help-fns radix-tree cl-print byte-opt gv bytecomp byte-compile debug backtrace help-mode find-func cl-loaddefs cl-lib rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd touch-screen tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads dbusbind inotify dynamic-setting system-font-setting font-render-setting cairo x-toolkit xinput2 x multi-tty move-toolbar make-network-process native-compile emacs) Memory information: ((conses 16 152380 9501) (symbols 48 12310 0) (strings 32 43891 1586) (string-bytes 1 1417800) (vectors 16 23718) (vector-slots 8 255468 9571) (floats 8 53 1) (intervals 56 689 0) (buffers 984 13)) ------------=_1731147363-16284-3--