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