emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

dired-guess-shell-alist-* is not enough


From: Sam Steingold
Subject: dired-guess-shell-alist-* is not enough
Date: Wed, 29 Nov 2023 22:29:56 -0500
User-agent: Gnus/5.13 (Gnus v5.13)

Hi,
when neither `dired-guess-shell-alist-user' nor
`dired-guess-shell-alist-default' have anything, one might want to
delegate to the OS ("open" or "start").

Here is a patch that implements it:

diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 47e97c96ce1..320afa48bfe 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -1290,7 +1290,8 @@ dired-guess-default
              nil)))))
     (if (length= programs 1)
         (car programs)
-      programs)))
+      (or programs
+          dired-guess-shell-default))))
 
 ;;;###autoload
 (defun dired-guess-shell-command (prompt files)
diff --git a/lisp/dired.el b/lisp/dired.el
index 97645c731c8..eeea88fdae9 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -468,6 +468,18 @@ dired-guess-shell-alist-user
   :type '(alist :key-type regexp :value-type (repeat sexp))
   :version "29.1")
 
+(defcustom dired-guess-shell-default
+  (cond ((memq system-type '(gnu/linux darwin))
+         "open")
+        ((memq system-type '(windows-nt ms-dos))
+         "start"))
+  "The fall-back command when nothing specific is found.
+Used when neither `dired-guess-shell-alist-user' nor
+`dired-guess-shell-alist-default' supply anything."
+  :group 'dired-guess
+  :type 'string
+  :version "30.1")
+
 (defcustom dired-guess-shell-gnutar
   (catch 'found
     (dolist (exe '("tar" "gtar"))



-- 
Sam Steingold (https://aphar.dreamwidth.org/) on Pop 22.04 (jammy) X 
11.0.12101004
https://lastingimpactpsychology.com https://steingoldpsychology.com
https://mideasttruth.com https://honestreporting.com
Send $10 for a brochure on how to make money selling brochures.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]