[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#18132: Time for a smarter dired-guess-shell-alist-default? (dired-x.
From: |
Juri Linkov |
Subject: |
bug#18132: Time for a smarter dired-guess-shell-alist-default? (dired-x.el) |
Date: |
Tue, 28 Nov 2023 19:05:46 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) |
> So now pushed to master.
Here is a patch that adds an option to use a system-dependent command
to open a file:
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
- bug#18132: Time for a smarter dired-guess-shell-alist-default? (dired-x.el), Juri Linkov, 2023/11/23
- bug#18132: Time for a smarter dired-guess-shell-alist-default? (dired-x.el), Eli Zaretskii, 2023/11/23
- bug#18132: Time for a smarter dired-guess-shell-alist-default? (dired-x.el), Juri Linkov, 2023/11/24
- bug#18132: Time for a smarter dired-guess-shell-alist-default? (dired-x.el), Eli Zaretskii, 2023/11/24
- bug#18132: Time for a smarter dired-guess-shell-alist-default? (dired-x.el), Juri Linkov, 2023/11/25
- bug#18132: Time for a smarter dired-guess-shell-alist-default? (dired-x.el), Eli Zaretskii, 2023/11/26
- bug#18132: Time for a smarter dired-guess-shell-alist-default? (dired-x.el), Juri Linkov, 2023/11/27
- bug#18132: Time for a smarter dired-guess-shell-alist-default? (dired-x.el),
Juri Linkov <=
- bug#18132: Time for a smarter dired-guess-shell-alist-default? (dired-x.el), Eli Zaretskii, 2023/11/28
- bug#18132: Time for a smarter dired-guess-shell-alist-default? (dired-x.el), Juri Linkov, 2023/11/29
- bug#18132: Time for a smarter dired-guess-shell-alist-default? (dired-x.el), Eli Zaretskii, 2023/11/29