unofficial mirror of emacs-devel@gnu.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

* Re: dired-guess-shell-alist-* is not enough
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2023-11-30  7:18 UTC (permalink / raw)
  To: sds; +Cc: emacs-devel

> From: Sam Steingold <sds@gnu.org>
> Date: Wed, 29 Nov 2023 22:29:56 -0500
> 
> 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:

I believe something similar is being worked on in bug#18132.  Please
take a look at the patches proposed there, and comment on them.

Thanks.



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

* Re: dired-guess-shell-alist-* is not enough
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Juri Linkov @ 2023-11-30 17:24 UTC (permalink / raw)
  To: emacs-devel

> 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").
>
> @@ -1290,7 +1290,8 @@ dired-guess-default
> -      programs)))
> +      (or programs
> +          dired-guess-shell-default))))

A new option 'shell-command-guess-functions' in bug#18132
allows to define any order, for example, to put the OS command
before all `dired-guess' candidates, not at the end.



^ permalink raw reply	[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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).