Am 05.06.24 um 08:01 Uhr schrieb Visuwesh:
>> M-x yank-media-types RET yields:
>>
>> Yank type:
>> clipboard:image/tiff
>> clipboard:STRING
>> clipboard:text/plain
> I'm afraid there's nothing much we can do.  IIUC, you copy the file from
> a file manager, so Org expects clipboard to be something like
>
>     Possible completions are:
>     clipboard:x-special/gnome-copied-files
>     primary:...
>
> where clipboard:x-special/gnome-copied-files gives
>
>     copy
>     file:///home/viz/tmp/2-gnus_stipple.png
>
> but given there's neither image/jpeg nor a special type like the above,
> Org's yank-media copies the image/tiff data (the regexp used by Org
> looks for mime-types that match the regexp "image/.*").
> I am guessing clipboard:text/plain contains the link to the file, am I
> right?  But this feels fragile to rely on.
>
> What happens when you copy multiple images to the clipboard from the
> file manager?  Is there a difference in yank-media-types' output?  What
> if you copy a non-image file to the clipboard? Say a PDF file.

If I copy Command-c two different jpg files in Finder, Org seems not to
be able to process any file. There is only

clipboard:STRING
clipboard:text/plain

in the completions buffer, no image MIME type.

When I try M-x yank-media RET I get the message:

user-error: No handler in the current buffer for anything on the clipboard

But it is getting even more weird when I try a different MIME type, say
PDF, as you suggested. I've just tried the latest LaTeX News 39 which
happens to be on my desktop. It has not been published yet, but you can
easily compile it yourself from
<https://github.com/latex3/latex2e/blob/develop/base/doc/ltnews39.tex>.
Copy with Command-c from Finder, then M-x yank-media RET also yields:

clipboard:image/tiff
clipboard:STRING
clipboard:text/plain

While M-x yank-media RET yields:

----
* Test
:ATTACH:
:PROPERTIES:
:ID:       105A314B-BCA8-41CC-8ED8-FA97F70AAE85
:END:

[[attachment:clipboard-20240605T174306.tiff]]
-----

and now I am indeed prompted for the =Yank type= from the three options
above. I can select with Cursor-up or Cursor-down.

- If I select image/tiff the PDF is added in plain text, it seems.
- Selecting STRING simply pastes the filename =ltnews39.pdf= to buffer.
- Selecting text/plain pastes the path to the file to buffer.

> I don't have access to a Mac but if you can find documentation on how
> Finder puts the relevant data in the clipboard, that would be useful.
> [ In Linux, you expect the x-special/gnome-copied-files or somesuch
>   TARGET.  ]

I'm afraid I cannot provide this information because I am not a
developer, so I don't know which documents to consult for this.

I just would like to add that such internals in macOS may change over
time. I'm on Ventura, which is not the latest version of macOS, that's
Sonoma. Its successor macOS 15 will probably be released in a few
months. Even the way self-compiled Emacs is run are said to vary from
one version to another. I cannot tell because I did not compile Emacs
before I switched to Ventura, but I trust such reports are true.

Regards,
Jürgen.

Reply via email to