GNU bug report logs - #53498
[PATCH] Fix tabulated-list-widen-current-column not working for non-strings

Previous Next

Package: emacs;

Reported by: Thuna <thuna.cing <at> gmail.com>

Date: Mon, 24 Jan 2022 11:05:02 UTC

Severity: normal

Tags: patch, wontfix

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 53498 in the body.
You can then email your comments to 53498 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#53498; Package emacs. (Mon, 24 Jan 2022 11:05:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Thuna <thuna.cing <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 24 Jan 2022 11:05:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Thuna <thuna.cing <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Fix tabulated-list-widen-current-column not working for
 non-strings
Date: Mon, 24 Jan 2022 13:55:26 +0300
[Message part 1 (text/plain, inline)]
Previously tabulted-list-widen-current-column failed to work when point
was at or ahead of a button or an image.  It now checks for image width
and button width.  Button width calculation doesn't account for the
properties of the button, however, so that is left there as a FIXME.

[0001-Fix-tabulated-list-widen-current-column-not-working-.patch (text/x-diff, inline)]
From c5d6b80867f7f02b8ecbc5ed7dc8009c570831ac Mon Sep 17 00:00:00 2001
From: Thuna <thuna.cing <at> gmail.com>
Date: Mon, 24 Jan 2022 12:40:13 +0300
Subject: [PATCH] Fix tabulated-list-widen-current-column not working for
 non-strings

* tabulated-list.el (tabulated-list-widen-current-column): Consider
buttons and images when calculating the width of the contents of a
cell.
---
 lisp/emacs-lisp/tabulated-list.el | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/tabulated-list.el b/lisp/emacs-lisp/tabulated-list.el
index 7ad4f7f863..2ace7ebb35 100644
--- a/lisp/emacs-lisp/tabulated-list.el
+++ b/lisp/emacs-lisp/tabulated-list.el
@@ -734,7 +734,16 @@ tabulated-list-widen-current-column
                        (max (setq col-width
                                   (cadr (aref tabulated-list-format
                                               col-nb)))
-                            (string-width (aref entry col-nb)))
+                            (let ((desc (aref entry col-nb)))
+                              (cond
+                               ((stringp desc)
+                                (string-width desc))
+                               ((eq (car desc) 'image)
+                                (car (image-size desc)))
+                               (t (string-width (car desc))
+                                  ;; FIXME: Take into consideration the properties
+                                  ;;        of the button when calculating width
+                                  ))))
                        (or (plist-get (nthcdr 3 (aref tabulated-list-format
                                                       col-nb))
                                       :pad-right)
-- 
2.25.1


Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#53498; Package emacs. (Mon, 24 Jan 2022 14:33:02 GMT) Full text and rfc822 format available.

Message #8 received at 53498 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Thuna <thuna.cing <at> gmail.com>
Cc: 53498 <at> debbugs.gnu.org
Subject: Re: bug#53498: [PATCH] Fix tabulated-list-widen-current-column not
 working for non-strings
Date: Mon, 24 Jan 2022 15:32:15 +0100
Thuna <thuna.cing <at> gmail.com> writes:

> Previously tabulted-list-widen-current-column failed to work when point
> was at or ahead of a button or an image.  It now checks for image width
> and button width.  Button width calculation doesn't account for the
> properties of the button, however, so that is left there as a FIXME.

I didn't know that tabulated-list-mode worked with images at all -- I'd
have thought you'd needed pixel calculations for that to work nicely?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#53498; Package emacs. (Mon, 24 Jan 2022 15:15:02 GMT) Full text and rfc822 format available.

Message #11 received at 53498 <at> debbugs.gnu.org (full text, mbox):

From: Thuna <thuna.cing <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 53498 <at> debbugs.gnu.org
Subject: Re: bug#53498: [PATCH] Fix tabulated-list-widen-current-column not
 working for non-strings
Date: Mon, 24 Jan 2022 18:14:29 +0300
> I didn't know that tabulated-list-mode worked with images at all -- I'd
> have thought you'd needed pixel calculations for that to work nicely?

It really depends on :align-to display property and that seems to handle
non-integer values properly.  It seems to work so long as the image
isn't wider than the column itself so the next thing to do is to patch
in image collapsing into print-col.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#53498; Package emacs. (Mon, 24 Jan 2022 17:32:01 GMT) Full text and rfc822 format available.

Message #14 received at 53498 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Thuna <thuna.cing <at> gmail.com>
Cc: 53498 <at> debbugs.gnu.org
Subject: Re: bug#53498: [PATCH] Fix tabulated-list-widen-current-column not
 working for non-strings
Date: Mon, 24 Jan 2022 18:31:11 +0100
Thuna <thuna.cing <at> gmail.com> writes:

> It really depends on :align-to display property and that seems to handle
> non-integer values properly.  It seems to work so long as the image
> isn't wider than the column itself so the next thing to do is to patch
> in image collapsing into print-col.

I think trying to expand tabulated-list-mode into elements that don't
have the same size isn't going to work well.  We're planning to add a
new library for columnar display of variable pitch stuff instead (so
that you can use images, mix fonts and variable pitch fonts).

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#53498; Package emacs. (Mon, 24 Jan 2022 17:45:02 GMT) Full text and rfc822 format available.

Message #17 received at 53498 <at> debbugs.gnu.org (full text, mbox):

From: Thuna <thuna.cing <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 53498 <at> debbugs.gnu.org
Subject: Re: bug#53498: [PATCH] Fix tabulated-list-widen-current-column not
 working for non-strings
Date: Mon, 24 Jan 2022 20:43:57 +0300
> I think trying to expand tabulated-list-mode into elements that don't
> have the same size isn't going to work well.  We're planning to add a
> new library for columnar display of variable pitch stuff instead (so
> that you can use images, mix fonts and variable pitch fonts).

I don't know if a different library is necessary for columnar display.
I believe tabulated-list-mode has the necessary foundations for such a
purpose.  I imagine with additions to the tabulated-list-format's
accepted props such as :content-type, desired features can be
implemented without the need to rewrite all the code.


PS: I have recently attempted to mail emacs-devel <at> gnu.org (to
help-gnu-emacs <at> gnu.org as well) regarding the wanted behavior of images
as I believe that is where this conversation belongs to however my mails
seem to not be getting through.  I am unsure why this the case as my
mails are seen as sent on my end.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#53498; Package emacs. (Tue, 25 Jan 2022 12:00:02 GMT) Full text and rfc822 format available.

Message #20 received at 53498 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Thuna <thuna.cing <at> gmail.com>
Cc: 53498 <at> debbugs.gnu.org
Subject: Re: bug#53498: [PATCH] Fix tabulated-list-widen-current-column not
 working for non-strings
Date: Tue, 25 Jan 2022 12:59:17 +0100
Thuna <thuna.cing <at> gmail.com> writes:

> I don't know if a different library is necessary for columnar display.
> I believe tabulated-list-mode has the necessary foundations for such a
> purpose.

I don't -- it would require a pretty full rewrite to handle these
things.  (And tabulated-list-mode has many other problems, like not
being able to have other text in the buffer, etc.)

So adding things like this, in my opinion, just makes
tabulated-list-mode more convoluted, but won't work properly for most
people, so I don't think we'll try to take tabulated-list-mode in this
direction, and I'm therefore closing this bug report.

> PS: I have recently attempted to mail emacs-devel <at> gnu.org (to
> help-gnu-emacs <at> gnu.org as well) regarding the wanted behavior of images
> as I believe that is where this conversation belongs to however my mails
> seem to not be getting through.  I am unsure why this the case as my
> mails are seen as sent on my end.

Seems like they're getting through OK to me?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) wontfix. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 25 Jan 2022 12:00:03 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 53498 <at> debbugs.gnu.org and Thuna <thuna.cing <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 25 Jan 2022 12:00:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#53498; Package emacs. (Tue, 25 Jan 2022 12:17:02 GMT) Full text and rfc822 format available.

Message #27 received at 53498 <at> debbugs.gnu.org (full text, mbox):

From: Thuna <thuna.cing <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 53498 <at> debbugs.gnu.org
Subject: Re: bug#53498: [PATCH] Fix tabulated-list-widen-current-column not
 working for non-strings
Date: Tue, 25 Jan 2022 15:16:19 +0300
> So adding things like this, in my opinion, just makes
> tabulated-list-mode more convoluted, but won't work properly for most
> people, so I don't think we'll try to take tabulated-list-mode in this
> direction, and I'm therefore closing this bug report.

I understand the reasoning for not supporting images however this patch
fixes the bug for buttons as well, which I assume will be supported.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 22 Feb 2022 12:24:11 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 120 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.