Based upon the name of a filename, Dired tries to guess what shell command you might want to apply to it. For example, if you have point on a file named `foo.tar' and you press !, Dired will guess you want to `tar xvf' it and suggest that as the default shell command.
The default will be mentioned in brackets and you can type M-p to get the default into the minibuffer so that you can edit it, e.g., changing `tar xvf' to `tar tvf'. If there are several commands for a given file, e.g., `xtex' and `dvips' for a `.dvi' file, you can type M-p several times to see each of the matching commands.
Dired only tries to guess a command for a single file, never for a list of marked files.
dired-guess-shell-alist-default
nil
to turn guessing off.
The elements of dired-guess-shell-alist-user
(defined by the
user) will override these rules.
dired-guess-shell-alist-user
nil
, a user-defined alist of file regexps and their suggested
commands. These rules take precedence over the predefined rules in the
variable dired-guess-shell-alist-default
(to which they are prepended)
when dired-do-shell-command
is run).
Each element of the alist looks like
(regexp command...)where each command can either be a string or a lisp expression that evaluates to a string. If several COMMANDs are given, all will temporarily be pushed on the history. You can set this variable in your `~/.emacs'. For example, to add rules for `.foo' and `.bar' file extensions, write
(setq dired-guess-shell-alist-user (list (list "\\.foo$" "foo-command");; fixed rule ;; possibly more rules... (list "\\.bar$";; rule with condition test '(if condition "bar-command-1" "bar-command-2"))))This will override any predefined rules for the same extensions.
dired-guess-shell-gnutar
nil
If non-nil
, name of the GNU tar executable (e.g., `"tar"' or
`"gnutar"'). GNU tar's `z' switch is used for compressed tar files.
If you don't have GNU tar, set this to nil
: a pipe using `zcat' is
then used.
dired-guess-shell-gzip-quiet
t
A non-nil
value means that -q
is passed to gzip overriding a
verbose GNU zip's `GZIP' environment variable.
dired-guess-shell-znew-switches nil
nil
A string of switches passed to GNU zip's `znew'. An example is
`"-K"' which will make `znew' keep a .Z file when it is smaller than
the .gz file.
dired-shell-command-history nil
Go to the first, previous, next, last section, table of contents.