Subject: Re: bug#71909: 30.0.60;

From: Eli Zaretskii <[email-masked]>
Date: Sat, 05 Oct 2024 22:31:47 +0300

> Date: Sat, 5 Oct 2024 19:14:20 +0200
> Cc: [email-masked]
> From: Cecilio Pardo <[email-masked]>
> 
> On 05/10/2024 14:42, Eli Zaretskii wrote:
> 
> > Btw, perhaps we should discuss the implementation ideas you have
> > first.  I'm guessing you are going to somehow map the clipboard
> > formats defined by Windows to MIME types, then I wonder what should we
> > do with the virtually open-ended set of Windows clipboard formats.
> > 
> > Or maybe you have other ideas?
> 
> Yes, I was thinking about mapping some of the formats, and ignoring the 
> rest. Looking at the lisp files inside emacs, only these formats seem to 
> be in use:
> 
> image/*
> text/html (which is treated as text in sgml-mode)
> x/special-\\(?:gnome\\|KDE\\|mate\\)-files
> 
> So CF_BITMAP and CF_HDROP, and maybe CF_HTML would cover all. Metafiles 
> could be converted to bitmaps.
> 
> As for other formats, other than offer them as application/octet-stream, 
> I don't know.

If you invoke "M-: (gui-get-selection 'CLIPBOARD 'TARGETS) RET" after
copying something to the clipboard, you will see some very weird
format names there.  For the standard formats, we convert them to
something similar to what X Window system produces (see
w32-selection-targets), but the rest are returned as-is.  For example,
after copying an image from Firefox, I get this as the return value of
the above evaluation:

  [DataObject text/html HTML\ Format text/_moz_htmlinfo text/_moz_htmlcontext application/x-moz-file-promise-url application/x-moz-file-promise-dest-filename FILE_NAMES Preferred\ DropEffect application/x-moz-nativeimage DIB Ole\ Private\ Data BITMAP nil]

There's no image/* here, only DIB and BITMAP (which correspond to
CF_DIB and CF_BITMAP clipboard formats).  There are also a lot of
text/* formats, but they are all non-standard, except, perhaps,
text/html.  Do you have ideas how to select the proper format and how
to yank the data?

What do the x/special-* formats correspond to on Windows?