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