28.0.50; tabulated-list-print (with non-nil UPDATE argument) doesn't clean up excess entries

  • Done
  • quality assurance status badge
Details
2 participants
  • Lars Ingebrigtsen
  • Shitikanth
Owner
unassigned
Submitted by
Shitikanth
Severity
normal
S
S
Shitikanth wrote on 24 Aug 2021 20:55
(address . bug-gnu-emacs@gnu.org)
CALjXJSTnjJeoNLzLDT_ePEqNQPT_sXMhsAT71BtzYWdDrDCWMA@mail.gmail.com
(tabulated-list-print nil t) does not seem to clean up excess remaining
entries/lines if the number of tabulated-list-entries has decreased.

Demo:
(defun demo-generate-entries (n)
(mapcar (lambda (i)
(list i (vector (format "title %s" i))))
(number-sequence 1 n)))

(let ((buf (get-buffer-create "*demo*")))
(with-current-buffer buf
(tabulated-list-mode)
(setq tabulated-list-format '[("title" 70 t)])
(setq tabulated-list-sort-key '("title"))
(setq tabulated-list-entries (demo-generate-entries 8))
(tabulated-list-print)
(pop-to-buffer buf)
(setq tabulated-list-entries (demo-generate-entries 4))
(tabulated-list-print nil t)
))

Expected behaviour:
At the end, *demo* buffer should show only 4 entries.

Observed behaviour:
*demo* buffer still holds 8 entries, still showing 4 entries that are
now removed from tabulated-list-entries.
S
S
Shitikanth wrote on 24 Aug 2021 21:13
(address . 50194@debbugs.gnu.org)
CALjXJSRs-2v+xhLQmMGs2HZD=efmFtX1GBmSpz1E4BGpMkEMHw@mail.gmail.com
Proposed fix.

On Wed, 25 Aug 2021 at 00:26, Shitikanth <shitikanth1@gmail.com> wrote:
Toggle quote (31 lines)
>
> (tabulated-list-print nil t) does not seem to clean up excess remaining
> entries/lines if the number of tabulated-list-entries has decreased.
>
> Demo:
> (defun demo-generate-entries (n)
> (mapcar (lambda (i)
> (list i (vector (format "title %s" i))))
> (number-sequence 1 n)))
>
> (let ((buf (get-buffer-create "*demo*")))
> (with-current-buffer buf
> (tabulated-list-mode)
> (setq tabulated-list-format '[("title" 70 t)])
> (setq tabulated-list-sort-key '("title"))
> (setq tabulated-list-entries (demo-generate-entries 8))
> (tabulated-list-print)
> (pop-to-buffer buf)
> (setq tabulated-list-entries (demo-generate-entries 4))
> (tabulated-list-print nil t)
> ))
>
> Expected behaviour:
> At the end, *demo* buffer should show only 4 entries.
>
> Observed behaviour:
> *demo* buffer still holds 8 entries, still showing 4 entries that are
> now removed from tabulated-list-entries.
>
>
>
L
L
Lars Ingebrigtsen wrote on 25 Aug 2021 13:35
(name . Shitikanth)(address . shitikanth1@gmail.com)(address . 50194@debbugs.gnu.org)
874kbdlpug.fsf@gnus.org
Shitikanth <shitikanth1@gmail.com> writes:

Toggle quote (2 lines)
> Proposed fix.

Makes sense to me; applied to Emacs 28.

This change was small enough to apply without assigning copyright to the
FSF, but for future patches you want to submit, it might make sense to
get the paperwork started now, so that subsequent patches can be applied
speedily. Would you be willing to sign such paperwork?

--
(domestic pets only, the antidote for overdose, milk.)
L
L
Lars Ingebrigtsen wrote on 25 Aug 2021 13:35
control message for bug #50194
(address . control@debbugs.gnu.org)
8735qxlpu8.fsf@gnus.org
close 50194 28.1
quit
?