Subject: bug#76120: This feature is not about "sharing", or a "native" anything.

From: Alvaro Ramirez <[email-masked]>
Date: Sat, 19 Jul 2025 18:45:23 +0100

Gerd Möllmann <[email-masked]> writes:

> Alvaro Ramirez <[email-masked]> writes:
>
>> Thank you Eli and Gerd.
>>
>> Attaching 0008-Add-Send-to-context-menu-item-to-mouse-el.patch
>> addressing your feedback:
>
> Pushed to master.

Thanks for the speedy merge and all your help Gerd!

>
>> Gerd Möllmann <[email-masked]> writes:
>>
>>> Found a crash: Using send-to with in emacs -nw leads to a 
>>> crash.
>>> Maybe send-to--ns-supported-p should check display-graphics-p?
>>
>> Thanks. Hadn't thought of this. Should be fixed in 0008.
>>
>>> And maybe a nice-to have: Building --withput-ns, which I 
>>> normally
>>> do,
>>> send-to "only" offers opening the file externally, which uses 
>>> the
>>> "open" command.
>>> Maybe it would be nice to support "open -a <app>"?
>>
>> Could you share more details? If I'm understanding correctly, 
>> you mean
>> asking users for a custom command?
>>
>> If so, it's worth mentioning send-to-handlers, which enables 
>> adding
>> custom handlers using preferred priority.
>>
>> (defvar-local send-to-handlers '(((:supported .
>> send-to--ns-supported-p)
>>                                  (:collect
>>                                  . send-to--collect-items)
>>                                  (:send
>>                                  . send-to--ns-send-items))
>>                                 ((:supported
>>                                 .
>>                                send-to--open-externally-supported-p)
>>                                  (:collect
>>                                  . send-to--collect-items)
>>                                  (:send
>>                                  . send-to--open-externally)))
>>  "...")
>>
>> This hopefully supports your use-case?
>
> I guess I could add a first entry to send-to-handlers that 
> invokes a
> transient or something that acts as a replacement for the GUI 
> share
> menu. So I'd aay send-to-handlers solves this. Thanks!
>
> (I was thinking of "open -a Mail FILE" which opens a new message 
> with
> FILE attached, while "open FILE" opens some application which is
> associated with the file type, e.g. TextEdit for text 
> files. Sometimes
> one wants to do that, sometimes the other.)

Ah, I see what you mean. Closest I got to that on macOS is M-x 
dwim-shell-commands-macos-open-with:

https://github.com/xenodium/dwim-shell-command/blob/4b077432a94873e5f505c8f569743cfd984eebb1/dwim-shell-commands.el#L1331

If you do add your own handler, I’d love to see what you come up 
with.