]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix send-to on non-macOS platforms and macOS crash on "emacs -nw"
authorAlvaro Ramirez <me@xenodium.com>
Sat, 19 Jul 2025 15:08:25 +0000 (16:08 +0100)
committerEshel Yaron <me@eshelyaron.com>
Fri, 25 Jul 2025 08:09:51 +0000 (10:09 +0200)
* lisp/send-to.el: Both fixes included.

(cherry picked from commit bd5b1c6b085b17870415009cbf63171e3d2fc91f)

lisp/send-to.el

index 064f5ad66455d92021b94b7386cc644c69fc17fc..431ccfc4bb40596bd65efb68af58d71ad6e81dfd 100644 (file)
@@ -40,7 +40,7 @@
 (declare-function dired-get-filename "dired")
 (declare-function dired-get-marked-files "dired")
 (declare-function dired-move-to-filename "dired")
-(defvar shell-command-guess-open) ;; dired-aux
+(declare-function shell-command-do-open "dired-aux")
 
 (defgroup send-to nil
   "Send files or text to external applications or services."
@@ -159,6 +159,7 @@ explicitly overridden."
 (defun send-to--ns-supported-p ()
   "Return non-nil for macOS platform supporting send capability."
   (and (featurep 'ns)
+       (display-graphic-p)
        (fboundp 'ns-send-items)))
 
 (defun send-to--ns-send-items (items)
@@ -168,23 +169,17 @@ explicitly overridden."
 
 (defun send-to--open-externally-supported-p ()
   "Return non-nil for platforms supporting open externally capability."
-  (unless (boundp 'shell-command-guess-open)
+  (unless (fboundp 'shell-command-do-open)
     (require 'dired-aux))
-  shell-command-guess-open)
+  (fboundp 'shell-command-do-open))
 
 (defun send-to--open-externally (items)
   "Open ITEMS externally (using a non-Emacs application)."
-  (unless (boundp 'shell-command-guess-open)
+  (unless (fboundp 'shell-command-do-open)
     (require 'dired-aux))
   (when (y-or-n-p (format "Open externally: %s ?"
                           (send-to--format-items items)))
-    (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))))))))
+    (shell-command-do-open items)))
 
 (defun send-to--convert-item-to-filename (item)
   "Convert ITEM to a filename.