(eshell-windows-shell-file): Fix :type.
[emacs.git] / man / dired-x.texi
blob8babaf260bcec96dcbc121fc61a4d8dc546e3341
1 \input texinfo  @comment -*-texinfo-*-
3 @c dired-x.texi --- Sebastian Kremer's Extra DIRED hacked up for GNU Emacs19
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 @c Version: 2.52
9 @c Date: 1994/08/09 16:51:31
10 @c Keywords: dired extensions
11 @c dired-x.el REVISION NUMBER: 2
13 @c State: Released
14 @c Ident: dired-x.texi,v 2.52 1994/08/09 16:51:31 dodd Released
16 @comment %**start of header (This is for running Texinfo on a region.)
17 @c FOR GNU EMACS USE ../info/dired-x BELOW
18 @setfilename ../info/dired-x
19 @c dired-x.el REVISION NUMBER
20 @settitle Dired Extra Version 2 User's Manual
22 @dircategory Emacs
23 @direntry
24 * Dired-X: (dired-x).   Dired Extra Features.
25 @end direntry
27 @iftex
28 @finalout
29 @end iftex
30 @c @setchapternewpage odd               % For book style double sided manual.
31 @comment %**end of header (This is for running Texinfo on a region.)
32 @c      @smallbook
33 @tex
34 \overfullrule=0pt
35 %\global\baselineskip 30pt      % For printing in double spaces
36 @end tex
38 @ifinfo
39 @node Copyright, Top, (dir), (dir)
40 @comment  node-name,  next,  previous,  up
41 This documents the ``extra'' features for Dired Mode for GNU Emacs found in
42 the file @file{dired-x.el}.
44 Copyright @copyright{} 1993, 1994 Free Software Foundation, Inc.
46 Permission is granted to make and distribute verbatim copies of this
47 manual provided the copyright notice and this permission notice are
48 preserved on all copies.
50 Permission is granted to copy and distribute modified versions of
51 this manual under the conditions for verbatim copying, provided that
52 the entire resulting derived work is distributed under the terms of
53 a permission notice identical to this one.
55 Permission is granted to copy and distribute translations of this
56 manual into another language, under the above conditions for
57 modified versions, except that this permission notice may be stated
58 in a translation approved by the Free Software Foundation.
60 The file used to create this is called @file{dired-x.texi}, but the
61 original work that was altered to make that file was called
62 @file{dired.texi} written by Sebastian Kremer.
64 @ignore
65 Permission is granted to process this file through TeX and print the
66 results, provided the printed document carries copying permission
67 notice identical to this one except for the removal of this paragraph
68 (this paragraph not being relevant to the printed manual).
70 @end ignore
71 @end ifinfo
74 @titlepage
75 @sp 6
76 @c dired-x.el REVISION NUMBER
77 @center @titlefont{Dired Extra Version 2}
78 @sp 2
79 @center @titlefont{For The GNU Emacs}
80 @sp 1
81 @center @titlefont{Directory Editor}
82 @sp 4
83 @center Manual Revision: 2.52
84 @center 1994/08/09 16:51:31
85 @sp 5
86 @center Lawrence R@. Dodd
87 @c @center @t{dodd@@roebling.poly.edu}
88 @sp 5
89 @center (Based on @file{dired.texi} by Sebastian Kremer <sk@@thp.uni-koeln.de>)
90 @page
91 @vskip 0pt plus 1filll
92 Copyright @copyright{} 1993, 1994 Free Software Foundation
94 Permission is granted to make and distribute verbatim copies of
95 this manual provided the copyright notice and this permission notice
96 are preserved on all copies.
98 Permission is granted to copy and distribute modified versions of
99 this manual under the conditions for verbatim copying, provided that
100 the entire resulting derived work is distributed under the terms of
101 a permission notice identical to this one.
103 Permission is granted to copy and distribute translations of this
104 manual into another language, under the above conditions for
105 modified versions, except that this permission notice may be stated
106 in a translation approved by the Free Software Foundation.
108 The file used to create this is called @file{dired-x.texi}, but the
109 original work that was altered to make that file was called
110 @file{dired.texi} written by Sebastian Kremer.
112 @end titlepage
114 @page
116 @ifinfo
118 @node Top, Introduction, Copyright, (dir)
119 @comment  node-name,  next,  previous,  up
121 @noindent
122 This documents the ``extra'' features for Dired Mode for GNU Emacs that are
123 provided by the file @file{dired-x.el}.
125 @itemize @bullet
127 @item
128 Based on @file{dired.texi} by Sebastian Kremer <sk@@thp.uni-koeln.de>
130 @c dired-x.el REVISION NUMBER
131 @item 
132 For @file{dired-x.el} revision 2
134 @c @item 
135 @c Revision of this manual: 2.52 (1994/08/09 16:51:31)
137 @c @item
138 @c Bugs to Lawrence R. Dodd <dodd@@roebling.poly.edu>.  @emph{Please} type
139 @c @kbd{M-x dired-x-submit-report} to submit a bug report (@pxref{Bugs}).
141 @c @item
142 @c You can obtain a copy of this package via anonymous ftp in
143 @c @t{/roebling.poly.edu:/pub/packages/dired-x.tar.gz}
145 @end itemize
147 @menu
148 * Introduction::
149 * Installation::
150 * Omitting Files in Dired::
151 * Local Variables::
152 * Shell Command Guessing::
153 * Virtual Dired::
154 * Advanced Mark Commands::
155 * Multiple Dired Directories::
156 * Find File At Point::
157 * Miscellaneous Commands::
158 * Bugs::
160 * Concept Index::               
161 * Command Index::       
162 * Key Index::           
163 * Variable Index::      
165 @end menu
167 @end ifinfo
169 @node Introduction, Features, Top, Top
170 @comment  node-name,  next,  previous,  up
171 @chapter Introduction
173 This documents the @emph{extra} features for Dired Mode for GNU Emacs.  It
174 is derived from version 1.191 of Sebastian Kremer's @file{dired-x.el}.
176 In adopting this @file{dired-x.el} to GNU Emacs v19 some material that has
177 been incorporated into @file{dired.el} and @file{dired-aux.el} of the GNU Emacs
178 19 distribution has been removed and some material was modified for agreement
179 with the functions in @file{dired.el} and @file{dired-aux.el}.  For example,
180 the code using @code{gmhist} history functions was replaced with code using
181 the mini-buffer history now built into GNU Emacs.  Finally, a few other
182 features have been added and a few more functions have been bound to keys.
184 @ifinfo
185 @menu
186 * Features::
187 * Technical Details::
188 @end menu
189 @end ifinfo
191 @node Features, Technical Details, Introduction, Introduction
192 @comment  node-name,  next,  previous,  up
193 @section Features
194 @cindex Features
196 Some features provided by Dired Extra
198 @enumerate
199 @item
200 Omitting of uninteresting files from dired listing. 
201 @itemize @bullet
202 @xref{Omitting Files in Dired}.
203 @end itemize
204 @item
205 Local variables for dired directories.
206 @itemize @bullet
207 @xref{Local Variables}.
208 @end itemize
209 @item
210 Guessing shell commands in dired buffers.
211 @itemize @bullet
212 @xref{Shell Command Guessing}.
213 @end itemize
214 @item
215 Running dired command in non-dired buffers.
216 @itemize @bullet
217 @xref{Virtual Dired}.
218 @end itemize
219 @item
220 Finding a file mentioned in a buffer
221 @itemize @bullet
222 @xref{Find File At Point}.
223 @end itemize
224 @item
225 Commands using file marking.
226 @itemize @bullet
227 @xref{Advanced Mark Commands}.
228 @end itemize
229 @end enumerate
231 @noindent
232 @file{dired-x.el} binds some functions to keys in Dired Mode (@pxref{Key
233 Index}) and also binds @kbd{C-x C-j} and @kbd{C-x 4 C-j} @emph{globally} to
234 @code{dired-jump} (@pxref{Miscellaneous Commands}).  It may also bind @kbd{C-x
235 C-f} and @kbd{C-x 4 C-f} to @code{dired-x-find-file} and
236 @code{dired-x-find-file-other-window}, respectively (@pxref{Find File At
237 Point}).
239 @node Technical Details, Installation, Features, Introduction
240 @comment  node-name,  next,  previous,  up
241 @section Technical Details
242 @cindex Redefined functions
243 @cindex @file{dired-aux.el}
245 When loaded this code @emph{redefines} the following functions of GNU Emacs
246 from @file{dired.el}
248 @itemize @bullet
249 @item
250 @code{dired-clean-up-after-deletion}
251 @item
252 @code{dired-find-buffer-nocreate}
253 @item
254 @code{dired-initial-position}
255 @item
256 @code{dired-up-directory}
257 @end itemize
259 @noindent
260 and the following functions from @file{dired-aux.el}
262 @itemize @bullet
263 @item
264 @code{dired-add-entry}
265 @item
266 @code{dired-read-shell-command}
267 @end itemize
269 @node Installation, Optional Installation Dired Jump, Technical Details, Top
270 @comment  node-name,  next,  previous,  up
271 @chapter Installation
273 @noindent
274 This manual describes the dired features provided by the file
275 @file{dired-x.el}.  To take advantage of these features, you must load the
276 file and (optionally) set some variables.
278 @noindent
279 In your @file{.emacs} file in your home directory, or in the system-wide
280 initialization file @file{default.el} in the @file{site-lisp} directory, put
282 @example
283 (add-hook 'dired-load-hook
284           (lambda ()
285             (load "dired-x")
286             ;; Set dired-x global variables here.  For example:
287             ;; (setq dired-guess-shell-gnutar "gtar")
288             ;; (setq dired-x-hands-off-my-keys nil)
289             ))
290 (add-hook 'dired-mode-hook
291           (lambda ()
292             ;; Set dired-x buffer-local variables here.  For example:
293             ;; (setq dired-omit-files-p t)
294             ))
295 @end example
297 @noindent
298 This will load @file{dired-x.el} when dired is first invoked (for example,
299 when you first do @kbd{C-x d}).
301 @ifinfo
302 @menu
303 * Optional Installation Dired Jump::
304 * Optional Installation File At Point::
305 @end menu
306 @end ifinfo
308 @node Optional Installation Dired Jump, Optional Installation File At Point, Installation, Installation
309 @comment  node-name,  next,  previous,  up
310 @section Optional Installation Dired Jump
312 @cindex Autoloading @code{dired-jump} and @code{dired-jump-other-window}
314 In order to have @code{dired-jump} and @code{dired-jump-other-window}
315 (@pxref{Miscellaneous Commands}) work @emph{before} @code{dired} and
316 @code{dired-x} have been properly loaded the user should set-up an autoload
317 for these functions.  In your @file{.emacs} file put
319 @example
320 ;;; Autoload `dired-jump' and `dired-jump-other-window'.
321 ;;; We autoload from FILE dired.el.  This will then load dired-x.el 
322 ;;; and hence define `dired-jump' and `dired-jump-other-window'.
323 (define-key global-map "\C-x\C-j" 'dired-jump)
324 (define-key global-map "\C-x4\C-j" 'dired-jump-other-window)
326 (autoload (quote dired-jump) "dired" "\
327 Jump to dired buffer corresponding to current buffer.
328 If in a file, dired the current directory and move to file's line.
329 If in dired already, pop up a level and goto old directory's line.
330 In case the proper dired file line cannot be found, refresh the dired
331 buffer and try again." t nil)
333 (autoload (quote dired-jump-other-window) "dired" "\
334 Like \\[dired-jump] (dired-jump) but in other window." t nil)
335 @end example
337 Note that in recent releases of GNU Emacs 19 (i.e., 19.25 or later) the file
338 @file{../lisp/loaddefs.el} of the Emacs distribution already contains the
339 proper auto-loading for @code{dired-jump} so you need only put
341 @example
342 (define-key global-map "\C-x\C-j" 'dired-jump)
343 @end example
345 @noindent in your @file{.emacs} file in order to have @kbd{C-x C-j} work
346 before @code{dired} is loaded.
348 @node Optional Installation File At Point, , Optional Installation Dired Jump, Installation
349 @comment  node-name,  next,  previous,  up
350 @section Optional Installation File At Point
352 @cindex Binding @code{dired-x-find-file}
353 If you choose to have @file{dired-x.el} bind @code{dired-x-find-file} over
354 @code{find-file} (@pxref{Find File At Point}), then you will need to set
355 @code{dired-x-hands-off-my-keys} and make a call to the function
356 @code{dired-x-bind-find-file} in the @code{dired-load-hook}:
358 @example
359 (add-hook 'dired-load-hook 
360           (lambda ()
361             (load "dired-x")
362             ;; Bind dired-x-find-file.
363             (setq dired-x-hands-off-my-keys nil)
364             ;; Make sure our binding preference is invoked.
365             (dired-x-bind-find-file)
366             ))
367 @end example
369 Alternatively, you can set the variable @emph{before} @file{dired-x.el} is
370 loaded
372 @example
373 (add-hook 'dired-load-hook 
374           (lambda ()
375             ;; Bind dired-x-find-file.
376             (setq dired-x-hands-off-my-keys nil)
377             (load "dired-x")
378             ))
379 @end example
381 @node Omitting Files in Dired, Omitting Variables, , Top
382 @comment  node-name,  next,  previous,  up
383 @chapter Omitting Files in Dired
385 @cindex Omitting Files in Dired
386 @dfn{Omitting} a file means removing it from the directory listing.  Omitting
387 is useful for keeping Dired buffers free of ``uninteresting'' files (for
388 instance, auto-save, auxiliary, backup, and revision control files) so that
389 the user can concentrate on the interesting files.  Like hidden files, omitted
390 files are never seen by Dired.  Omitting differs from hiding in several
391 respects:
393 @itemize @bullet
395 @item
396 Omitting works on individual files, not on directories; an entire directory
397 cannot be omitted (though each of its files could be).
399 @item
400 Omitting is wholesale; if omitting is turned on for a dired buffer, then all
401 uninteresting files listed in that buffer are omitted.  The user does not omit
402 (or unomit) files one at a time.
404 @item
405 Omitting can be automatic; uninteresting file lines in the buffer can be
406 removed before the user ever sees them.
408 @item
409 Marked files are never omitted.
410 @end itemize
412 @table @kbd
413 @item M-o
414 @kindex M-o
415 @findex dired-omit-toggle
416 (@code{dired-omit-toggle}) Toggle between displaying and omitting
417 ``uninteresting'' files.  With a prefix argument, don't toggle and just mark
418 the files, but don't actually omit them.
419 @end table
421 @noindent
422 In order to make Dired Omit work you first need to load @file{dired-x.el}
423 inside @code{dired-load-hook} (@pxref{Installation}) and then set
424 @code{dired-omit-files-p} in some way (@pxref{Omitting Variables}).
426 @ifinfo
427 @menu
428 * Omitting Variables::
429 * Omitting Examples::
430 * Omitting Technical::
431 @end menu
432 @end ifinfo
434 @node Omitting Variables, Omitting Examples, Omitting Files in Dired, Omitting Files in Dired
435 @comment  node-name,  next,  previous,  up
437 @section Omitting Variables
439 The following variables can be used to customize omitting.
441 @table @code
443 @vindex dired-omit-files-p
444 @item dired-omit-files-p
446 Default: @code{nil}
448 @cindex How to make omitting the default in Dired
449 If non-@code{nil}, ``uninteresting'' files are not listed.  Uninteresting
450 files are those whose filenames match regexp @code{dired-omit-files}, plus
451 those ending with extensions in @code{dired-omit-extensions}.  @kbd{M-o}
452 (@code{dired-omit-toggle}) toggles its value, which is buffer-local.  Put
454 @example
455 (setq dired-omit-files-p t)
456 @end example
458 inside your @code{dired-mode-hook} to have omitting initially turned on in
459 @emph{every} Dired buffer (@pxref{Installation}).  You can then use @kbd{M-o} to
460 unomit in that buffer.
462 To enable omitting automatically only in certain directories one can use Dired
463 Local Variables and put
465 @example
466 Local Variables:
467 dired-omit-files-p: t
468 End:
469 @end example
471 @noindent
472 into a file @file{.dired} (the default value of
473 @code{dired-local-variables-file}) in that directory (@pxref{Local Variables}).
475 @table @code
476 @findex dired-omit-here-always
477 @item dired-omit-here-always
479 This is an interactive function that creates a local variables file exactly
480 like the example above (if it does not already exist) in the file
481 @code{dired-local-variables-file} in the current directory and then refreshes
482 the directory listing (@pxref{Local Variables}).
483 @end table
485 @vindex dired-omit-files
486 @item dired-omit-files
488 Default: @code{"^#\\|\\.$"}
490 Filenames matching this buffer-local regexp will not be displayed.
491 This only has effect when @code{dired-omit-files-p} is t.
493 The default value omits the special directories @file{.} and @file{..}  and
494 autosave files (plus other files ending in ``.'') (@pxref{Omitting Examples}).
496 @vindex dired-omit-extensions
497 @item dired-omit-extensions
499 Default: The elements of @code{completion-ignored-extensions} (as defined in
500 the file @file{loaddefs.el} of the GNU Emacs distribution),
501 @code{dired-latex-unclean-extensions}, @code{dired-bibtex-unclean-extensions}
502 and @code{dired-texinfo-unclean-extensions}.
504 If non-@code{nil}, a list of extensions (strings) to omit from Dired listings.
505 Its format is the same as that of @code{completion-ignored-extensions}.
507 @vindex dired-omit-localp
508 @item dired-omit-localp
510 Default:  @code{'no-dir}
512 The @var{localp} argument @code{dired-omit-expunge} passes to
513 @code{dired-get-filename}.  If it is @code{'no-dir}, omitting is much faster,
514 but you can only match against the non-directory part of the filename.  Set it
515 to @code{nil} if you need to match the whole pathname or @code{t} to match the
516 pathname relative to the buffer's top-level directory.
518 @item dired-omit-marker-char
519 @vindex dired-omit-marker-char
520 @cindex Omitting additional files
521 Default: @kbd{C-o}
523 Temporary marker used by by Dired to implement omitting.  Should never be used
524 as marker by the user or other packages.  There is one exception to this rule:
525 by doing
527 @example
528 (setq dired-mark-keys "\C-o")
529 ;; i.e., the value of dired-omit-marker-char
530 ;; (which is not defined yet)
531 @end example
533 anywhere in your @file{~/.emacs}, you will bind the @kbd{C-o} key to insert a
534 @kbd{C-o} marker, thus causing these files to be omitted in addition to the
535 usually omitted files.  Unfortunately the files you omitted manually this way
536 will show up again after reverting the buffer, unlike the others.
538 @end table
540 @node Omitting Examples, Omitting Technical, Omitting Variables, Omitting Files in Dired
541 @comment  node-name,  next,  previous,  up
542 @section Examples of Omitting Various File Types
544 @itemize @bullet
546 @item
547 @cindex RCS files, how to omit them in Dired
548 @cindex Omitting RCS files in Dired
549 If you wish to avoid seeing RCS files and the RCS directory, then put
551 @example
552 (setq dired-omit-files
553       (concat dired-omit-files "\\|^RCS$\\|,v$"))
554 @end example
555 @noindent
556 in the @code{dired-load-hook} (@pxref{Installation}).  This assumes
557 @code{dired-omit-localp} has its default value of @code{'no-dir} to make the
558 @code{^}-anchored matches work.  As a slower alternative, with
559 @code{dired-omit-localp} set to @code{nil}, you can use @code{/} instead of
560 @code{^} in the regexp.
562 @item
563 @cindex Tib files, how to omit them in Dired
564 @cindex Omitting tib files in Dired
565 If you use tib, the bibliography program for use with @TeX{} and La@TeX{}, you
566 might want to omit the @file{INDEX} and the @file{-t.tex} files, then put
568 @example
569 (setq dired-omit-files
570       (concat dired-omit-files "\\|^INDEX$\\|-t\\.tex$"))
571 @end example
573 @noindent
574 in the @code{dired-load-hook} (@pxref{Installation}).
576 @item
577 @cindex Dot files, how to omit them in Dired
578 @cindex Omitting dot files in Dired
579 If you do not wish to see @samp{dot} files (files starting with a @samp{.}),
580 then put
582 @example
583 (setq dired-omit-files
584       (concat dired-omit-files "\\|^\\..+$"))
585 @end example
587 @noindent
588 in the @code{dired-load-hook} (@pxref{Installation}).
590 @end itemize
592 @node Omitting Technical, Local Variables, Omitting Examples, Omitting Files in Dired
593 @comment  node-name,  next,  previous,  up
594 @section Some Technical Details of Omitting
596 Loading @file{dired-x.el} will install Dired Omit by putting
597 @code{dired-omit-expunge} on your @code{dired-after-readin-hook}, and will
598 call @code{dired-extra-startup}, which in turn calls @code{dired-omit-startup}
599 in your @code{dired-mode-hook}.
601 @node Local Variables, Shell Command Guessing, Omitting Technical, Top
602 @comment  node-name,  next,  previous,  up
603 @chapter Local Variables for Dired Directories
605 @cindex Local Variables for Dired Directories
606 @vindex dired-local-variables-file
607 @vindex dired-enable-local-variables
608 @noindent
609 When Dired visits a directory, it looks for a file whose name is the value of
610 variable @code{dired-local-variables-file} (default: @file{.dired}).  If such
611 a file is found, Dired will temporarily insert it into the Dired buffer and
612 run @code{hack-local-variables}.  
614 @noindent
615 For example, if the user puts
617 @example
618 Local Variables:
619 dired-actual-switches: "-lat"
620 dired-omit-files-p: t
621 End:
622 @end example
624 @noindent
625 into a file called @file{.dired} in a directory then when that directory is
626 viewed it will be
628 @enumerate
629 @item
630 sorted by date 
631 @item
632 omitted automatically
633 @end enumerate
635 @noindent
636 You can set @code{dired-local-variables-file} to @code{nil} to suppress this.
637 The value of @code{dired-enable-local-variables} controls if and how these
638 local variables are read.  This variable exists so that if may override the
639 default value of @code{enable-local-variables}.  
641 @noindent
642 Please see the GNU Emacs Manual to learn more about local variables.
643 @xref{File Variables,Local Variables in Files,Local Variables in
644 Files,emacs,The GNU Emacs Manual}.
646 @noindent
647 The following variables affect Dired Local Variables
649 @table @code
650 @vindex dired-local-variables-file
651 @item dired-local-variables-file
652 Default: @code{".dired"}
654 If non-@code{nil}, filename for local variables for Dired.  If Dired finds a
655 file with that name in the current directory, it will temporarily insert it
656 into the dired buffer and run `hack-local-variables'.
658 @vindex dired-enable-local-variables
659 @item dired-enable-local-variables
660 Default: @code{t}
662 Controls use of local-variables lists in dired.  The value can be @code{t},
663 @code{nil}, or something else.  A value of @code{t} means local-variables
664 lists are obeyed in the @code{dired-local-variables-file}; @code{nil} means
665 they are ignored; anything else means query.  This variable temporarily
666 overrides the value of @code{enable-local-variables} when the Dired Local
667 Variables are hacked.
668 @end table
670 @node Shell Command Guessing, Virtual Dired, Local Variables, Top
671 @comment  node-name,  next,  previous,  up
672 @chapter Shell Command Guessing
673 @cindex Guessing shell commands for files.
675 Based upon the name of a filename, Dired tries to guess what shell
676 command you might want to apply to it.  For example, if you have point
677 on a file named @file{foo.tar} and you press @kbd{!}, Dired will guess
678 you want to @samp{tar xvf} it and suggest that as the default shell
679 command.
681 The default will be mentioned in brackets and you can type @kbd{M-p} to get
682 the default into the minibuffer so that you can edit it, e.g., changing
683 @samp{tar xvf} to @samp{tar tvf}.  If there are several commands for a given
684 file, e.g., @samp{xtex} and @samp{dvips} for a @file{.dvi} file, you can type
685 @kbd{M-p} several times to see each of the matching commands.
687 Dired only tries to guess a command for a single file, never for a list
688 of marked files.
690 @table @code
691 @item dired-guess-shell-alist-default
692 @vindex dired-guess-shell-alist-default
693 Predefined rules for shell commands.  Set this to @code{nil} to turn guessing off.
694 The elements of @code{dired-guess-shell-alist-user} (defined by the
695 user) will override these rules.@refill
697 @item dired-guess-shell-alist-user
698 @vindex dired-guess-shell-alist-user
699 If non-@code{nil}, a user-defined alist of file regexps and their suggested
700 commands.  These rules take precedence over the predefined rules in the
701 variable @code{dired-guess-shell-alist-default} (to which they are prepended)
702 when @code{dired-do-shell-command} is run).
703 @refill
705 Each element of the alist looks like
707 @example
708 (@var{regexp} @var{command}@dots{})
709 @end example
711 where each @var{command} can either be a string or a lisp expression
712 that evaluates to a string.  If several @var{COMMAND}s are given, all
713 will temporarily be pushed on the history.
715 You can set this variable in your @file{~/.emacs}.  For example,
716 to add rules for @samp{.foo} and @samp{.bar} file extensions, write
718 @example
719 (setq dired-guess-shell-alist-user
720       (list
721        (list "\\.foo$" "@var{foo-command}");; fixed rule
722        ;; possibly more rules...
723        (list "\\.bar$";; rule with condition test
724               '(if @var{condition}
725                    "@var{bar-command-1}"
726                  "@var{bar-command-2}"))))
727 @end example
729 @noindent
730 This will override any predefined rules for the same extensions.
732 @item dired-guess-shell-gnutar
733 @vindex dired-guess-shell-gnutar
734 @cindex Passing GNU tar its `z' switch.
735 Default: @code{nil}
737 If non-@code{nil}, name of the GNU tar executable (e.g., @samp{"tar"} or
738 @samp{"gnutar"}).  GNU tar's @samp{z} switch is used for compressed tar files.
739 If you don't have GNU tar, set this to @code{nil}: a pipe using @samp{zcat} is
740 then used.
742 @item dired-guess-shell-gzip-quiet
743 @vindex dired-guess-shell-gzip-quiet
744 @cindex GNU zip.
745 Default: @code{t}
747 A non-@code{nil} value means that @code{-q} is passed to gzip overriding a
748 verbose GNU zip's @env{GZIP} environment variable.
750 @item dired-guess-shell-znew-switches nil
751 @vindex dired-guess-shell-znew-switches nil
752 @cindex GNU zip.
753 Default: @code{nil}
755 A string of switches passed to GNU zip's @file{znew}.  An example is
756 @samp{"-K"} which will make @file{znew} keep a .Z file when it is smaller than
757 the .gz file.
759 @item dired-shell-command-history nil
760 @vindex dired-shell-command-history nil
762 History list for commands that read dired-shell commands.
763 @end table
765 @node Virtual Dired, Advanced Mark Commands, Shell Command Guessing, Top
766 @comment  node-name,  next,  previous,  up
767 @chapter Virtual Dired
769 @cindex Virtual Dired
770 @cindex Perusing ls listings
771 @cindex ls listings, how to peruse them in Dired
772 Using @dfn{Virtual Dired} means putting a buffer with Dired-like
773 contents in Dired mode.  The files described by the buffer contents need
774 not actually exist.  This is useful if you want to peruse an @samp{ls -lR}
775 output file, for example one you got from an FTP server.  You can use
776 all motion commands usually available in Dired.  You can also use
777 it to save a Dired buffer in a file and resume it in a later session.
779 @findex dired-virtual
780 @kindex g
781 @findex dired-virtual-revert
782 Type @kbd{M-x dired-virtual} to put the current buffer into virtual
783 Dired mode.  You will be prompted for the top level directory of this
784 buffer, with a default value guessed from the buffer contents.  To
785 convert the virtual to a real Dired buffer again, type @kbd{g} (which
786 calls @code{dired-virtual-revert}) in the virtual Dired buffer and
787 answer @samp{y}.  You don't have to do this, though: you can relist
788 single subdirectories using @kbd{l} (@code{dired-do-redisplay}) on the subdirectory
789 headerline, leaving the buffer in virtual Dired mode all the time.
791 @findex dired-virtual-mode
792 @vindex auto-mode-alist
793 The function @samp{dired-virtual-mode} is specially designed to turn on
794 virtual Dired mode from the @code{auto-mode-alist}.  To edit all
795 @file{*.dired} files automatically in virtual Dired mode, put this into your
796 @file{~/.emacs}:
798 @example
799 (setq auto-mode-alist (cons '("[^/]\\.dired$" . dired-virtual-mode)
800                               auto-mode-alist))
801 @end example
803 The regexp is a bit more complicated than usual to exclude ".dired"
804 local variable files.
806 @node Advanced Mark Commands, Advanced Cleaning Functions, Virtual Dired, Top
807 @comment  node-name,  next,  previous,  up
808 @chapter Advanced Mark Commands
810 @table @kbd
811 @item F
812 @kindex F
813 @cindex Visiting several files at once
814 @cindex Simultaneous visiting of several files
815 @findex dired-do-find-marked-files
816 (@code{dired-do-find-marked-files}) Find all marked files at once displaying
817 simultaneously.  If optional NOSELECT is non-@code{nil} then just find the
818 files but do not select.  If you want to keep the dired buffer displayed, type
819 @kbd{C-x 2} first.  If you want just the marked files displayed and nothing
820 else, type @kbd{C-x 1} first.
822 The current window is split across all files marked, as evenly as possible.
823 Remaining lines go to the bottom-most window.  The number of files that can be
824 displayed this way is restricted by the height of the current window and the
825 variable @code{window-min-height}.
826 @end table
828 @table @code
829 @item dired-mark-extension
830 @findex dired-mark-extension
831 Mark all files with a certain extension for use in later commands.  A @samp{.}
832 is not automatically prepended to the string entered.
834 When called from lisp, @var{extension} may also be a list of extensions
835 and an optional argument @var{marker-char} specifies the marker used.
837 @item dired-flag-extension
838 @findex dired-flag-extension
839 Flag all files with a certain extension for deletion.  A @samp{.} is
840 @emph{not} automatically prepended to the string entered.
841 @end table
843 @ifinfo
844 @menu
845 * Advanced Cleaning Functions::
846 * Advanced Cleaning Variables::
847 * Special Marking Function::
848 @end menu
849 @end ifinfo
851 @node Advanced Cleaning Functions, Advanced Cleaning Variables, Advanced Mark Commands, Advanced Mark Commands
852 @comment  node-name,  next,  previous,  up
854 @section Advanced Cleaning Functions
856 @table @code
857 @item dired-clean-patch
858 @findex dired-clean-patch
859 Flag dispensable files created by the @samp{patch} program for deletion.  See
860 variable @code{dired-patch-unclean-extensions}.
862 @item dired-clean-tex
863 @findex dired-clean-tex
864 Flag dispensable files created by @TeX{}, La@TeX{}, and @samp{texinfo} for
865 deletion.  See the following variables (@pxref{Advanced Cleaning Variables}):
867 @itemize @bullet
868 @item
869 @code{dired-tex-unclean-extensions}
870 @item
871 @code{dired-texinfo-unclean-extensions}
872 @item
873 @code{dired-latex-unclean-extensions}
874 @item
875 @code{dired-bibtex-unclean-extensions}
876 @end itemize
878 @item dired-very-clean-tex
879 @findex dired-very-clean-tex
880 Flag dispensable files created by @TeX{}, La@TeX{}, @samp{texinfo}, and ".dvi"
881 files for deletion.
882 @end table
884 @node Advanced Cleaning Variables, Special Marking Function, Advanced Cleaning Functions, Advanced Mark Commands
885 @comment  node-name,  next,  previous,  up
887 @section Advanced Cleaning Variables
889 @noindent Variables used by the above cleaning commands (and in the default value for
890 variable @code{dired-omit-extensions}, @pxref{Omitting Variables})
892 @table @code
893 @item dired-patch-unclean-extensions
894 @vindex dired-patch-unclean-extensions
895 Default: @code{'(".rej" ".orig")}
897 List of extensions of dispensable files created by the @samp{patch} program.
899 @item dired-tex-unclean-extensions
900 @vindex dired-tex-unclean-extensions
901 Default:  @code{'(".toc" ".log" ".aux")}
903 List of extensions of dispensable files created by @TeX{}.
905 @item dired-texinfo-unclean-extensions
906 @vindex dired-texinfo-unclean-extensions
907 Default: @code{'(".cp" ".cps" ".fn" ".fns" ".ky" ".kys"}
908 @code{".pg" ".pgs" ".tp" ".tps" ".vr" ".vrs")}
910 List of extensions of dispensable files created by @samp{texinfo}.
912 @item dired-latex-unclean-extensions
913 @vindex dired-latex-unclean-extensions
914 Default: @code{'(".idx" ".lof" ".lot" ".glo")}
916 List of extensions of dispensable files created by La@TeX{}.
918 @item dired-bibtex-unclean-extensions
919 @vindex dired-bibtex-unclean-extensions
920 Default:  @code{'(".blg" ".bbl")}
922 List of extensions of dispensable files created by Bib@TeX{}.
923 @end table
925 @node Special Marking Function, Multiple Dired Directories, Advanced Cleaning Variables, Advanced Mark Commands
926 @comment  node-name,  next,  previous,  up
928 @section Special Marking Function
930 @table @kbd
931 @item M-(
932 @kindex M-(
933 @findex dired-mark-sexp
934 @cindex Lisp expression, marking files with in Dired
935 @cindex Mark file by lisp expression
936 (@code{dired-mark-sexp}) Mark files for which @var{predicate} returns
937 non-@code{nil}.  With a prefix argument, unflag those files instead.
939 The @var{predicate} is a lisp expression that can refer to the following
940 symbols:
941 @table @code
942 @item inode
943 [@i{integer}] the inode of the file (only for @samp{ls -i} output)
944 @item s
945 [@i{integer}] the size of the file for @samp{ls -s} output (usually in blocks or,
946 with @samp{-k}, in KBytes)
947 @item mode
948 [@i{string}]  file permission bits, e.g., @samp{"-rw-r--r--"}
949 @item nlink
950 [@i{integer}] number of links to file
951 @item uid
952 [@i{string}]  owner
953 @item gid
954 [@i{string}]  group  (If the gid is not displayed by @samp{ls}, this
955 will still be set (to the same as uid))
956 @item size
957 [@i{integer}] file size in bytes
958 @item time
959 [@i{string}]  the time that @samp{ls} displays, e.g., @samp{"Feb 12 14:17"}
960 @item name
961 [@i{string}]  the name of the file
962 @item sym
963 [@i{string}]  if file is a symbolic link, the linked-to name, else @samp{""}
964 @end table
966 @noindent
967 For example, use
968 @example
969 (equal 0 size)
970 @end example
971 to mark all zero length files.
973 To find out all not yet compiled Emacs lisp files in a directory, dired
974 all @file{.el} files in the lisp directory using the wildcard
975 @samp{*.el}.  Then use @kbd{M-(} with
976 @example
977 (not (file-exists-p (concat name "c")))
978 @end example
979 to mark all @file{.el} files without a corresponding @file{.elc} file.
981 @end table
983 @node Multiple Dired Directories, Find File At Point, Special Marking Function, Top
984 @comment  node-name,  next,  previous,  up
985 @chapter Multiple Dired Directories and Non-Dired Commands
987 @cindex Multiple Dired directories
988 @cindex Working directory
989 An Emacs buffer can have but one working directory, stored in the
990 buffer-local variable @code{default-directory}.  A Dired buffer may have
991 several subdirectories inserted, but still has but one working
992 directory: that of the top level Dired directory in that buffer.  For
993 some commands it is appropriate that they use the current Dired
994 directory instead of @code{default-directory}, e.g., @code{find-file} and
995 @code{compile}.
997 A general mechanism is provided for special handling of the working
998 directory in special major modes:
1000 @table @code
1001 @item default-directory-alist
1002 @vindex default-directory-alist
1003 Default: @code{((dired-mode . (dired-current-directory)))}
1005 Alist of major modes and their opinion on @code{default-directory}, as a
1006 lisp expression to evaluate.  A resulting value of @code{nil} is ignored
1007 in favor of @code{default-directory}.
1009 @item default-directory
1010 @findex default-directory
1011 Function with usage like variable @code{default-directory}, but knows about the
1012 special cases in variable @code{default-directory-alist}.
1013 @end table
1015 @node Find File At Point, Miscellaneous Commands, Multiple Dired Directories, Top
1016 @comment  node-name,  next,  previous,  up
1018 @section Find File At Point
1019 @cindex Visiting a file mentioned in a buffer
1020 @cindex Finding a file at point
1022 @file{dired-x} provides a method of visiting or editing a file mentioned in
1023 the buffer you are viewing (e.g., a mail buffer, a news article, a README
1024 file, etc.) or to test if that file exists.  You can then modify this in the
1025 minibuffer after snatching the filename.
1027 When installed @file{dired-x} will substitute @code{dired-x-find-file} for
1028 @code{find-file} (normally bound to @kbd{C-x C-f}) and
1029 @code{dired-x-find-file-other-window} for @code{find-file-other-window}
1030 (normally bound to @kbd{C-x 4 C-f}).
1032 In order to use this feature, you will need to set
1033 @code{dired-x-hands-off-my-keys} to @code{nil} inside @code{dired-load-hook}
1034 (@pxref{Optional Installation File At Point}).
1036 @table @code
1037 @item dired-x-find-file
1038 @findex dired-x-find-file
1039 @kindex C-x C-f
1041 @code{dired-x-find-file} behaves exactly like @code{find-file} (normally bound
1042 to @kbd{C-x C-f}) unless a prefix argument is passed to the function in which
1043 case it will use the filename at point as a guess for the file to visit.
1045 For example, if the buffer you were reading contained the words
1047 @example
1048 Available via anonymous ftp in
1050    /roebling.poly.edu:/pub/lisp/crypt++.el.gz
1051 @end example
1053 then you could move your cursor to the line containing the ftp address and
1054 type @kbd{C-u C-x C-f} (the @kbd{C-u} is a universal argument).  The
1055 minibuffer would read
1057 @example
1058 Find file: /roebling.poly.edu:/pub/lisp/crypt++.el.gz
1059 @end example
1061 with the point after the last @code{/}.  If you hit return emacs will visit
1062 the file at that address.  This also works with files on your own computer.
1064 @item dired-x-find-file-other-window
1065 @findex dired-x-find-file-other-window
1066 @kindex C-x 4 C-f
1068 @code{dired-x-find-file-other-window} behaves exactly like
1069 @code{find-file-other-window} (normally bound to @kbd{C-x 4 C-f}) unless a
1070 prefix argument is used.  See @code{dired-x-find-file} for more information.
1072 @item dired-x-hands-off-my-keys
1073 @vindex dired-x-hands-off-my-keys
1074 If set to @code{t}, then it means that @file{dired-x} should @emph{not} bind
1075 @code{dired-x-find-file} over @code{find-file} on keyboard.  Similarly, it
1076 should not bind @code{dired-x-find-file-other-window} over
1077 @code{find-file-other-window}.  If you change this variable after
1078 @file{dired-x.el} is loaded then do @kbd{M-x dired-x-bind-find-file}.  The
1079 default value of this variable is @kbd{t}; by default, the binding is not
1080 done.  See @xref{Optional Installation File At Point}.
1082 @item dired-x-bind-find-file
1083 @findex dired-x-bind-find-file
1084 A function, which can be called interactively or in your @file{~/.emacs} file,
1085 that uses the value of @code{dired-x-hands-off-my-keys} to determine if
1086 @code{dired-x-find-file} should be bound over @code{find-file} and
1087 @code{dired-x-find-file-other-window} bound over
1088 @code{find-file-other-window}.  See @xref{Optional Installation File At Point}.
1089 @end table
1091 @node Miscellaneous Commands, Bugs, Find File At Point, Top
1092 @comment  node-name,  next,  previous,  up
1093 @chapter Miscellaneous Commands
1095 Miscellaneous features not fitting anywhere else:
1097 @table @code
1098 @item dired-find-subdir
1099 @vindex dired-find-subdir
1100 Default: @code{nil}
1102 If non-@code{nil}, Dired does not make a new buffer for a directory if it can
1103 be found (perhaps as subdirectory) in some existing Dired buffer.
1105 If there are several Dired buffers for a directory, the most recently
1106 used is chosen.
1108 Dired avoids switching to the current buffer, so that if you have a
1109 normal and a wildcard buffer for the same directory, @kbd{C-x d RET}
1110 will toggle between those two.
1111 @end table
1113 @table @kbd
1114 @findex dired-goto-file
1115 @kindex M-g
1116 @item M-g
1117 (@code{dired-goto-file}) Goto file line of a file (or directory).
1119 @findex dired-goto-subdir
1120 @kindex M-G
1121 @item M-G
1122 (@code{dired-goto-subdir}) Goto headerline of an inserted directory.
1123 This commands reads its argument with completion over the names of the
1124 inserted subdirectories.
1125 @end table
1127 @table @kbd
1128 @item w
1129 @cindex Adding to the kill ring in dired.
1130 @kindex w
1131 @findex dired-copy-filename-as-kill
1132 (@code{dired-copy-filename-as-kill}) The @kbd{w} command puts the names
1133 of the marked (or next @var{N}) files into the kill ring, as if you had
1134 killed them with @kbd{C-w}.  With a zero prefix argument @var{N}=0, use the
1135 complete pathname of each file.  With a raw (just @kbd{C-u}) prefix argument,
1136 use the relative pathname of each marked file.  As a special case, if no
1137 prefix argument is given and point is on a directory headerline, it
1138 gives you the name of that directory, without looking for marked files.
1140 @vindex dired-marked-files
1141 The list of names is also stored onto the variable @code{dired-marked-files}
1142 for use, e.g., in the @kbd{M-:} (@code{eval-expression}) command.
1144 As this command also displays what was pushed onto the kill ring you can
1145 use it to display the list of currently marked files in the
1146 echo area (unless you happen to be on a subdirectory headerline).
1148 You can then feed the file name to other Emacs commands with @kbd{C-y}.
1149 For example, say you want to rename a long filename to a slightly
1150 different name.  First type @kbd{w} to push the old name onto the kill
1151 ring.  Then type @kbd{R} to rename it and use @kbd{C-y} inside @kbd{R}'s
1152 minibuffer prompt to insert the old name at a convenient place.
1154 @item T
1155 @kindex T
1156 @cindex Toggling marks.
1157 @findex dired-do-toggle
1158 (@code{dired-do-toggle}) Toggle marks.  That is, currently marked
1159 files become unmarked and vice versa.  Files marked with other flags
1160 (such as `D') are not affected.  The special directories `.' and `..'
1161 are never toggled.
1162 @end table
1164 @table @code
1165 @item dired-smart-shell-command
1166 @findex dired-smart-shell-command
1167 @findex shell-command
1168 @kindex M-!
1169 Like function @code{shell-command}, but in the current Dired directory.
1170 Bound to @kbd{M-!} in Dired buffers.
1172 @item dired-jump
1173 @findex dired-jump
1174 @kindex C-x C-j
1175 @cindex Jumping to dired listing containing file.
1176 Bound to @kbd{C-x C-j}.  Jump back to dired: If in a file, dired the current
1177 directory and move to file's line.  If in Dired already, pop up a level and
1178 goto old directory's line.  In case the proper Dired file line cannot be
1179 found, refresh the Dired buffer and try again.
1181 @item dired-jump-other-window
1182 @findex dired-jump-other-window
1183 @kindex C-x 4 C-j
1184 Bound to @kbd{C-x 4 C-j}. Like @code{dired-jump}, but to other window.
1186 These functions can be autoloaded so they work even though @file{dired-x.el}
1187 has not been loaded yet (@pxref{Optional Installation Dired Jump}).
1189 @vindex dired-bind-jump
1190 If the variable @code{dired-bind-jump} is @code{nil}, @code{dired-jump} will not be
1191 bound to @kbd{C-x C-j} and @code{dired-jump-other-window} will not be bound to
1192 @kbd{C-x 4 C-j}.
1194 @item dired-vm
1195 @cindex Reading mail.
1196 @kindex V
1197 @findex dired-vm
1198 Bound to @kbd{V} if @code{dired-bind-vm} is t.  Run VM on this file (assumed
1199 to be a UNIX mail folder).
1201 @vindex dired-vm-read-only-folders
1202 If you give this command a prefix argument, it will visit the folder
1203 read-only.  This only works in VM~5, not VM~4.
1205 If the variable @code{dired-vm-read-only-folders} is t, @code{dired-vm} will
1206 visit all folders read-only.  If it is neither @code{nil} nor @code{t}, e.g.,
1207 the symbol @code{'if-file-read-only}, only files not writable by you are
1208 visited read-only.  This is the recommended value if you run VM 5.
1210 @vindex dired-bind-vm
1211 If the variable @code{dired-bind-vm} is t, @code{dired-vm} will be bound to
1212 @kbd{V}.  Otherwise, @code{dired-bind-rmail} will be bound.
1214 @item dired-rmail
1215 @cindex Reading mail.
1216 @findex dired-rmail
1217 Bound to @kbd{V} if @code{dired-bind-vm} is @code{nil}.  Run Rmail on this
1218 file (assumed to be mail folder in Rmail/BABYL format).
1220 @item dired-info
1221 @kindex I
1222 @cindex Running info.
1223 @findex dired-info
1224 Bound to @kbd{I}.  Run Info on this file (assumed to be a file in Info
1225 format).
1227 @vindex dired-bind-info
1228 If the variable @code{dired-bind-info} is @code{nil}, @code{dired-info} will
1229 not be bound to I.
1231 @item dired-man
1232 @cindex Running man.
1233 @kindex N
1234 @findex dired-man
1235 Bound to @kbd{N}.  Run man on this file (assumed to be a file in nroff
1236 format).
1238 @vindex dired-bind-man
1239 If the variable @code{dired-bind-man} is @code{nil}, @code{dired-man} will not
1240 be bound to N.
1242 @item dired-do-relative-symlink
1243 @cindex Relative symbolic links.
1244 @kindex Y
1245 @findex dired-do-relative-symlink
1246 Bound to @kbd{Y}.  Relative symlink all marked (or next ARG) files into a
1247 directory, or make a relative symbolic link to the current file.  This creates
1248 relative symbolic links like
1250     foo -> ../bar/foo
1252 not absolute ones like
1254     foo -> /ugly/path/that/may/change/any/day/bar/foo
1256 @item dired-do-relative-symlink-regexp
1257 @kindex %Y
1258 @findex dired-do-relative-symlink-regexp
1259 Bound to @kbd{%Y}.  Relative symlink all marked files containing REGEXP to
1260 NEWNAME.  See functions `dired-do-rename-regexp' and `dired-do-relsymlink' for
1261 more info.
1262 @end table
1264 @node Bugs, Concept Index, Miscellaneous Commands, Top
1265 @comment  node-name,  next,  previous,  up
1266 @chapter Bugs
1267 @cindex Bugs
1268 @findex dired-x-submit-report
1270 @noindent
1271 If you encounter a bug in this package, wish to suggest an
1272 enhancement, or want to make a smart remark, then type
1274 @example
1275 @kbd{M-x dired-x-submit-report} 
1276 @end example
1278 @noindent
1279 to set up an outgoing mail buffer, with the proper address to the
1280 @file{dired-x.el} maintainer automatically inserted in the @samp{To:@:} field.
1281 This command also inserts information that the Dired X maintainer can use to
1282 recreate your exact setup, making it easier to verify your bug or social
1283 maladjustment.
1285 Lawrence R. Dodd 
1286 @c <dodd@@roebling.poly.edu>
1288 @node     Concept Index, Command Index, Bugs, Top
1289 @comment  node-name,  next,  previous,  up
1290 @unnumbered Concept Index
1291 @printindex cp
1293 @node     Command Index, Key Index, Concept Index, Top
1294 @comment  node-name,  next,  previous,  up
1295 @unnumbered Function Index
1296 @printindex fn
1298 @node     Key Index, Variable Index, Command Index, Top
1299 @comment  node-name,  next,  previous,  up
1300 @unnumbered Key Index
1301 @printindex ky
1303 @node     Variable Index,  , Key Index, Top
1304 @comment  node-name,  next,  previous,  up
1305 @unnumbered Variable Index
1306 @printindex vr
1308 @setchapternewpage odd
1309 @c @summarycontents
1310 @contents
1312 @bye
1313 @c dired-x.texi ends here.