Subject: Re: bug#71909: 30.0.60; yank-media on MS-Windows

From: Cecilio Pardo <[email-masked]>
Date: Thu, 24 Oct 2024 01:13:49 +0200

Getting back to this, I have been checking what some programs (a couple
of nonfree ones) provide on the clipboard for different media types.

GIMP           | Copy pixels           | PNG
LibreOffice    | Copy vectorial object | PNG, GDIMetafile
LibreOffice    | Copy embedded image   | PNG
LibreOffice    | Copy text             | RTF, HTML, ODT
LibreOffice    | Copy equation         | RTF
LibreOffice    | Copy Calc cells       | PNG, RTF, HTML, GDIMetafile
Firefox        | Copy Image            | DIBV5
Firefox        | Copy Text             | HTML, RTF
Krita          | Copy pixels           | PNG
Inkscape       | Copy vector           | SVG, PNG, PDF, Postscript
Windows Paint  | Copy pixels           | PNG
Acrobat Reader | Copy text             | RTF

They offer more formats, but in many cases they are not really there 
(the yank-media code knows about this, and in fact checks every type to 
purge the empty ones from list), or are propietary.

So I think we should stick to these:

- Rename PNG to image/png, so the emacs programs find it. If there are 
other image formats with mime spec, yank-media will let the user choose. 
For example, krita offers a huge amount of formats, as mime.

- If no PNG is offered, but DIBV5 is, like Firefox, convert the pixel 
data to a PNG file, and offer it as image/png. We don't loose anything 
converting the BMP to PNG, and the programs that use yank-media for 
images (message-mode, org-mode) need a file, not an in-memory image 
object. And PNG is a much better format.

- GDIMetafile would be ideally converted to SVG. Offering the metafile 
as it is makes little sense in my opinion. It is not a very used format.

- Text as HTML should be offered as text/html, for the use of html 
editing modes.

- Rtf text should be offered also to org-mode, adding a new yank handler 
to convert rtf format to org format. I am working on that. We could also 
provide it to enriched-mode, but it could use very few properties of the 
text. Anyway, this is not a Windows issue, and it still a little far away.