Make dired-omit-here-always obsolete, in favor of standard function.
[bpt/emacs.git] / doc / misc / dired-x.texi
CommitLineData
4009494e
GM
1\input texinfo @comment -*-texinfo-*-
2
c221eff3 3@c dired-x.texi --- Sebastian Kremer's Extra DIRED hacked up for GNU Emacs
4009494e
GM
4@c
5@c Author: Sebastian Kremer <sk@thp.uni-koeln.de>
9360256a 6@c Lawrence R. Dodd <dodd@roebling.poly.edu>
4009494e 7@c [Dodd's address no longer valid.]
4009494e
GM
8
9@comment %**start of header (This is for running Texinfo on a region.)
db78a8cb 10@setfilename ../../info/dired-x
07ca5555
GM
11@settitle Dired Extra User's Manual
12
b322c9af
GM
13@include emacsver.texi
14
4009494e
GM
15@iftex
16@finalout
17@end iftex
9360256a 18@c @setchapternewpage odd % For book style double sided manual.
4009494e
GM
19@comment %**end of header (This is for running Texinfo on a region.)
20
21@copying
b322c9af
GM
22Copyright @copyright{} 1994-1995, 1999, 2001-2011
23Free Software Foundation, Inc.
4009494e
GM
24
25@quotation
26Permission is granted to copy, distribute and/or modify this document
6a2c4aec 27under the terms of the GNU Free Documentation License, Version 1.3 or
7b2d06e1
GM
28any later version published by the Free Software Foundation; with no
29Invariant Sections, with the Front-Cover texts being ``A GNU Manual'',
30and with the Back-Cover Texts as in (a) below. A copy of the license
31is included in the section entitled ``GNU Free Documentation License''.
4009494e 32
6f093307
GM
33(a) The FSF's Back-Cover Text is: ``You have the freedom to copy and
34modify this GNU manual. Buying copies from the FSF supports it in
35developing GNU and promoting software freedom.''
4009494e
GM
36@end quotation
37@end copying
38
0c973505 39@dircategory Emacs misc features
4009494e 40@direntry
62e034c2 41* Dired-X: (dired-x). Dired Extra Features.
4009494e
GM
42@end direntry
43
44@c @smallbook
45@tex
46\overfullrule=0pt
47%\global\baselineskip 30pt % For printing in double spaces
48@end tex
49
50@titlepage
51@sp 6
07ca5555 52@center @titlefont{Dired Extra}
4009494e
GM
53@sp 2
54@center @titlefont{For The GNU Emacs}
55@sp 1
56@center @titlefont{Directory Editor}
57@sp 4
58@center Lawrence R@. Dodd
59@c @center @t{dodd@@roebling.poly.edu}
60@sp 5
61@center (Based on @file{dired.texi} by Sebastian Kremer <sk@@thp.uni-koeln.de>)
62@page
63@vskip 0pt plus 1filll
64@insertcopying
65@end titlepage
66
5dc584b5
KB
67@contents
68
4009494e
GM
69
70@ifnottex
71
72@node Top
8a36c07f 73@top Dired Extra
4009494e
GM
74
75@noindent
07ca5555 76This documents the ``extra'' features for GNU Emacs's Dired Mode that are
4009494e
GM
77provided by the file @file{dired-x.el}.
78
79@itemize @bullet
80
81@item
82Based on @file{dired.texi} by Sebastian Kremer <sk@@thp.uni-koeln.de>
83
4009494e 84@item
b322c9af 85For @file{dired-x.el} as distributed with GNU Emacs @value{EMACSVER}.
4009494e
GM
86
87@end itemize
88
5dc584b5
KB
89@insertcopying
90
4009494e
GM
91@menu
92* Introduction::
93* Installation::
94* Omitting Files in Dired::
95* Local Variables::
96* Shell Command Guessing::
97* Virtual Dired::
98* Advanced Mark Commands::
99* Multiple Dired Directories::
100* Find File At Point::
101* Miscellaneous Commands::
102* Bugs::
103
104* GNU Free Documentation License::
105* Concept Index::
106* Command Index::
107* Key Index::
108* Variable Index::
109
110@end menu
111
112@end ifnottex
113
114@node Introduction, Installation, Top, Top
4009494e
GM
115@chapter Introduction
116
07ca5555
GM
117This documents some @emph{extra} features for GNU Emacs's Dired Mode
118that are provided by @file{dired-x.el} (derived from Sebastian Kremer's
119original @file{dired-x.el}).
4009494e
GM
120
121@ifnottex
122@menu
123* Features::
124* Technical Details::
125@end menu
126@end ifnottex
127
128@node Features, Technical Details, , Introduction
4009494e
GM
129@section Features
130@cindex Features
131
817b48a7 132Some features provided by Dired Extra:
4009494e
GM
133
134@enumerate
135@item
817b48a7
GM
136Omitting uninteresting files from Dired listing
137(@pxref{Omitting Files in Dired}).
4009494e 138@item
817b48a7
GM
139Guessing shell commands in Dired buffers
140(@pxref{Shell Command Guessing}).
4009494e 141@item
817b48a7
GM
142Running Dired command in non-Dired buffers
143(@pxref{Virtual Dired}).
4009494e
GM
144@item
145Finding a file mentioned in a buffer
817b48a7 146(@pxref{Find File At Point}).
4009494e 147@item
817b48a7
GM
148Commands using file marking
149(@pxref{Advanced Mark Commands}).
4009494e
GM
150@end enumerate
151
152@noindent
153@file{dired-x.el} binds some functions to keys in Dired Mode (@pxref{Key
154Index}) and also binds @kbd{C-x C-j} and @kbd{C-x 4 C-j} @emph{globally} to
51a13bdd
GM
155@code{dired-jump} (@pxref{Miscellaneous Commands}). Optionally, it
156also binds @kbd{C-x C-f} and @kbd{C-x 4 C-f} to
157@code{dired-x-find-file} and @code{dired-x-find-file-other-window},
158respectively (@pxref{Find File At Point}).
4009494e
GM
159
160@node Technical Details, , Features, Introduction
4009494e 161@section Technical Details
bea584fa 162@cindex Modified functions
4009494e
GM
163@cindex @file{dired-aux.el}
164
bea584fa
GM
165When @file{dired-x.el} is loaded, some standard Dired functions from
166@file{dired.el} and @file{dired-aux.el} offer additional features.
167@code{dired-add-entry} obeys Dired Omit mode (@pxref{Omitting Files in
168Dired}), if it is active. @code{dired-find-buffer-nocreate} and
169@code{dired-initial-position} respect the value of
170@code{dired-find-subdir} (@pxref{Miscellaneous Commands}).
171@code{dired-clean-up-after-deletion} respects the value of
172@code{dired-clean-up-buffers-too}. @code{dired-read-shell-command} uses
173@code{dired-guess-shell-command} (@pxref{Shell Command Guessing}) to
174offer a smarter default command.
4009494e
GM
175
176@node Installation, Omitting Files in Dired, Introduction, Top
4009494e
GM
177@chapter Installation
178
179@noindent
180This manual describes the Dired features provided by the file
181@file{dired-x.el}. To take advantage of these features, you must load the
182file and (optionally) set some variables.
183
184@noindent
07ca5555
GM
185In your @file{~/.emacs} file, or in the system-wide initialization file
186@file{default.el} in the @file{site-lisp} directory, put
4009494e
GM
187
188@example
189(add-hook 'dired-load-hook
190 (lambda ()
191 (load "dired-x")
192 ;; Set dired-x global variables here. For example:
193 ;; (setq dired-guess-shell-gnutar "gtar")
194 ;; (setq dired-x-hands-off-my-keys nil)
195 ))
196(add-hook 'dired-mode-hook
197 (lambda ()
198 ;; Set dired-x buffer-local variables here. For example:
199 ;; (dired-omit-mode 1)
200 ))
201@end example
202
203@noindent
204This will load @file{dired-x.el} when Dired is first invoked (for example,
205when you first type @kbd{C-x d}).
206
207@ifnottex
208@menu
209* Optional Installation Dired Jump::
210* Optional Installation File At Point::
211@end menu
212@end ifnottex
213
214@node Optional Installation Dired Jump, Optional Installation File At Point, , Installation
4009494e
GM
215@section Optional Installation Dired Jump
216
217@cindex Autoloading @code{dired-jump} and @code{dired-jump-other-window}
218
219In order to have @code{dired-jump} and @code{dired-jump-other-window}
220(@pxref{Miscellaneous Commands}) work @emph{before} @code{dired} and
07ca5555 221@code{dired-x} have been properly loaded you should set-up an autoload
4009494e
GM
222for these functions. In your @file{.emacs} file put
223
224@example
07ca5555
GM
225(autoload 'dired-jump "dired-x"
226 "Jump to Dired buffer corresponding to current buffer." t)
4009494e 227
07ca5555
GM
228(autoload 'dired-jump-other-window "dired-x"
229 "Like \\[dired-jump] (dired-jump) but in other window." t)
4009494e 230
4009494e 231(define-key global-map "\C-x\C-j" 'dired-jump)
07ca5555 232(define-key global-map "\C-x4\C-j" 'dired-jump-other-window)
4009494e
GM
233@end example
234
4009494e 235@node Optional Installation File At Point, , Optional Installation Dired Jump, Installation
4009494e
GM
236@section Optional Installation File At Point
237
238@cindex Binding @code{dired-x-find-file}
239If you choose to have @file{dired-x.el} bind @code{dired-x-find-file} over
240@code{find-file} (@pxref{Find File At Point}), then you will need to set
f31f8469
GM
241@code{dired-x-hands-off-my-keys}. To do this, either set it
242@emph{before} @file{dired-x.el} is loaded, or use @kbd{M-x customize-variable},
243or call @code{dired-x-bind-find-file} after changing the value.
4009494e
GM
244
245@example
246(add-hook 'dired-load-hook
247 (lambda ()
248 ;; Bind dired-x-find-file.
249 (setq dired-x-hands-off-my-keys nil)
250 (load "dired-x")
251 ))
252@end example
253
254@node Omitting Files in Dired, Local Variables, Installation, Top
4009494e
GM
255@chapter Omitting Files in Dired
256
257@cindex Omitting Files in Dired
258@cindex Uninteresting files
259@dfn{Omitting} a file means removing it from the directory listing. Omitting
260is useful for keeping Dired buffers free of ``uninteresting'' files (for
261instance, auto-save, auxiliary, backup, and revision control files) so that
262the user can concentrate on the interesting files. Like hidden files, omitted
263files are never seen by Dired. Omitting differs from hiding in several
264respects:
265
266@itemize @bullet
267
268@item
269Omitting works on individual files, not on directories; an entire directory
270cannot be omitted (though each of its files could be).
271
272@item
273Omitting is wholesale; if omitting is turned on for a Dired buffer, then all
274uninteresting files listed in that buffer are omitted. The user does not omit
275(or unomit) files one at a time.
276
277@item
278Omitting can be automatic; uninteresting file lines in the buffer can be
279removed before the user ever sees them.
280
281@item
282Marked files are never omitted.
283@end itemize
284
285@table @kbd
286@item M-o
287@kindex M-o
288@findex dired-omit-mode
289(@code{dired-omit-mode}) Toggle between displaying and omitting
290``uninteresting'' files.
291@item * O
292@kindex * O
293@findex dired-mark-omitted
294(@code{dired-mark-omitted}) Mark ``uninteresting'' files.
295@end table
296
297@noindent
298In order to make Dired Omit work you first need to load @file{dired-x.el}
299inside @code{dired-load-hook} (@pxref{Installation}) and then evaluate
300@code{(dired-omit-mode 1)} in some way (@pxref{Omitting Variables}).
301
302@ifnottex
303@menu
304* Omitting Variables::
305* Omitting Examples::
306* Omitting Technical::
307@end menu
308@end ifnottex
309
310@node Omitting Variables, Omitting Examples, , Omitting Files in Dired
4009494e
GM
311@section Omitting Variables
312
313@cindex Customizing file omitting
314The following variables can be used to customize omitting.
315
316@table @code
317
318@vindex dired-omit-mode
319@item dired-omit-mode
320
321Default: @code{nil}
322
323@cindex How to make omitting the default in Dired
324If non-@code{nil}, ``uninteresting'' files are not listed.
325Uninteresting files are those whose files whose names match regexp
326@code{dired-omit-files}, plus those ending with extensions in
327@code{dired-omit-extensions}. @kbd{M-o} (@code{dired-omit-mode})
328toggles its value, which is buffer-local. Put
329
330@example
331(dired-omit-mode 1)
332@end example
333
334@noindent
335inside your @code{dired-mode-hook} to have omitting initially turned on in
336@emph{every} Dired buffer (@pxref{Installation}). You can then use @kbd{M-o} to
337unomit in that buffer.
338
817b48a7
GM
339To enable omitting automatically only in certain directories you can add
340a directory local setting
341(@pxref{Directory Variables,,,emacs,The Gnu Emacs manual}) for Dired mode
4009494e
GM
342
343@example
817b48a7 344((dired-mode . ((dired-omit-mode . t))))
4009494e
GM
345@end example
346
347@noindent
8889f4e2
GM
348to a @file{.dir-locals.el} file in that directory. You can use the
349command @code{add-dir-local-variable} to do this.
4009494e
GM
350
351@vindex dired-omit-files
352@item dired-omit-files
353
354Default: @code{"^#\\|\\.$"}
355
356Files whose names match this buffer-local regexp will not be displayed.
357This only has effect when @code{dired-omit-mode}'s value is @code{t}.
358
359The default value omits the special directories @file{.} and @file{..} and
360autosave files (plus other files ending in @file{.}) (@pxref{Omitting Examples}).
361
362@vindex dired-omit-extensions
363@item dired-omit-extensions
364
365Default: The elements of @code{completion-ignored-extensions},
366@code{dired-latex-unclean-extensions}, @code{dired-bibtex-unclean-extensions}
367and @code{dired-texinfo-unclean-extensions}.
368
369If non-@code{nil}, a list of extensions (strings) to omit from Dired listings.
370Its format is the same as that of @code{completion-ignored-extensions}.
371
372@vindex dired-omit-localp
373@item dired-omit-localp
374
375Default: @code{no-dir}
376
377The @var{localp} argument @code{dired-omit-expunge} passes to
378@code{dired-get-filename}. If it is @code{no-dir}, omitting is much faster,
379but you can only match against the non-directory part of the file name. Set it
380to @code{nil} if you need to match the whole file name or @code{t} to match the
381file name relative to the buffer's top-level directory.
382
383@item dired-omit-marker-char
384@vindex dired-omit-marker-char
385@cindex Omitting additional files
386Default: @kbd{C-o}
387
388Temporary marker used by Dired to implement omitting. Should never be used
389as marker by the user or other packages. There is one exception to this rule:
390by adding
391
392@example
393(setq dired-mark-keys "\C-o")
394;; i.e., the value of dired-omit-marker-char
395;; (which is not defined yet)
396@end example
397
398@noindent
399to your @file{~/.emacs}, you can bind the @kbd{C-o} key to insert a
400@kbd{C-o} marker, thus causing these files to be omitted in addition to the
401usually omitted files. Unfortunately the files you omitted manually this way
402will show up again after reverting the buffer, unlike the others.
403
404@end table
405
406@node Omitting Examples, Omitting Technical, Omitting Variables, Omitting Files in Dired
4009494e
GM
407@section Examples of Omitting Various File Types
408
409@itemize @bullet
410
411@item
412@cindex RCS files, how to omit them in Dired
413@cindex Omitting RCS files in Dired
414If you wish to avoid seeing RCS files and the @file{RCS} directory, then put
415
416@example
417(setq dired-omit-files
418 (concat dired-omit-files "\\|^RCS$\\|,v$"))
419@end example
420
421@noindent
422in the @code{dired-load-hook} (@pxref{Installation}). This assumes
423@code{dired-omit-localp} has its default value of @code{no-dir} to make the
424@code{^}-anchored matches work. As a slower alternative, with
425@code{dired-omit-localp} set to @code{nil}, you can use @code{/} instead of
426@code{^} in the regexp.
427
428@item
429@cindex Tib files, how to omit them in Dired
430@cindex Omitting tib files in Dired
431If you use @code{tib}, the bibliography program for use with @TeX{} and
432La@TeX{}, and you
433want to omit the @file{INDEX} and the @file{*-t.tex} files, then put
434
435@example
436(setq dired-omit-files
437 (concat dired-omit-files "\\|^INDEX$\\|-t\\.tex$"))
438@end example
439
440@noindent
441in the @code{dired-load-hook} (@pxref{Installation}).
442
443@item
444@cindex Dot files, how to omit them in Dired
445@cindex Omitting dot files in Dired
446If you do not wish to see @samp{dot} files (files starting with a @file{.}),
447then put
448
449@example
450(setq dired-omit-files
451 (concat dired-omit-files "\\|^\\..+$"))
452@end example
453
454@noindent
455in the @code{dired-load-hook} (@pxref{Installation}).
456
457@end itemize
458
459@node Omitting Technical, , Omitting Examples, Omitting Files in Dired
4009494e
GM
460@section Some Technical Details of Omitting
461
462Loading @file{dired-x.el} will install Dired Omit by putting
463@code{dired-omit-expunge} on your @code{dired-after-readin-hook}, and will
464call @code{dired-extra-startup}, which in turn calls @code{dired-omit-startup}
465in your @code{dired-mode-hook}.
466
467@node Local Variables, Shell Command Guessing, Omitting Files in Dired, Top
4009494e
GM
468@chapter Local Variables for Dired Directories
469
470@cindex Local Variables for Dired Directories
471@vindex dired-local-variables-file
472@vindex dired-enable-local-variables
473@noindent
817b48a7
GM
474This Dired-X feature is obsolete as of Emacs 24.1. The standard Emacs
475directory local variables mechanism (@pxref{Directory
476Variables,,,emacs,The Gnu Emacs manual}) replaces it. For an example of
477the new mechanims, @pxref{Omitting Variables}.
478
479When Dired visits a directory, it looks for a file whose name is the
480value of variable @code{dired-local-variables-file} (default: @file{.dired}).
481If such a file is found, Dired will temporarily insert it into the Dired
482buffer and run @code{hack-local-variables}.
4009494e
GM
483
484@noindent
485For example, if the user puts
486
487@example
488Local Variables:
489dired-actual-switches: "-lat"
490dired-omit-mode: t
491End:
492@end example
493
494@noindent
495into a file called @file{.dired} in a directory then when that directory is
496viewed it will be
497
498@enumerate
499@item
500sorted by date
501@item
502omitted automatically
503@end enumerate
504
505@noindent
506You can set @code{dired-local-variables-file} to @code{nil} to suppress this.
507The value of @code{dired-enable-local-variables} controls if and how these
51a13bdd 508local variables are read. This variable exists so that it may override the
4009494e
GM
509default value of @code{enable-local-variables}.
510
511@noindent
512Please see the GNU Emacs Manual to learn more about local variables.
513@xref{File Variables,Local Variables in Files,Local Variables in
514Files,emacs,The GNU Emacs Manual}.
515
516@noindent
517The following variables affect Dired Local Variables
518
519@table @code
520@vindex dired-local-variables-file
521@item dired-local-variables-file
522Default: @code{".dired"}
523
524If non-@code{nil}, file name for local variables for Dired. If Dired finds a
525file with that name in the current directory, it will temporarily insert it
526into the Dired buffer and run @code{hack-local-variables}.
527
528@vindex dired-enable-local-variables
529@item dired-enable-local-variables
530Default: @code{t}
531
817b48a7
GM
532Controls the use of local-variables lists in Dired. This variable
533temporarily overrides the value of @code{enable-local-variables} when
534the Dired Local Variables are hacked. It takes the same values as that
535variable. A value of @code{nil} means to ignore any Dired Local Variables.
4009494e
GM
536@end table
537
538@node Shell Command Guessing, Virtual Dired, Local Variables, Top
4009494e
GM
539@chapter Shell Command Guessing
540@cindex Guessing shell commands for files.
541
542Based upon the name of a file, Dired tries to guess what shell
543command you might want to apply to it. For example, if you have point
544on a file named @file{foo.tar} and you press @kbd{!}, Dired will guess
545you want to @samp{tar xvf} it and suggest that as the default shell
546command.
547
e658c8ee 548The default is mentioned in brackets and you can type @kbd{M-n} to get
4009494e
GM
549the default into the minibuffer and then edit it, e.g., to change
550@samp{tar xvf} to @samp{tar tvf}. If there are several commands for a given
551file, e.g., @samp{xtex} and @samp{dvips} for a @file{.dvi} file, you can type
e658c8ee 552@kbd{M-n} several times to see each of the matching commands.
4009494e
GM
553
554Dired only tries to guess a command for a single file, never for a list
555of marked files.
556
557@table @code
558@item dired-guess-shell-alist-default
559@vindex dired-guess-shell-alist-default
560Predefined rules for shell commands. Set this to @code{nil} to turn guessing off.
561The elements of @code{dired-guess-shell-alist-user} (defined by the
562user) will override these rules.@refill
563
564@item dired-guess-shell-alist-user
565@vindex dired-guess-shell-alist-user
566If non-@code{nil}, a user-defined alist of file regexps and their suggested
567commands. These rules take precedence over the predefined rules in the
568variable @code{dired-guess-shell-alist-default} (to which they are prepended)
569when @code{dired-do-shell-command} is run).
570@refill
571
572Each element of the alist looks like
573
574@example
575(@var{regexp} @var{command}@dots{})
576@end example
577
578@noindent
579where each @var{command} can either be a string or a Lisp expression
580that evaluates to a string. If several commands are given, all of
581them will temporarily be pushed onto the history.
582
583If @samp{*} in the shell command, that means to substitute the file
584name.
585
586You can set this variable in your @file{~/.emacs}. For example,
587to add rules for @samp{.foo} and @samp{.bar} file extensions, write
588
589@example
590(setq dired-guess-shell-alist-user
591 (list
592 (list "\\.foo$" "@var{foo-command}");; fixed rule
593 ;; possibly more rules...
594 (list "\\.bar$";; rule with condition test
595 '(if @var{condition}
596 "@var{bar-command-1}"
597 "@var{bar-command-2}"))))
598@end example
599
600@noindent
601This will override any predefined rules for the same extensions.
602
07ded3db
GM
603@item dired-guess-shell-case-fold-search
604@vindex dired-guess-shell-case-fold-search
605Default: @code{t}
606
607Non-@code{nil} means @code{dired-guess-shell-alist-default} and
608@code{dired-guess-shell-alist-user} are matched case-insensitively.
609
4009494e
GM
610@item dired-guess-shell-gnutar
611@vindex dired-guess-shell-gnutar
612@cindex Passing GNU Tar its @samp{z} switch.
613Default: @code{nil}
614
615If non-@code{nil}, this is the name of the GNU Tar executable (e.g.,
616@samp{tar} or @samp{gnutar}). GNU Tar's @samp{z} switch is used for
617compressed tar files.
618If you don't have GNU tar, set this to @code{nil}: a pipe using @samp{zcat} is
619then used.
620
621@item dired-guess-shell-gzip-quiet
622@vindex dired-guess-shell-gzip-quiet
623@cindex @code{gzip}
624Default: @code{t}
625
626A non-@code{nil} value means that @samp{-q} is passed to @code{gzip}
627overriding a verbose option in the @env{GZIP} environment variable.
628
629@item dired-guess-shell-znew-switches nil
630@vindex dired-guess-shell-znew-switches nil
631@cindex @code{znew}
632Default: @code{nil}
633
634A string of switches passed to @code{znew}. An example is
635@samp{-K} which will make @code{znew} keep a @file{.Z} file when it is
636smaller than the @file{.gz} file.
637
638@item dired-shell-command-history nil
639@vindex dired-shell-command-history nil
640
641History list for commands that read dired-shell commands.
642@end table
643
644@node Virtual Dired, Advanced Mark Commands, Shell Command Guessing, Top
4009494e
GM
645@chapter Virtual Dired
646
647@cindex Virtual Dired
648@cindex Perusing @code{ls} listings
649@cindex @code{ls} listings, how to peruse them in Dired
650Using @dfn{Virtual Dired} means putting a buffer with Dired-like
651contents in Dired mode. The files described by the buffer contents need
652not actually exist. This is useful if you want to peruse an @samp{ls -lR}
653output file, for example one you got from an FTP server. You can use
654all motion commands usually available in Dired. You can also use
655it to save a Dired buffer in a file and resume it in a later session.
656
657@findex dired-virtual
658@kindex g
659@findex dired-virtual-revert
660Type @kbd{M-x dired-virtual} to put the current buffer into virtual
661Dired mode. You will be prompted for the top level directory of this
662buffer, with a default value guessed from the buffer contents. To
663convert the virtual to a real Dired buffer again, type @kbd{g} (which
664calls @code{dired-virtual-revert}) in the virtual Dired buffer and
665answer @samp{y}. You don't have to do this, though: you can relist
666single subdirectories using @kbd{l} (@code{dired-do-redisplay}) on the subdirectory
667headerline, leaving the buffer in virtual Dired mode all the time.
668
669@findex dired-virtual-mode
670@vindex auto-mode-alist
671The function @samp{dired-virtual-mode} is specially designed to turn on
672virtual Dired mode from the @code{auto-mode-alist}. To edit all
673@file{*.dired} files automatically in virtual Dired mode, put this into your
674@file{~/.emacs}:
675
676@example
677(setq auto-mode-alist (cons '("[^/]\\.dired$" . dired-virtual-mode)
678 auto-mode-alist))
679@end example
680
681@noindent
682The regexp is a bit more complicated than usual to exclude @file{.dired}
683local-variable files.
684
685@node Advanced Mark Commands, Multiple Dired Directories, Virtual Dired, Top
4009494e
GM
686@chapter Advanced Mark Commands
687
688@table @kbd
689@item F
690@kindex F
691@cindex Visiting several files at once
692@cindex Simultaneous visiting of several files
693@findex dired-do-find-marked-files
694(@code{dired-do-find-marked-files}) Find all marked files at once displaying
695them simultaneously. If optional @var{noselect} is non-@code{nil} then just
696find the
697files but do not select. If you want to keep the Dired buffer displayed, type
698@kbd{C-x 2} first. If you want just the marked files displayed and nothing
699else, type @kbd{C-x 1} first.
700
701The current window is split across all files marked, as evenly as possible.
702Remaining lines go to the bottom-most window. The number of files that can be
703displayed this way is restricted by the height of the current window and the
704variable @code{window-min-height}.
705@end table
706
707@table @code
708@item dired-mark-extension
709@findex dired-mark-extension
710Mark all files with a certain extension for use in later commands. A @samp{.}
711is not automatically prepended to the string entered, you must type it
712explicitly.
713
714When called from Lisp, @var{extension} may also be a list of extensions
715and an optional argument @var{marker-char} specifies the marker used.
716
717@item dired-flag-extension
718@findex dired-flag-extension
719Flag all files with a certain extension for deletion. A @samp{.} is
720@emph{not} automatically prepended to the string entered.
721@end table
722
723@ifnottex
724@menu
725* Advanced Cleaning Functions::
726* Advanced Cleaning Variables::
727* Special Marking Function::
728@end menu
729@end ifnottex
730
731@node Advanced Cleaning Functions, Advanced Cleaning Variables, , Advanced Mark Commands
4009494e
GM
732@section Advanced Cleaning Functions
733
734@table @code
735@item dired-clean-patch
736@findex dired-clean-patch
737Flag dispensable files created by the @samp{patch} program for deletion. See
738variable @code{dired-patch-unclean-extensions}.
739
740@item dired-clean-tex
741@findex dired-clean-tex
742Flag dispensable files created by @TeX{}, La@TeX{}, and @samp{texinfo} for
743deletion. See the following variables (@pxref{Advanced Cleaning Variables}):
744
745@itemize @bullet
746@item
747@code{dired-tex-unclean-extensions}
748@item
749@code{dired-texinfo-unclean-extensions}
750@item
751@code{dired-latex-unclean-extensions}
752@item
753@code{dired-bibtex-unclean-extensions}
754@end itemize
755
756@item dired-very-clean-tex
757@findex dired-very-clean-tex
758Flag dispensable files created by @TeX{}, La@TeX{}, @samp{texinfo},
759and @file{*.dvi} files for deletion.
760@end table
761
762@node Advanced Cleaning Variables, Special Marking Function, Advanced Cleaning Functions, Advanced Mark Commands
4009494e
GM
763@section Advanced Cleaning Variables
764
765@noindent Variables used by the above cleaning commands (and in the default value for
766variable @code{dired-omit-extensions}, @pxref{Omitting Variables})
767
768@table @code
769@item dired-patch-unclean-extensions
770@vindex dired-patch-unclean-extensions
771Default: @code{(".rej" ".orig")}
772
773List of extensions of dispensable files created by the @samp{patch} program.
774
775@item dired-tex-unclean-extensions
776@vindex dired-tex-unclean-extensions
777Default: @code{(".toc" ".log" ".aux")}
778
779List of extensions of dispensable files created by @TeX{}.
780
781@item dired-texinfo-unclean-extensions
782@vindex dired-texinfo-unclean-extensions
783Default: @code{(".cp" ".cps" ".fn" ".fns" ".ky" ".kys"}
784@code{".pg" ".pgs" ".tp" ".tps" ".vr" ".vrs")}
785
786List of extensions of dispensable files created by @samp{texinfo}.
787
788@item dired-latex-unclean-extensions
789@vindex dired-latex-unclean-extensions
790Default: @code{(".idx" ".lof" ".lot" ".glo")}
791
792List of extensions of dispensable files created by La@TeX{}.
793
794@item dired-bibtex-unclean-extensions
795@vindex dired-bibtex-unclean-extensions
796Default: @code{(".blg" ".bbl")}
797
798List of extensions of dispensable files created by Bib@TeX{}.
799@end table
800
801@node Special Marking Function, , Advanced Cleaning Variables, Advanced Mark Commands
4009494e
GM
802@section Special Marking Function
803
804@table @kbd
805@item M-(
806@kindex M-(
807@findex dired-mark-sexp
808@cindex Lisp expression, marking files with in Dired
809@cindex Mark file by Lisp expression
810(@code{dired-mark-sexp}) Mark files for which @var{predicate} returns
811non-@code{nil}. With a prefix argument, unflag those files instead.
812
813The @var{predicate} is a Lisp expression that can refer to the following
814symbols:
815@table @code
816@item inode
817[@i{integer}] the inode of the file (only for @samp{ls -i} output)
818@item s
819[@i{integer}] the size of the file for @samp{ls -s} output (usually in blocks or,
820with @samp{-k}, in KBytes)
821@item mode
822[@i{string}] file permission bits, e.g., @samp{-rw-r--r--}
823@item nlink
824[@i{integer}] number of links to file
825@item uid
826[@i{string}] owner
827@item gid
828[@i{string}] group (If the gid is not displayed by @samp{ls}, this
829will still be set (to the same as uid))
830@item size
831[@i{integer}] file size in bytes
832@item time
833[@i{string}] the time that @samp{ls} displays, e.g., @samp{Feb 12 14:17}
834@item name
835[@i{string}] the name of the file
836@item sym
837[@i{string}] if file is a symbolic link, the linked-to name, else @code{""}
838@end table
839
840@noindent
841For example, use
842@example
843(equal 0 size)
844@end example
845to mark all zero length files.
846
847To find out all not yet compiled Emacs Lisp files in a directory, Dired
848all @file{.el} files in the lisp directory using the wildcard
849@samp{*.el}. Then use @kbd{M-(} with
850@example
851(not (file-exists-p (concat name "c")))
852@end example
853to mark all @file{.el} files without a corresponding @file{.elc} file.
854
855@end table
856
857@node Multiple Dired Directories, Find File At Point, Advanced Mark Commands, Top
4009494e
GM
858@chapter Multiple Dired Directories and Non-Dired Commands
859
860@cindex Multiple Dired directories
861@cindex Working directory
862An Emacs buffer can have but one working directory, stored in the
863buffer-local variable @code{default-directory}. A Dired buffer may have
864several subdirectories inserted, but it still has only one working
865directory: that of the top-level Dired directory in that buffer. For
866some commands it is appropriate that they use the current Dired
867directory instead of @code{default-directory}, e.g., @code{find-file} and
868@code{compile}.
869
870A general mechanism is provided for special handling of the working
871directory in special major modes:
872
873@table @code
da5e0ce4
GM
874@item dired-default-directory-alist
875@vindex dired-default-directory-alist
4009494e
GM
876Default: @code{((dired-mode . (dired-current-directory)))}
877
878Alist of major modes and their notion of @code{default-directory}, as a
879Lisp expression to evaluate. A resulting value of @code{nil} is ignored
880in favor of @code{default-directory}.
881
882@item dired-default-directory
883@findex dired-default-directory
884Use this function like you would use the variable
885@code{default-directory}, except that @code{dired-default-directory}
da5e0ce4 886also consults the variable @code{dired-default-directory-alist}.
4009494e
GM
887@end table
888
889@node Find File At Point, Miscellaneous Commands, Multiple Dired Directories, Top
4009494e
GM
890@section Find File At Point
891@cindex Visiting a file mentioned in a buffer
892@cindex Finding a file at point
893
894@file{dired-x} provides a method of visiting or editing a file mentioned in
895the buffer you are viewing (e.g., a mail buffer, a news article, a
896@file{README} file, etc.) or to test if that file exists. You can then modify
897this in the minibuffer after snatching the file name.
898
899When installed @file{dired-x} will substitute @code{dired-x-find-file} for
900@code{find-file} (normally bound to @kbd{C-x C-f}) and
901@code{dired-x-find-file-other-window} for @code{find-file-other-window}
902(normally bound to @kbd{C-x 4 C-f}).
903
904In order to use this feature, you will need to set
905@code{dired-x-hands-off-my-keys} to @code{nil} inside @code{dired-load-hook}
906(@pxref{Optional Installation File At Point}).
907
908@table @code
909@item dired-x-find-file
910@findex dired-x-find-file
911@kindex C-x C-f
912
913@code{dired-x-find-file} behaves exactly like @code{find-file} (normally bound
914to @kbd{C-x C-f}) unless a prefix argument is passed to the function in which
915case it will use the file name at point as a guess for the file to visit.
916
917For example, if the buffer you were reading contained the words
918
919@example
920Available via anonymous ftp in
921
922 /roebling.poly.edu:/pub/lisp/crypt++.el.gz
923@end example
924
925@noindent
926then you could move your cursor to the line containing the ftp address and
927type @kbd{C-u C-x C-f} (the @kbd{C-u} is a universal argument). The
928minibuffer would read
929
930@example
931Find file: /roebling.poly.edu:/pub/lisp/crypt++.el.gz
932@end example
933
934@noindent
935with the point after the last @code{/}. If you hit @key{RET}, emacs will visit
936the file at that address. This also works with files on your own computer.
937
938@item dired-x-find-file-other-window
939@findex dired-x-find-file-other-window
940@kindex C-x 4 C-f
941
942@code{dired-x-find-file-other-window} behaves exactly like
943@code{find-file-other-window} (normally bound to @kbd{C-x 4 C-f}) unless a
944prefix argument is used. See @code{dired-x-find-file} for more information.
945
946@item dired-x-hands-off-my-keys
947@vindex dired-x-hands-off-my-keys
948If set to @code{t}, then it means that @file{dired-x} should @emph{not} bind
949@code{dired-x-find-file} over @code{find-file} on keyboard. Similarly, it
950should not bind @code{dired-x-find-file-other-window} over
951@code{find-file-other-window}. If you change this variable after
952@file{dired-x.el} is loaded then do @kbd{M-x dired-x-bind-find-file}. The
953default value of this variable is @code{t}; by default, the binding is not
954done. See @xref{Optional Installation File At Point}.
955
956@item dired-x-bind-find-file
957@findex dired-x-bind-find-file
958A function, which can be called interactively or in your @file{~/.emacs} file,
959that uses the value of @code{dired-x-hands-off-my-keys} to determine if
960@code{dired-x-find-file} should be bound over @code{find-file} and
961@code{dired-x-find-file-other-window} bound over
962@code{find-file-other-window}. See @xref{Optional Installation File At Point}.
963@end table
964
965@node Miscellaneous Commands, Bugs, Find File At Point, Top
4009494e
GM
966@chapter Miscellaneous Commands
967
968Miscellaneous features not fitting anywhere else:
969
970@table @code
971@item dired-find-subdir
972@vindex dired-find-subdir
973Default: @code{nil}
974
975If non-@code{nil}, Dired does not make a new buffer for a directory if it can
976be found (perhaps as subdirectory) in some existing Dired buffer.
977
978If there are several Dired buffers for a directory, the most recently
979used is chosen.
980
981Dired avoids switching to the current buffer, so that if you have a
982normal and a wildcard buffer for the same directory, @kbd{C-x d RET}
983will toggle between those two.
984@end table
985
986@table @kbd
987@findex dired-goto-subdir
988@kindex M-G
989@item M-G
990(@code{dired-goto-subdir}) Go to the header line of an inserted directory.
991This command reads its argument, with completion derived from the names of the
992inserted subdirectories.
993@end table
994
995@table @code
996@item dired-smart-shell-command
997@findex dired-smart-shell-command
998@findex shell-command
999@kindex M-!
1000Like function @code{shell-command}, but in the current Dired directory.
1001Bound to @kbd{M-!} in Dired buffers.
1002
1003@item dired-jump
1004@findex dired-jump
1005@kindex C-x C-j
1006@cindex Jumping to Dired listing containing file.
1007Bound to @kbd{C-x C-j}. Jump back to Dired: If in a file, edit the current
1008directory and move to file's line. If in Dired already, pop up a level and
1009go to old directory's line. In case the proper Dired file line cannot be
1010found, refresh the Dired buffer and try again.
1011
1012@item dired-jump-other-window
1013@findex dired-jump-other-window
1014@kindex C-x 4 C-j
1015Bound to @kbd{C-x 4 C-j}. Like @code{dired-jump}, but to other window.
1016
1017These functions can be autoloaded so they work even though @file{dired-x.el}
1018has not been loaded yet (@pxref{Optional Installation Dired Jump}).
1019
1020@vindex dired-bind-jump
1021If the variable @code{dired-bind-jump} is @code{nil}, @code{dired-jump} will not be
1022bound to @kbd{C-x C-j} and @code{dired-jump-other-window} will not be bound to
1023@kbd{C-x 4 C-j}.
1024
1025@item dired-vm
1026@cindex Reading mail.
1027@kindex V
1028@findex dired-vm
1029Bound to @kbd{V} if @code{dired-bind-vm} is @code{t}. Run VM on this
1030file (assumed to be a UNIX mail folder).
1031
1032@vindex dired-vm-read-only-folders
1033If you give this command a prefix argument, it will visit the folder
da5e0ce4 1034read-only.
4009494e
GM
1035
1036If the variable @code{dired-vm-read-only-folders} is @code{t},
da5e0ce4
GM
1037@code{dired-vm} will visit all folders read-only. If it is neither
1038@code{nil} nor @code{t}, e.g., the symbol @code{if-file-read-only}, only
1039files not writable by you are visited read-only.
4009494e
GM
1040
1041@vindex dired-bind-vm
1042If the variable @code{dired-bind-vm} is @code{t}, @code{dired-vm} will be bound
1043to @kbd{V}. Otherwise, @code{dired-bind-rmail} will be bound.
1044
1045@item dired-rmail
1046@cindex Reading mail.
1047@findex dired-rmail
1048Bound to @kbd{V} if @code{dired-bind-vm} is @code{nil}. Run Rmail on this
3a44dc1f 1049file (assumed to be mail folder in Rmail format).
4009494e
GM
1050
1051@item dired-info
1052@kindex I
1053@cindex Running info.
1054@findex dired-info
1055Bound to @kbd{I}. Run Info on this file (assumed to be a file in Info
1056format).
1057
1058@vindex dired-bind-info
1059If the variable @code{dired-bind-info} is @code{nil}, @code{dired-info} will
1060not be bound to @kbd{I}.
1061
1062@item dired-man
1063@cindex Running man.
1064@kindex N
1065@findex dired-man
1066Bound to @kbd{N}. Run man on this file (assumed to be a file in @code{nroff}
1067format).
1068
1069@vindex dired-bind-man
1070If the variable @code{dired-bind-man} is @code{nil}, @code{dired-man} will not
1071be bound to @kbd{N}.
1072
1073@item dired-do-relsymlink
1074@cindex Relative symbolic links.
1075@kindex Y
1076@findex dired-do-relsymlink
1077Bound to @kbd{Y}. Relative symlink all marked (or next ARG) files into a
1078directory, or make a relative symbolic link to the current file. This creates
1079relative symbolic links like
1080
1081@example
1082 foo -> ../bar/foo
1083@end example
1084
1085@noindent
1086not absolute ones like
1087
1088@example
1089 foo -> /ugly/path/that/may/change/any/day/bar/foo
1090@end example
1091
1092@item dired-do-relsymlink-regexp
1093@kindex %Y
1094@findex dired-do-relsymlink-regexp
1095Bound to @kbd{%Y}. Relative symlink all marked files containing
1096@var{regexp} to @var{newname}. See functions
1097@code{dired-do-rename-regexp} and @code{dired-do-relsymlink} for more
1098info.
1099@end table
1100
1101@node Bugs, GNU Free Documentation License, Miscellaneous Commands, Top
4009494e
GM
1102@chapter Bugs
1103@cindex Bugs
4009494e
GM
1104
1105@noindent
07ca5555
GM
1106If you encounter a bug in this package, or wish to suggest an
1107enhancement, then please use @kbd{M-x report-emacs-bug} to report it.
4009494e
GM
1108
1109@node GNU Free Documentation License, Concept Index, Bugs, Top
1110@appendix GNU Free Documentation License
1111@include doclicense.texi
1112
1113@node Concept Index, Command Index, GNU Free Documentation License, Top
4009494e
GM
1114@unnumbered Concept Index
1115@printindex cp
1116
1117@node Command Index, Key Index, Concept Index, Top
4009494e
GM
1118@unnumbered Function Index
1119@printindex fn
1120
1121@node Key Index, Variable Index, Command Index, Top
4009494e
GM
1122@unnumbered Key Index
1123@printindex ky
1124
1125@node Variable Index, , Key Index, Top
4009494e
GM
1126@unnumbered Variable Index
1127@printindex vr
1128
4009494e 1129@bye