[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: `M-x yank-media'

From: Lars Ingebrigtsen
Subject: Re: `M-x yank-media'
Date: Sun, 07 Nov 2021 14:32:42 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Eli Zaretskii <eliz@gnu.org> writes:

> What does this require from the clipboard to work?  What are the
> assumptions?

It's basically this on GNU/Linux:

(gui-get-selection 'CLIPBOARD 'TARGETS)
[TIMESTAMP TARGETS MULTIPLE SAVE_TARGETS text/html text/_moz_htmlinfo 
text/_moz_htmlcontext image/png image/jpeg image/bmp image/x-bmp image/x-MS-bmp 
image/x-icon image/x-ico image/x-win-bitmap image/vnd\.microsoft\.icon 
application/ico image/ico image/icon text/ico image/tiff]

This lists the available media types.

I've just had a quick peek at what happens in Macos, and it's very
different there.

(gui-get-selection 'CLIPBOARD 'TARGETS)
=> "http"

So gui-get-selection (or rather, ns-get-selection) has to grow support
for this?  I know absolutely nothing about the internals of the
clipboard on Macos, so I've added Alan to the CCs -- perhaps he has some
insights here.  It basically just calls:

static Lisp_Object
ns_get_foreign_selection (Lisp_Object symbol, Lisp_Object target)
  id pb;
  pb = ns_symbol_to_pb (symbol);
  return pb != nil ? ns_string_from_pasteboard (pb) : Qnil;

Which seems geared towards text/plain only?

I haven't looked at Windows, but I'm guessing it has to grow a similar
set of capabilities.

> AFAIK, that's what "other applications" do: they paste the content
> from the clipboard regardless of the type.  Fine-tuned behavior, where
> the user can select exactly what he/she wants to past and how, is then
> available from a context menu.

Yes, but it would just be too surprising in an Emacs context, in my
opinion.  Changing how something as fundamental as `C-y' works here
would potentially be extremely annoying.

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]