(dired.info)Omitting Files in Dired
Next: Advanced Dired Mark Commands Prev: Dynamic Dired Markers Up: Tree Dired Extra
Omitting Files in Dired
"Omitting" a file means removing it from the directory listing.
Omitting is useful for keeping Dired buffers free of uninteresting files
(for instance, auto-save, auxiliary, backup, and revision control files)
so that the user can concentrate on the interesting files. Like hidden
files, omitted files are never seen by Dired. *Note Hiding in Dired:
(dired)Dired Hiding. Omitting differs from hiding in several respects:
* Omitting works on individual files, not on directories; an entire
directory cannot be omitted (though each of its files could be).
* Omitting is wholesale; if omitting is turned on for a dired
buffer, then all "uninteresting" files listed in that buffer are
omitted. The user does not omit (or unomit) files one at a time.
* Omitting can be automatic; uninteresting file lines in the buffer
can be removed before the user ever sees them.
* Marked files are never omitted.
(`dired-omit-toggle') Toggle between displaying and omitting
"uninteresting" files. With a prefix argument, don't toggle and
just mark the files, but don't actually omit them.
In order to make omitting work, you must have `dired-omit-expunge'
on your `dired-after-readin-hook', and you must call
`dired-omit-startup' (or `dired-extra-startup', which calls
`dired-omit-startup') in your `dired-mode-hook'. Simply loading
`dired-x.el' inside `dired-load-hook' takes care of all this.
The following variables can be used to customize omitting.
If non-nil, "uninteresting" files are not listed. Uninteresting
files are those whose filenames match regexp `dired-omit-files',
plus those ending with extensions in `dired-omit-extensions'.
`M-o' (`dired-omit-toggle') toggles its value, which is
(setq dired-omit-files-p t)
inside your `dired-mode-hook' to have omitting initially turned on
in every Dired buffer. Since `dired-x.el' prepends the form
`(dired-extra-startup)' to what you put yourself in your
`dired-mode-hook', the `setq' will take place after
`dired-omit-files-p' has already been made local to the current
Dired buffer, so modelines of non-dired buffers are not affected.
For this to work you shouldn't set `dired-mode-hook' inside
`dired-load-hook', but directly in your `~/.emacs' (before Dired
is loaded, if you explicitly load Dired).
You can then use `M-o' to unomit in that buffer.
Filenames matching this buffer-local regexp will not be displayed.
This only has effect when `dired-omit-files-p' is t.
The default value omits the special directories `.' and `..' and
autosave files (plus other files ending in ".").
Default: The elements of `completion-ignored-extensions',
`latex-unclean-extensions', `bibtex-unclean-extensions' and
If non-nil, a list of extensions (strings) to omit from Dired
listings. Its format is the same as that of
The LOCALP argument `dired-omit-expunge' passes to
`dired-get-filename'. If it is `'no-dir', omitting is much
faster, but you can only match against the non-directory part of
the filename. Set it to `nil' if you need to match the whole
pathname or `t' to match the pathname relative to the buffer's
Temporary marker used by by Dired to implement omitting. Should
never be used as marker by the user or other packages. There is
one exception to this rule: by doing
(setq dired-mark-keys "\C-o")
;; i.e., the value of dired-omit-marker-char
;; (which is not defined yet)
anywhere in your `~/.emacs', you will bind the `C-o' key to insert
a C-o marker, thus causing these files to be omitted in addition
to the usually omitted files. Unfortunately the files you omitted
manually this way will show up again after reverting the buffer,
unlike the others.
To avoid seeing RCS files and the RCS directory, do
(setq dired-omit-files "\\.$\\|#\\|^RCS$\\|,v$")
This assumes `dired-omit-localp' has its default value of `'no-dir'
to make the `^'-anchored matches work. As a slower alternative, with
`dired-omit-localp' set to `nil', you can use `/' instead of `^' in the
If you use tib, the bibliography program for use with TeX and LaTeX,
you might want to omit the `INDEX' and the `-t.tex' files:
(setq dired-omit-files "\\.$\\|#\\|^INDEX$\\|-t\\.tex$")
automatically generated by info2www