GNU bug report logs - #76120
[PATCH] Expose the native sharing dialog (macOS)

Previous Next

Package: emacs;

Reported by: Álvaro Ramírez <alvaro <at> xenodium.com>

Date: Fri, 7 Feb 2025 15:00:02 UTC

Severity: wishlist

Tags: patch

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #439 received at 76120 <at> debbugs.gnu.org (full text, mbox):

From: Alvaro Ramirez <alvaro <at> xenodium.com>
To: Eli Zaretskii <eliz <at> gnu.org>, Gerd Möllmann
 <gerd.moellmann <at> gmail.com>
Cc: 76120 <at> debbugs.gnu.org, alan <at> idiocy.org, rpluim <at> gmail.com,
 stefankangas <at> gmail.com
Subject: Re: bug#76120: This feature is not about "sharing", or a "native"
 anything.
Date: Sat, 19 Jul 2025 17:34:34 +0100
[Message part 1 (text/plain, inline)]
Thank you Eli and Gerd.

Attaching 0008-Add-Send-to-context-menu-item-to-mouse-el.patch 
addressing your feedback:

1. Replaces call-process for shell-command-do-open
2. Enables using send-to on macOS via "emacs -nw"

Eli Zaretskii <eliz <at> gnu.org> writes:

> Thanks!
>
> Alvaro, there's a bug in send-to.el.  Here:
>
>     (dolist (item items)
>       (with-temp-buffer
>         (unless (zerop (call-process
>                         shell-command-guess-open nil 
>                         (current-buffer) t
>                         (send-to--convert-item-to-filename
>                          item)))
>           (error "%s" (string-trim (buffer-string))))))))
>
> This passes the result of shell-command-guess-open to 
> call-process,
> but shell-command-guess-open returns a _shell_command_, not a 
> program
> name.  So the code should call call-process-shell-command or 
> maybe
> process-file-shell-command.
>
> For example, on MS-Windows shell-command-guess-open returns the
> command "start", but it is not necessarily the name of a 
> program, it
> is usually a built-in command of the Windows shell.

Found the shell-command-do-open function, a nice new addition, 
handling all supported OSs/cases.

Gerd Möllmann <gerd.moellmann <at> gmail.com> 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?

[0008-Add-Send-to-context-menu-item-to-mouse-el.patch (text/x-patch, attachment)]

This bug report was last modified 30 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.