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