[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#44068: 28.0.50; Faulty uses of tabulated-list-format
From: |
Stephen Berman |
Subject: |
bug#44068: 28.0.50; Faulty uses of tabulated-list-format |
Date: |
Mon, 19 Oct 2020 00:35:38 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
On Mon, 19 Oct 2020 00:17:12 +0200 Stephen Berman <stephen.berman@gmx.net>
wrote:
> On Sun, 18 Oct 2020 15:01:31 -0700 Stefan Kangas <stefankangas@gmail.com>
> wrote:
[...]
>> Thanks for the patch. I've tested it and it indeed fixes several bugs
>> in this area.
>>
>> But it got me thinking: for the final column at least, maybe we should
>> just make tabulated-list-mode work as advertised, and itself figure out
>> that it should use this length? That way, we would solve any bugs also
>> for external packages that have been misled by the doc string. Or would
>> that have any downsides?
>
> That was my first thought when I noticed the problem, and came up with
> this patch to fix it:
>
> diff --git a/lisp/emacs-lisp/tabulated-list.el
> b/lisp/emacs-lisp/tabulated-list.el
> index b13f609f88..d6bec72ade 100644
> --- a/lisp/emacs-lisp/tabulated-list.el
> +++ b/lisp/emacs-lisp/tabulated-list.el
> @@ -271,11 +271,12 @@ tabulated-list-init-header
> (button-props `(help-echo "Click to sort by column"
> mouse-face header-line-highlight
> keymap ,tabulated-list-sort-button-map))
> + (len (length tabulated-list-format))
> (cols nil))
> (if display-line-numbers
> (setq x (+ x (tabulated-list-line-number-width))))
> (push (propertize " " 'display `(space :align-to ,x)) cols)
> - (dotimes (n (length tabulated-list-format))
> + (dotimes (n len)
> (let* ((col (aref tabulated-list-format n))
> (label (nth 0 col))
> (width (nth 1 col))
> @@ -293,7 +294,11 @@ tabulated-list-init-header
> (apply 'propertize
> (concat label
> (cond
> - ((> (+ 2 (length label)) width) "")
> + ((and (> (+ 2 (length label)) width)
> + (not (= (tabulated-list--column-number
> + (car tabulated-list-sort-key))
> + (1- len))))
> + "")
> ((cdr tabulated-list-sort-key)
> (format " %c"
> tabulated-list-gui-sort-indicator-desc))
>
> But after I saw that final (rightmost) column in the problematic cases
> was simply given too narrow a width, I thought it better to just change
> that and clarify the doc. But maybe you're right that the misleading
> doc has affected third-party packages.
I note, though, that this patch, won't fix too narrow non-final columns,
as the Archive column in package-menu-mode, or the Status column in
process-menu-mode, etc.
Steve Berman
bug#44068: 28.0.50; Faulty uses of tabulated-list-format, Eli Zaretskii, 2020/10/19
- bug#44068: 28.0.50; Faulty uses of tabulated-list-format, Stephen Berman, 2020/10/19
- bug#44068: 28.0.50; Faulty uses of tabulated-list-format, Eli Zaretskii, 2020/10/19
- bug#44068: 28.0.50; Faulty uses of tabulated-list-format, Stephen Berman, 2020/10/19
- bug#44068: 28.0.50; Faulty uses of tabulated-list-format, Stephen Berman, 2020/10/20
- bug#44068: 28.0.50; Faulty uses of tabulated-list-format, Stefan Kangas, 2020/10/29
- bug#44068: 28.0.50; Faulty uses of tabulated-list-format, Stephen Berman, 2020/10/29
- bug#44068: 28.0.50; Faulty uses of tabulated-list-format, Stefan Kangas, 2020/10/29