mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-03-05 05:21:26 -08:00
* lisp/dired-aux.el (shell-command-guess-open): New defcustom (bug#18132).
(shell-command-guess-open): New function. (shell-command-guess-functions): Add 'shell-command-guess-open' to choice.
This commit is contained in:
parent
dcd755dabc
commit
5519ec4746
2 changed files with 27 additions and 3 deletions
8
etc/NEWS
8
etc/NEWS
|
|
@ -505,9 +505,11 @@ default is nil.
|
|||
|
||||
*** New user option 'shell-command-guess-functions'.
|
||||
It defines how to populate a list of commands available
|
||||
for 'M-!', 'M-&', '!', '&' based on marked files in Dired.
|
||||
Possible backends are 'dired-guess-default', MIME types,
|
||||
XDG configuration.
|
||||
for 'M-!', 'M-&', '!', '&' and the context menu "Open With"
|
||||
based on marked files in Dired. Possible backends are
|
||||
'dired-guess-default', MIME types, XDG configuration
|
||||
and a universal command such as "open" or "start"
|
||||
that delegates to the OS.
|
||||
|
||||
** Ediff
|
||||
|
||||
|
|
|
|||
|
|
@ -1329,6 +1329,7 @@ such as added new commands."
|
|||
(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,27 @@ after adding own commands to the composite list."
|
|||
xdg-mime-apps)))
|
||||
(append xdg-commands commands)))
|
||||
|
||||
(defcustom shell-command-guess-open
|
||||
(cond
|
||||
((executable-find "xdg-open")
|
||||
"xdg-open")
|
||||
((memq system-type '(gnu/linux darwin))
|
||||
"open")
|
||||
((memq system-type '(windows-nt ms-dos))
|
||||
"start")
|
||||
((eq system-type 'cygwin)
|
||||
"cygstart")
|
||||
((executable-find "run-mailcap")
|
||||
"run-mailcap"))
|
||||
"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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue