(dired.info)dired-trns.el


Next: dired-cd.el Prev: Letting Dired Guess What Shell Command to Apply Up: Tree Dired Extra

Filename Transformers for Dired Shell Commands
==============================================

   File name "transformers" are functions that take a filename (a
string) as an argument and transform it into some other string (e.g., a
filename without an extension).  This package makes transformers
available in Dired shell commands.

   For example, running the Dired shell command (type `!' or `M-x'
`dired-do-shell-command')

     echo * [b] [db]

   would list the full name, the basename, and the absolute basename of
each marked file.

   Each transformer is associated with a dispatch character. The
associations are stored in a keymap for fast and easy lookup. The
dispatch character is used to activate the associated transformer
function at a particular position in a shell command issued in Dired.
The dispatch character must be enclosed in brackets to distinguish it
from normal letters.

   To take advantage of this package, simply load it after loading
Dired, e.g., in your `dired-load-hook'.  You can then use transformers
like "[b]" for the basename in your Dired shell commands (see below).

   You can define your own transformers using the macro
`dired-trans-define'.

`dired-trans-define'
     Macro that assigns the transformer function `(lambda (file) BODY)'
     to CHAR (a character or string).  BODY must return a string: the
     transformed file.

   Several transformers are predefined:

`*'
     returns the unmodified filename (equivalent to `[dbe]').

`n'
     returns the Name component of a filename without directory
     information

`d'
     returns the Directory component of a filename

`b'
     returns the Basename of a filename, i.e., the name of the file
     without directory and extension (see variable `dired-trans-re-ext')
     A basename with directory component can be obtained by `[db]'.

`e'
     returns the Extension of a filename (i.e., whatever
     `dired-trans-re-ext' splits off)

`v'
     returns a file without directory and without `,v' suffixes if any.

`z'
     returns a file without directory and without `.Z' suffixes if any.

The following variables can be used to customize `dired-trns.el':

`dired-trans-re-ext'
     Default: `"\\.[^.]*\\(\\.Z\\)?$"'

     The part of a filename matching this regexp will be viewed as
     extension.

`dired-trans-starters'
     Default: `"[#[]"'

     User definable set of characters to be used to indicate the start
     of a transformer sequence.

`dired-trans-enders'
     Default: `"[]# ]"'

     User definable set of characters to be used to indicate the end of
     a transformer sequence.


automatically generated by info2www