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