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