From: JD Smith <jdtsmith@gmail.com>
To: Juergen Fenn <jfenn@gmx.net>
Cc: Ihor Radchenko <yantar92@posteo.net>,
Visuwesh <visuweshm@gmail.com>,
emacs-orgmode@gnu.org
Subject: Re: [ANN] Org mode 9.7 is out
Date: Mon, 17 Jun 2024 21:03:59 -0400 [thread overview]
Message-ID: <7E5BE2B1-9A3C-48ED-82B9-F012E5CEF9F2@gmail.com> (raw)
In-Reply-To: <3d5ce16e-c0fe-4059-a4b3-ebbc03ba3211@gmx.net>
[-- Attachment #1: Type: text/plain, Size: 4655 bytes --]
> 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.
A few years ago, I wrote a small package for pasting PNG and PDF data from the Mac clipboard into org documents as attachments, which I still use: https://github.com/jdtsmith/org-mac-image-paste.
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.
[1] The code for pngpaste might be informative: https://github.com/jcsalterego/pngpaste/blob/main/pngpaste.m.
[-- Attachment #2: Type: text/html, Size: 9242 bytes --]
next prev parent reply other threads:[~2024-06-18 1:07 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-02 9:42 [ANN] Org mode 9.7 is out Ihor Radchenko
2024-06-02 11:40 ` Dr. Arne Babenhauserheide
2024-06-02 12:07 ` Ihor Radchenko
2024-06-02 14:01 ` Juergen Fenn
2024-06-02 15:05 ` Ihor Radchenko
2024-06-02 15:21 ` Juergen Fenn
2024-06-02 18:05 ` Ihor Radchenko
2024-06-02 19:13 ` Juergen Fenn
2024-06-02 20:11 ` Ihor Radchenko
2024-06-02 21:17 ` Juergen Fenn
2024-06-03 5:06 ` Visuwesh
2024-06-05 5:34 ` Juergen Fenn
2024-06-05 6:01 ` Visuwesh
2024-06-05 14:20 ` Ihor Radchenko
2024-06-06 6:20 ` Visuwesh
2024-06-06 11:55 ` Juergen Fenn
2024-06-06 15:17 ` Ihor Radchenko
2024-06-06 20:41 ` Juergen Fenn
2024-06-17 21:16 ` JD Smith
2024-06-18 1:03 ` JD Smith [this message]
2024-06-05 16:03 ` Juergen Fenn
2024-06-29 21:01 ` Juergen Fenn
2024-06-03 9:11 ` Ihor Radchenko
2024-06-02 16:30 ` Russell Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7E5BE2B1-9A3C-48ED-82B9-F012E5CEF9F2@gmail.com \
--to=jdtsmith@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=jfenn@gmx.net \
--cc=visuweshm@gmail.com \
--cc=yantar92@posteo.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).