GNU bug report logs - #53520
[PATCH] tabulated-list gradually truncate image

Previous Next

Package: emacs;

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

Date: Tue, 25 Jan 2022 09:09: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 53520 in the body.
You can then email your comments to 53520 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#53520; Package emacs. (Tue, 25 Jan 2022 09:09: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. (Tue, 25 Jan 2022 09:09: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] tabulated-list gradually truncate image
Date: Tue, 25 Jan 2022 12:08:18 +0300
[Message part 1 (text/plain, inline)]
Previously images were displayed as is which would potentially cause
misalignment if the column width were less than the image width.  Image
is now cropped width-wise to fit the column width.  This patch, however,
does not affect the height of the image.

[0001-tabulated-list-gradually-collapse-images.patch (text/x-diff, inline)]
diff --git a/lisp/emacs-lisp/tabulated-list.el b/lisp/emacs-lisp/tabulated-list.el
index 2ace7ebb35..b964dd56e9 100644
--- a/lisp/emacs-lisp/tabulated-list.el
+++ b/lisp/emacs-lisp/tabulated-list.el
@@ -577,7 +577,11 @@ tabulated-list-print-col
                      (propertize label 'help-echo help-echo))))
           ((eq (car col-desc) 'image)
            (insert (propertize " "
-                               'display col-desc
+                               'display `(,col-desc
+                                          (slice 0.0 0.0
+                                                 ,(* (frame-char-width)
+                                                     available-space)
+                                                 1.0))
                                'help-echo help-echo)))
           ((apply 'insert-text-button label (cdr col-desc))))
     (let ((next-x (+ x pad-right width)))

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#53520; Package emacs. (Tue, 25 Jan 2022 13:37:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Thuna <thuna.cing <at> gmail.com>
Cc: 53520 <at> debbugs.gnu.org
Subject: Re: bug#53520: [PATCH] tabulated-list gradually truncate image
Date: Tue, 25 Jan 2022 14:36:32 +0100
Thuna <thuna.cing <at> gmail.com> writes:

> Previously images were displayed as is which would potentially cause
> misalignment if the column width were less than the image width.  Image
> is now cropped width-wise to fit the column width.  This patch, however,
> does not affect the height of the image.

[...]

> +                                          (slice 0.0 0.0
> +                                                 ,(* (frame-char-width)
> +                                                     available-space)

I think it a tabulated-list caller wants to insert images into the
table, they should ensure that the width of the image is appropriate for
the column.  And as you say, this only chops off the parts of the
image -- I think it's more likely that a caller would want to set the
width with :max-width or the like.

So I don't think this makes all that much sense as a feature.

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




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

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

From: Thuna <thuna.cing <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 53520 <at> debbugs.gnu.org
Subject: Re: bug#53520: [PATCH] tabulated-list gradually truncate image
Date: Tue, 25 Jan 2022 17:02:21 +0300
> I think it a tabulated-list caller wants to insert images into the
> table, they should ensure that the width of the image is appropriate for
> the column.

Considering the width of a column can be changed arbitrarily by the user
is it not expected for tabulated-list to handle images in a way that
works for all widths?

> And as you say, this only chops off the parts of the image -- I think
> it's more likely that a caller would want to set the width with
> :max-width or the like.

I do not wholly disagree that the current strategy of slicing the image
may not be the ideal solution for all situations, however is it not
better to handle images even if done poorly (which I would argue is not
the case) than it is to not handle them altogether?

Other methods of (yet unimplemented) resizing an image include scaling
it down and hiding it when it doesn't fit.  All of these methods have
their use cases and it should be relatively simple to introduce a
variable that controls which one is used.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#53520; Package emacs. (Tue, 25 Jan 2022 14:38:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Thuna <thuna.cing <at> gmail.com>
Cc: 53520 <at> debbugs.gnu.org
Subject: Re: bug#53520: [PATCH] tabulated-list gradually truncate image
Date: Tue, 25 Jan 2022 15:37:42 +0100
Thuna <thuna.cing <at> gmail.com> writes:

> I do not wholly disagree that the current strategy of slicing the image
> may not be the ideal solution for all situations, however is it not
> better to handle images even if done poorly (which I would argue is not
> the case) than it is to not handle them altogether?
>
> Other methods of (yet unimplemented) resizing an image include scaling
> it down and hiding it when it doesn't fit.  All of these methods have
> their use cases and it should be relatively simple to introduce a
> variable that controls which one is used.

I think you're trying to use the mode for things it's not really suited
for, and adding things like this will only be half measures.  There's a
lot of things the package using the mode could want to have done with
the contents of the table, and modes can advise tabulated-list-print to
do these transforms if they want to.

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




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

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

From: Thuna <thuna.cing <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 53520 <at> debbugs.gnu.org
Subject: Re: bug#53520: [PATCH] tabulated-list gradually truncate image
Date: Tue, 25 Jan 2022 19:04:15 +0300
> I think you're trying to use the mode for things it's not really
> suited for, and adding things like this will only be half measures.

A clarification on what exactly is expected of tabulated-list-mode with
regards to the current issue and how it fails to (in an unamendable way)
fulfill those expectations would be appreciated.

---

> There's a lot of things the package using the mode could want to have
> done with the contents of the table,

Image resizing can be handled the same way `tabulated-list-printer' is
currently handled; as a variable that points to a function, whose
built-in value supports most common needs.  That would solve the issue
of packages being incapable of controlling the process.

> and modes can advise tabulated-list-print to do these transforms if
> they want to.

As it stands, the variable `tabulated-list-printer' is used to control
the way printing is done and any package that wants to print differently
should be setting that variable to their own printing function.
Packages should not be exposed to the printing process unless they are
offering functionality that /cannot/ be handled by tabulated-list.

---

PS: The actual point of the previous message, which went unanswered was:
> Considering the width of a column can be changed arbitrarily by the user
> is it not expected for tabulated-list to handle images in a way that
> works for all widths?

---

PPS: I am thinking of carrying this conversation over to emacs-devel.
     Are you okay with that?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#53520; Package emacs. (Wed, 26 Jan 2022 13:13:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Thuna <thuna.cing <at> gmail.com>
Cc: 53520 <at> debbugs.gnu.org
Subject: Re: bug#53520: [PATCH] tabulated-list gradually truncate image
Date: Wed, 26 Jan 2022 14:11:53 +0100
Thuna <thuna.cing <at> gmail.com> writes:

> PS: The actual point of the previous message, which went unanswered was:
>> Considering the width of a column can be changed arbitrarily by the user
>> is it not expected for tabulated-list to handle images in a way that
>> works for all widths?

I thought I answered that -- the package should advice the tabulated
list to do the thing it wants.

> PPS: I am thinking of carrying this conversation over to emacs-devel.
>      Are you okay with that?

Sure, go ahead.

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#53520; Package emacs. (Thu, 08 Sep 2022 13:39:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Thuna <thuna.cing <at> gmail.com>
Cc: 53520 <at> debbugs.gnu.org
Subject: Re: bug#53520: [PATCH] tabulated-list gradually truncate image
Date: Thu, 08 Sep 2022 15:38:07 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> I thought I answered that -- the package should advice the tabulated
> list to do the thing it wants.

I think the conclusion here is that we don't want to add this, so I'm
closing this bug report.





Added tag(s) wontfix. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 08 Sep 2022 13:39:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 53520 <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. (Thu, 08 Sep 2022 13:39:02 GMT) Full text and rfc822 format available.

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

This bug report was last modified 1 year and 174 days ago.

Previous Next


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