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