the list of file names explicitly with the FILE-LIST argument, which
can be produced by `dired-get-marked-files', for example.
-`dired-guess-shell-alist-default' and
-`dired-guess-shell-alist-user' are consulted when the user is
+`dired-guess-shell-alist-default', `dired-guess-shell-alist-optional'
+and `dired-guess-shell-alist-user' are consulted when the user is
prompted for the shell command to use interactively.
Also see the `dired-confirm-shell-command' variable."
;; * `dired-guess-shell-command' calls `dired-guess-default' with list of
;; marked files.
;;
-;; * Parse `dired-guess-shell-alist-user' and
-;; `dired-guess-shell-alist-default' (in that order) for the first REGEXP
+;; * Parse `dired-guess-shell-alist-user', `dired-guess-shell-alist-default',
+;; `dired-guess-shell-alist-optional' (in that order) for the first REGEXP
;; that matches the first file in the file list.
;;
;; * If the REGEXP matches all the entries of the file list then evaluate
" " dired-guess-shell-znew-switches))
'("\\.pod\\'" "perldoc" "pod2man * | nroff -man")
- '("\\.dvi\\'" "xdvi" "dvips") ; preview and printing
- '("\\.au\\'" "play") ; play Sun audiofiles
- '("\\.mpe?g\\'\\|\\.avi\\'" "xine -p")
- '("\\.ogg\\'" "ogg123")
- '("\\.mp3\\'" "mpg123")
- '("\\.wav\\'" "play")
'("\\.uu\\'" "uudecode") ; for uudecoded files
- '("\\.hqx\\'" "mcvert")
'("\\.sh\\'" "sh") ; execute shell scripts
- '("\\.xbm\\'" "bitmap") ; view X11 bitmaps
- '("\\.gp\\'" "gnuplot")
- '("\\.p[bgpn]m\\'" "xloadimage")
- '("\\.gif\\'" "xloadimage") ; view gif pictures
- '("\\.tif\\'" "xloadimage")
- '("\\.png\\'" "display") ; xloadimage 4.1 doesn't grok PNG
- '("\\.jpe?g\\'" "xloadimage")
- '("\\.fig\\'" "xfig") ; edit fig pictures
- '("\\.out\\'" "xgraph") ; for plotting purposes.
'("\\.tex\\'" "latex" "tex")
'("\\.texi\\(nfo\\)?\\'" "makeinfo" "texi2dvi")
- '("\\.pdf\\'" "xpdf")
- '("\\.doc\\'" "antiword" "strings")
'("\\.rpm\\'" "rpm -qilp" "rpm -ivh")
'("\\.dia\\'" "dia")
'("\\.mgp\\'" "mgp")
'("\\.sign?\\'" "gpg --verify"))
"Default alist used for shell command guessing.
-See `dired-guess-shell-alist-user'.")
+See also `dired-guess-shell-alist-optional' and
+`dired-guess-shell-alist-user'.")
+
+(defvar dired-guess-shell-alist-optional
+ (list
+ '("\\.dvi\\'" "xdvi" "dvips") ; preview and printing
+ '("\\.au\\'" "play") ; play Sun audiofiles
+ '("\\.mpe?g\\'\\|\\.avi\\'" "xine -p")
+ '("\\.ogg\\'" "ogg123")
+ '("\\.mp3\\'" "mpg123")
+ '("\\.wav\\'" "play")
+ '("\\.hqx\\'" "mcvert")
+ '("\\.xbm\\'" "bitmap") ; view X11 bitmaps
+ '("\\.gp\\'" "gnuplot")
+ '("\\.p[bgpn]m\\'" "xloadimage")
+ '("\\.gif\\'" "xloadimage") ; view gif pictures
+ '("\\.tif\\'" "xloadimage")
+ '("\\.png\\'" "display") ; xloadimage 4.1 doesn't grok PNG
+ '("\\.jpe?g\\'" "xloadimage")
+ '("\\.fig\\'" "xfig") ; edit fig pictures
+ '("\\.out\\'" "xgraph") ; for plotting purposes.
+ '("\\.pdf\\'" "xpdf")
+ '("\\.doc\\'" "antiword" "strings"))
+ "Optional alist used for shell command guessing.
+Unlike `dired-guess-shell-alist-default' that contains mostly the
+standard commands that handle the files with corresponding extensions
+such as the `tar' command handling the files with the `.tar' extension,
+this list contains the commands such as media players and viewers
+that don't exist on many systems where other alternatives are available.
+
+See also `dired-guess-shell-alist-user'.")
(defun dired-guess-default (files)
"Return a shell command, or a list of commands, appropriate for FILES.
(string-match-p (car elem) file))
files))
(append dired-guess-shell-alist-user
- dired-guess-shell-alist-default)))
+ dired-guess-shell-alist-default
+ dired-guess-shell-alist-optional)))
nil)))))
(if (length= programs 1)
(car programs)
(if (equal val "") default val))))
(defcustom shell-command-guess-functions
- '(shell-command-guess-dired)
+ '(shell-command-guess-dired-optional
+ shell-command-guess-mailcap
+ shell-command-guess-xdg
+ shell-command-guess-dired-default
+ shell-command-guess-dired-user)
"List of functions that guess shell commands for files.
Each function receives a list of commands and a list of file names
and should return the same list of commands with changes
-such as added new commands."
+such as new commands added to the beginning of the list.
+In this case the commands from the last entry
+will be at the top of the resulted list."
:type '(repeat
- (choice (function-item shell-command-guess-dired)
+ (choice (function-item shell-command-guess-dired-user)
+ (function-item shell-command-guess-dired-default)
+ (function-item shell-command-guess-dired-optional)
(function-item shell-command-guess-mailcap)
(function-item shell-command-guess-xdg)
(function-item shell-command-guess-open)
nil))
commands))
-(defun shell-command-guess-dired (commands files)
- "Populate COMMANDS using `dired-guess-default'."
- (append (ensure-list (dired-guess-default files)) commands))
+(defun shell-command-guess-dired-user (commands files)
+ "Populate COMMANDS using `dired-guess-shell-alist-user'.
+This excludes `dired-guess-shell-alist-default' and
+`dired-guess-shell-alist-optional'."
+ (let ((dired-guess-shell-alist-default nil)
+ (dired-guess-shell-alist-optional nil))
+ (append (ensure-list (dired-guess-default files)) commands)))
+
+(defun shell-command-guess-dired-default (commands files)
+ "Populate COMMANDS using `dired-guess-shell-alist-default'.
+This excludes `dired-guess-shell-alist-user' and
+`dired-guess-shell-alist-optional'."
+ (let ((dired-guess-shell-alist-user nil)
+ (dired-guess-shell-alist-optional nil))
+ (append (ensure-list (dired-guess-default files)) commands)))
+
+(defun shell-command-guess-dired-optional (commands files)
+ "Populate COMMANDS using `dired-guess-shell-alist-optional'.
+This excludes `dired-guess-shell-alist-user' and
+`dired-guess-shell-alist-default'."
+ (let ((dired-guess-shell-alist-user nil)
+ (dired-guess-shell-alist-default nil))
+ (append (ensure-list (dired-guess-default files)) commands)))
(declare-function mailcap-file-default-commands "mailcap" (files))