all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* dired-guess-shell-alist-* is not enough
@ 2023-11-30  3:29 Sam Steingold
  2023-11-30  7:18 ` Eli Zaretskii
  2023-11-30 17:24 ` Juri Linkov
  0 siblings, 2 replies; 3+ messages in thread
From: Sam Steingold @ 2023-11-30  3:29 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 197 bytes --]

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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 1148 bytes --]

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"))

[-- Attachment #3: Type: text/plain, Size: 276 bytes --]





-- 
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.

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-11-30 17:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-30  3:29 dired-guess-shell-alist-* is not enough Sam Steingold
2023-11-30  7:18 ` Eli Zaretskii
2023-11-30 17:24 ` Juri Linkov

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.