GNU bug report logs - #56552
[PATCH] Make gnus display webp images inline

Previous Next

Package: emacs;

Reported by: Visuwesh <visuweshm <at> gmail.com>

Date: Thu, 14 Jul 2022 12:48:01 UTC

Severity: normal

Tags: patch

Fixed in version 29.1

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 56552 in the body.
You can then email your comments to 56552 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#56552; Package emacs. (Thu, 14 Jul 2022 12:48:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Visuwesh <visuweshm <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 14 Jul 2022 12:48:01 GMT) Full text and rfc822 format available.

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

From: Visuwesh <visuweshm <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Make gnus display webp images inline
Date: Thu, 14 Jul 2022 18:03:13 +0530
[Message part 1 (text/plain, inline)]
Tags: patch

Severity: wishlist

Now that Emacs has native support for display webp images, we should add
a handler to display it inline.

I also added image/webp to mailcap-mime-extensions since in my Debian
installation, I had no entry for it in /etc/mime.types.  
[ Since *.webp wasn't in that variable, nneething didn't do the Right
  Thing™ to display webp file (it inserted the file as plain text).  ]

[0001-Make-gnus-display-webp-images-inline.patch (text/patch, attachment)]
[Message part 3 (text/plain, inline)]
In GNU Emacs 29.0.50 (build 11, x86_64-pc-linux-gnu, X toolkit, Xaw scroll bars)
 of 2022-07-14 built on astatine
Repository revision: d37ba6f259b972aa44c66ecb76210e03a3084183
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101003
System Description: Debian GNU/Linux bookworm/sid

Configured using:
 'configure --with-sound=alsa --with-x-toolkit=lucid --with-json
 --without-xaw3d --without-gconf --without-libsystemd --without-cairo'

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56552; Package emacs. (Thu, 14 Jul 2022 13:43:01 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: Visuwesh <visuweshm <at> gmail.com>
Cc: 56552 <at> debbugs.gnu.org
Subject: Re: bug#56552: [PATCH] Make gnus display webp images inline
Date: Thu, 14 Jul 2022 06:42:44 -0700
Visuwesh <visuweshm <at> gmail.com> writes:

> diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el
> index 7256e5a2f7..79217d3400 100644
> --- a/lisp/gnus/mm-decode.el
> +++ b/lisp/gnus/mm-decode.el
> @@ -193,7 +193,11 @@ mm-inline-media-tests
>    `(("image/p?jpeg"
>       mm-inline-image
>       ,(lambda (handle)
> -       (mm-valid-and-fit-image-p 'jpeg handle)))
> +        (mm-valid-and-fit-image-p 'jpeg handle)))
> +    ("image/webp"
> +     mm-inline-image
> +     ,(lambda (handle)
> +       (mm-valid-and-fit-image-p 'webp handle)))
>      ("image/png"
>       mm-inline-image
>       ,(lambda (handle)

Maybe this comment belongs in a separate wishlist item, but why isn't
this all using the `image-file-name-regexp' function?

I'm looking at `org-display-inline-images', and it seems to me that
org-mode didn't need any additional changes at all to get support for
inline webp images once Emacs had it?  So would it be better if Gnus did
things more like org-mode?

> diff --git a/lisp/net/mailcap.el b/lisp/net/mailcap.el
> index 8ba7f1bec3..ee72eba35d 100644
> --- a/lisp/net/mailcap.el
> +++ b/lisp/net/mailcap.el
> @@ -974,6 +974,7 @@ mailcap-mime-extensions
>      (".ai"    . "application/postscript")
>      (".jpe"   . "image/jpeg")
>      (".jpeg"  . "image/jpeg")
> +    (".webp"  . "image/webp")
>      (".org"   . "text/x-org"))
>    "An alist of file extensions and corresponding MIME content-types.
>  This exists for you to customize the information in Lisp.  It is

This part LGTM.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56552; Package emacs. (Thu, 14 Jul 2022 13:54:02 GMT) Full text and rfc822 format available.

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

From: Visuwesh <visuweshm <at> gmail.com>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 56552 <at> debbugs.gnu.org
Subject: Re: bug#56552: [PATCH] Make gnus display webp images inline
Date: Thu, 14 Jul 2022 19:23:18 +0530
[வியாழன் ஜூலை 14, 2022] Stefan Kangas wrote:

> Visuwesh <visuweshm <at> gmail.com> writes:
>
>> diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el
>> index 7256e5a2f7..79217d3400 100644
>> --- a/lisp/gnus/mm-decode.el
>> +++ b/lisp/gnus/mm-decode.el
>> @@ -193,7 +193,11 @@ mm-inline-media-tests
>>    `(("image/p?jpeg"
>>       mm-inline-image
>>       ,(lambda (handle)
>> -       (mm-valid-and-fit-image-p 'jpeg handle)))
>> +        (mm-valid-and-fit-image-p 'jpeg handle)))
>> +    ("image/webp"
>> +     mm-inline-image
>> +     ,(lambda (handle)
>> +       (mm-valid-and-fit-image-p 'webp handle)))
>>      ("image/png"
>>       mm-inline-image
>>       ,(lambda (handle)
>
> Maybe this comment belongs in a separate wishlist item, but why isn't
> this all using the `image-file-name-regexp' function?
>
> I'm looking at `org-display-inline-images', and it seems to me that
> org-mode didn't need any additional changes at all to get support for
> inline webp images once Emacs had it?  So would it be better if Gnus did
> things more like org-mode?

I will leave this to a Gnus expert to answer.  I arrived at that answer
after edebugging around in the relevant Gnus functions.

>> diff --git a/lisp/net/mailcap.el b/lisp/net/mailcap.el
>
> This part LGTM.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56552; Package emacs. (Thu, 14 Jul 2022 17:43:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Visuwesh <visuweshm <at> gmail.com>
Cc: 56552 <at> debbugs.gnu.org
Subject: Re: bug#56552: [PATCH] Make gnus display webp images inline
Date: Thu, 14 Jul 2022 19:42:13 +0200
Visuwesh <visuweshm <at> gmail.com> writes:

> Now that Emacs has native support for display webp images, we should add
> a handler to display it inline.
>
> I also added image/webp to mailcap-mime-extensions since in my Debian
> installation, I had no entry for it in /etc/mime.types.  
> [ Since *.webp wasn't in that variable, nneething didn't do the Right
>   Thing™ to display webp file (it inserted the file as plain text).  ]

Thanks; pushed to Emacs 29.

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56552; Package emacs. (Thu, 14 Jul 2022 17:46:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 56552 <at> debbugs.gnu.org, Visuwesh <visuweshm <at> gmail.com>
Subject: Re: bug#56552: [PATCH] Make gnus display webp images inline
Date: Thu, 14 Jul 2022 19:44:52 +0200
Stefan Kangas <stefan <at> marxist.se> writes:

>>    `(("image/p?jpeg"
>>       mm-inline-image
>>       ,(lambda (handle)
>> -       (mm-valid-and-fit-image-p 'jpeg handle)))
>> +        (mm-valid-and-fit-image-p 'jpeg handle)))
>> +    ("image/webp"
>> +     mm-inline-image
>> +     ,(lambda (handle)
>> +       (mm-valid-and-fit-image-p 'webp handle)))
>>      ("image/png"
>>       mm-inline-image
>>       ,(lambda (handle)
>
> Maybe this comment belongs in a separate wishlist item, but why isn't
> this all using the `image-file-name-regexp' function?

I think this code is this way for historical reasons -- different image
types were handled differently at one time (I think), but they now all
call `mm-valid-and-fit-image-p'.  So, yes, it should all be rewritten.

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




bug marked as fixed in version 29.1, send any further explanations to 56552 <at> debbugs.gnu.org and Visuwesh <visuweshm <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 14 Jul 2022 17:46: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, 12 Aug 2022 11:24:06 GMT) Full text and rfc822 format available.

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

Previous Next


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