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