all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Sam Steingold <sds@gnu.org>
To: emacs-devel@gnu.org
Subject: dired-guess-shell-alist-* is not enough
Date: Wed, 29 Nov 2023 22:29:56 -0500	[thread overview]
Message-ID: <87plzryl3f.fsf@gnu.org> (raw)

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

             reply	other threads:[~2023-11-30  3:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-30  3:29 Sam Steingold [this message]
2023-11-30  7:18 ` dired-guess-shell-alist-* is not enough Eli Zaretskii
2023-11-30 17:24 ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87plzryl3f.fsf@gnu.org \
    --to=sds@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.