On Jun 6, 2024, at 4:41 PM, Juergen Fenn <jfenn@gmx.net> wrote:
Am 06.06.24 um 17:17 Uhr schrieb Ihor Radchenko: Juergen Fenn <jfenn@gmx.net> writes:
Am 06.06.24 um 08:20 Uhr schrieb Visuwesh:
Thanks for the analysis. Given that Alan says GNUStep cannot handle non-text clipboard items, I cannot propose anything myself. It would be nice if a Mac user can write a report and send it to the Emacs developers. Perhaps Juergen can do it?
Of course, I /could/ do this, but given the fact that you have already found out about /some/ internals wouldn't it be better a macOS/NextStep developer would look into this in the first place and hence write the report with some somre insight?
Unfortunately, there are no MacOS developers among Org mode maintainers. I personally do not even have access to MacOS for testing.
Since you at least can test things on MacOS, it would be helpful if you can create the recipe suitable for Emacs devs to reproduce the problem. They may also ask extra information from your MacOS.
I see. Thanks for explaining. So, I will write a bug report that draws on our discussion and send it to emacs-devel over the weekend. My switch from Ventura to Sonoma shortly may make things more complicated, as I cannot foresee in howmuch the two platforms differ under the hood, but I'm afraid I cannot postpone the upgrade.
With the recent work on yank-media I'm hopeful I can retire this package soon. I found I could pull PDF data to file from the clipboard via AppleScript (and display in the emacs-mac build using its image-io backend), but used pngpaste[1] tool for PNG data. When an image is on the clipboard, PNG data are indeed available from the clipboard («class PNGf»), as can be seen via AppleScript. You can use AppleScript to inquire about the state of the clipboard. For example, after taking a screenshot, I see:
% osascript -e "clipboard info" «class PNGf», 121849, «class 8BPS», 401974, GIF picture, 21636, «class jp2 », 21831, JPEG picture, 35062, TIFF picture, 369790, «class BMP », 366218, «class TPIC», 285265
On copying an image from a website, I get:
% osascript -e "clipboard info" TIFF picture, 91686, URL, 81, «class urln», 6, «class utf8», 81, «class rtfd», 2652, «class weba», 5679, «class HTML», 800, «class 8BPS», 103154, GIF picture, 681, «class jp2 », 5455, JPEG picture, 1059, «class PNGf», 6282, «class BMP », 44298, «class TPIC», 8066, «class ut16», 164, string, 81, Unicode text, 162
For images grabbed from web-pages, you can actually get the URL information if you like and include that in or near the attachment link.
Here's after copying a GIF file from the Finder:
% osascript -e "clipboard info" «class furl», 41, «class ut16», 24, «class utf8», 11, «class icns», 1137764, Unicode text, 22, string, 11, «class 8BPS», 1295026, GIF picture, 74698, «class jp2 », 110628, JPEG picture, 62209, TIFF picture, 4198020, «class PNGf», 305211, «class BMP », 4194442, «class TPIC», 796024
Notice the file-URL there, which you can get (here using the JXA=_javascript_ flavor of AppleScript, with a UTI for the file-url, which is apparently the more modern way to do it):
% osascript -l _javascript_ -e 'ObjC.import("AppKit"); $.NSPasteboard.generalPasteboard.stringForType("public.file-url");' file:///Users/xxyz/Desktop/output.gif
You can even coerce the clipboard to be in a certain format:
% osascript -e "clipboard info" TIFF picture, 35766, URL, 37, «class urln», 7, «class utf8», 37, «class rtfd», 1082, «class weba», 3643, «class HTML», 820, «class 8BPS», 9884, GIF picture, 434, «class jp2 », 4617, JPEG picture, 1268, «class PNGf», 1527, «class BMP », 32538, «class TPIC», 2446, «class ut16», 76, string, 37, Unicode text, 74 % osascript -e "set the clipboard to (the clipboard as JPEG picture)" % osascript -e "clipboard info" JPEG picture, 1268, «class 8BPS», 8622, GIF picture, 687, «class jp2 », 4671, TIFF picture, 27704, «class PNGf», 2508, «class BMP », 24534, «class TPIC», 4372
My knowledge doesn't go any deeper than that but thought I'd share what I know.
|