(dired.info)Letting Dired Guess What Shell Command to Apply


Next: dired-trns.el Prev: Making Relative Symbolic Links in Dired Up: Tree Dired Extra

Letting Dired Guess What Shell Command to Apply
===============================================

   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.

   If you are using the `gmhist' package (Note: Dired Minibuffer
History), 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-auto-shell-command-alist-default'
     Predefined rules for shell commands.  Set this to nil to turn
     guessing off.  The elements of `dired-auto-shell-command-alist'
     (defined by the user) will override these rules.

`dired-auto-shell-command-alist'
     If non-nil, an alist of file regexps and their suggested commands
     overriding the predefined rules in
     `dired-auto-shell-command-alist-default'.

     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.

     These rules take precedence over the predefined rules in the
     variable `dired-auto-shell-command-alist-default' (to which they
     are prepended when `dired-x' is loaded).

     You can set this variable in your `~/.emacs'.  For example, to add
     rules for `.foo' and `.bar' file extensions, write

          (setq dired-auto-shell-command-alist
                (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-have-gnutar'
     Default: `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.


automatically generated by info2www