GNU bug report logs - #18132
Time for a smarter dired-guess-shell-alist-default? (dired-x.el)

Previous Next

Package: emacs;

Reported by: Reuben Thomas <rrt <at> sc3d.org>

Date: Mon, 28 Jul 2014 18:27:01 UTC

Severity: wishlist

Fixed in version 30.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


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

From: Juri Linkov <juri <at> linkov.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 18132 <at> debbugs.gnu.org
Subject: Re: bug#18132: Time for a smarter dired-guess-shell-alist-default?
 (dired-x.el)
Date: Tue, 28 Nov 2023 19:05:46 +0200
[Message part 1 (text/plain, inline)]
> So now pushed to master.

Here is a patch that adds an option to use a system-dependent command
to open a file:

[shell-command-guess-open.patch (text/x-diff, inline)]
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 47e97c96ce1..e945052b571 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -1329,6 +1329,7 @@ shell-command-guess-functions
           (choice (function-item shell-command-guess-dired)
                   (function-item shell-command-guess-mailcap)
                   (function-item shell-command-guess-xdg)
+                  (function-item shell-command-guess-open)
                   (function :tag "Custom function")))
   :group 'dired
   :version "30.1")
@@ -1380,6 +1381,29 @@ shell-command-guess-xdg
                   xdg-mime-apps)))
     (append xdg-commands commands)))
 
+(defcustom shell-command-guess-open
+  (cond
+   ((executable-find "xdg-open")
+    "xdg-open")
+   ((executable-find "run-mailcap")
+    "run-mailcap")
+   ((eq system-type 'ms-dos)
+    "start")
+   ((eq system-type 'cygwin)
+    "cygstart")
+   ((eq system-type 'windows-nt)
+    "open")
+   ((eq system-type 'darwin)
+    "open"))
+  "A shell command to open a file externally."
+  :type 'string
+  :group 'dired
+  :version "30.1")
+
+(defun shell-command-guess-open (commands _files)
+  "Populate COMMANDS by the `open' command."
+  (append (ensure-list shell-command-guess-open) commands))
+
 
 ;;; Commands that delete or redisplay part of the dired buffer
 

This bug report was last modified 363 days ago.

Previous Next


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