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

From: Cecilio Pardo <[email-masked]>
Date: Thu, 24 Oct 2024 12:43:29 +0200

On 24/10/2024 11:38, Eli Zaretskii wrote:
>> Date: Thu, 24 Oct 2024 10:39:13 +0200
>> From: Cecilio Pardo <[email-masked]>
>>
>> On 24/10/2024 9:18, Eli Zaretskii wrote:
>>
>>> I'm not sure I follow: isn't yank-media about yanking the image into
>>> the current buffer?  If so, why is having a file important, let alone
>>> necessary?
>>
>> I mean they need data in the format that would go into a file, PNG, BMP,
>> etc. Not the kind of data that is a DIB. We could easily convert in to a
>> BMP file, but, once we need to manipulate it, better to give a PNG.
> 
> Maybe we need an image-save-as function, to save an image's data to a
> file, then?  What you describe sounds like a separate requirement.
> 
>> org-mode stores the yanked images as attachments, saving files.
>> message-mode stores the images in the message like this:
>>
>> <#part type="image/png" disposition=inline data-encoding=base64 raw=t>
>> iVBORw0KGgoAA...
>>
>> That is, not a file in disk, but the data that would go into a PNG file.
> 
> If a file is needed, writing the image data to a file will solve it
> (and is a useful feature to have, regardless).
> 
> Does yank-media produce image files on GNU/Linux, when it yanks
> images?
> 

No, yank-media calls a handler (lisp function) given by the current mode 
that receives raw data for the clipboard content. The content 
corresponds to some file format. The mode specifies which mime types it 
wants, and specify a handler for each one of them. If after invoking 
yank-media there is more that one format accepted by the mode, the user 
has to choose one.

Org-mode saves the files to disk, message-mode embeds them in the body 
of the message, other modes could do differently.

This behaviour is only for GNU/Linux (and other ports I guess), on 
Windows yank-media does nothing currently.

>>> Where we have both RTF and HTML, should we perhaps use HTML and pass
>>> it through shr, to produce text with faces, rather than raw HTML?
>>> Once RTF handler exists, we could use that instead, but having it
>>> rendered via HTML might be a useful option anyway.
>>
>> What mode could benefit from yanking propertized test?
> 
> Any descendant of Text mode can use propertized text.  It doesn't
> _have_ to be so, but it's possible, and I think we should offer that
> if we can.

Then we can make Text-mode add a media handler for html-text (and 
hopefully tich text later), and convert it into propertized text.