1 \input texinfo @comment -*-texinfo-*-
3 @c dired-x.texi --- Sebastian Kremer's Extra DIRED hacked up for GNU Emacs
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
11 @settitle Dired Extra User's Manual
16 @c @setchapternewpage odd % For book style double sided manual.
17 @comment %**end of header (This is for running Texinfo on a region.)
20 Copyright @copyright{} 1994, 1995, 1999, 2001, 2002, 2003, 2004,
21 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
24 Permission is granted to copy, distribute and/or modify this document
25 under the terms of the GNU Free Documentation License, Version 1.3 or
26 any later version published by the Free Software Foundation; with no
27 Invariant Sections, with the Front-Cover texts being ``A GNU Manual'',
28 and with the Back-Cover Texts as in (a) below. A copy of the license
29 is included in the section entitled ``GNU Free Documentation License''.
31 (a) The FSF's Back-Cover Text is: ``You have the freedom to copy and
32 modify this GNU manual. Buying copies from the FSF supports it in
33 developing GNU and promoting software freedom.''
37 @dircategory Emacs misc features
39 * Dired-X: (dired-x). Dired Extra Features.
45 %\global\baselineskip 30pt % For printing in double spaces
50 @center @titlefont{Dired Extra}
52 @center @titlefont{For The GNU Emacs}
54 @center @titlefont{Directory Editor}
56 @center Lawrence R@. Dodd
57 @c @center @t{dodd@@roebling.poly.edu}
59 @center (Based on @file{dired.texi} by Sebastian Kremer <sk@@thp.uni-koeln.de>)
61 @vskip 0pt plus 1filll
73 This documents the ``extra'' features for GNU Emacs's Dired Mode that are
74 provided by the file @file{dired-x.el}.
79 Based on @file{dired.texi} by Sebastian Kremer <sk@@thp.uni-koeln.de>
82 For @file{dired-x.el} as distributed with GNU Emacs 23.
91 * Omitting Files in Dired::
93 * Shell Command Guessing::
95 * Advanced Mark Commands::
96 * Multiple Dired Directories::
97 * Find File At Point::
98 * Miscellaneous Commands::
101 * GNU Free Documentation License::
111 @node Introduction, Installation, Top, Top
112 @chapter Introduction
114 This documents some @emph{extra} features for GNU Emacs's Dired Mode
115 that are provided by @file{dired-x.el} (derived from Sebastian Kremer's
116 original @file{dired-x.el}).
121 * Technical Details::
125 @node Features, Technical Details, , Introduction
129 Some features provided by Dired Extra
133 Omitting uninteresting files from Dired listing.
135 @xref{Omitting Files in Dired}.
138 Local variables for Dired directories.
140 @xref{Local Variables}.
143 Guessing shell commands in Dired buffers.
145 @xref{Shell Command Guessing}.
148 Running Dired commands in non-Dired buffers.
150 @xref{Virtual Dired}.
153 Finding a file mentioned in a buffer.
155 @xref{Find File At Point}.
158 Commands using file marking.
160 @xref{Advanced Mark Commands}.
165 @file{dired-x.el} binds some functions to keys in Dired Mode (@pxref{Key
166 Index}) and also binds @kbd{C-x C-j} and @kbd{C-x 4 C-j} @emph{globally} to
167 @code{dired-jump} (@pxref{Miscellaneous Commands}). Optionally, it
168 also binds @kbd{C-x C-f} and @kbd{C-x 4 C-f} to
169 @code{dired-x-find-file} and @code{dired-x-find-file-other-window},
170 respectively (@pxref{Find File At Point}).
172 @node Technical Details, , Features, Introduction
173 @section Technical Details
174 @cindex Redefined functions
175 @cindex @file{dired-aux.el}
177 When loaded this code @emph{redefines} the following functions of GNU Emacs
182 @code{dired-clean-up-after-deletion}
184 @code{dired-find-buffer-nocreate}
186 @code{dired-initial-position}
190 and the following functions from @file{dired-aux.el}
194 @code{dired-add-entry}
196 @code{dired-read-shell-command}
199 @node Installation, Omitting Files in Dired, Introduction, Top
200 @chapter Installation
203 This manual describes the Dired features provided by the file
204 @file{dired-x.el}. To take advantage of these features, you must load the
205 file and (optionally) set some variables.
208 In your @file{~/.emacs} file, or in the system-wide initialization file
209 @file{default.el} in the @file{site-lisp} directory, put
212 (add-hook 'dired-load-hook
215 ;; Set dired-x global variables here. For example:
216 ;; (setq dired-guess-shell-gnutar "gtar")
217 ;; (setq dired-x-hands-off-my-keys nil)
219 (add-hook 'dired-mode-hook
221 ;; Set dired-x buffer-local variables here. For example:
222 ;; (dired-omit-mode 1)
227 This will load @file{dired-x.el} when Dired is first invoked (for example,
228 when you first type @kbd{C-x d}).
232 * Optional Installation Dired Jump::
233 * Optional Installation File At Point::
237 @node Optional Installation Dired Jump, Optional Installation File At Point, , Installation
238 @section Optional Installation Dired Jump
240 @cindex Autoloading @code{dired-jump} and @code{dired-jump-other-window}
242 In order to have @code{dired-jump} and @code{dired-jump-other-window}
243 (@pxref{Miscellaneous Commands}) work @emph{before} @code{dired} and
244 @code{dired-x} have been properly loaded you should set-up an autoload
245 for these functions. In your @file{.emacs} file put
248 (autoload 'dired-jump "dired-x"
249 "Jump to Dired buffer corresponding to current buffer." t)
251 (autoload 'dired-jump-other-window "dired-x"
252 "Like \\[dired-jump] (dired-jump) but in other window." t)
254 (define-key global-map "\C-x\C-j" 'dired-jump)
255 (define-key global-map "\C-x4\C-j" 'dired-jump-other-window)
258 @node Optional Installation File At Point, , Optional Installation Dired Jump, Installation
259 @section Optional Installation File At Point
261 @cindex Binding @code{dired-x-find-file}
262 If you choose to have @file{dired-x.el} bind @code{dired-x-find-file} over
263 @code{find-file} (@pxref{Find File At Point}), then you will need to set
264 @code{dired-x-hands-off-my-keys} and make a call to the function
265 @code{dired-x-bind-find-file} in the @code{dired-load-hook}:
268 (add-hook 'dired-load-hook
271 ;; Bind dired-x-find-file.
272 (setq dired-x-hands-off-my-keys nil)
273 ;; Make sure our binding preference is invoked.
274 (dired-x-bind-find-file)
278 Alternatively, you can set the variable @emph{before} @file{dired-x.el} is
282 (add-hook 'dired-load-hook
284 ;; Bind dired-x-find-file.
285 (setq dired-x-hands-off-my-keys nil)
290 @node Omitting Files in Dired, Local Variables, Installation, Top
291 @chapter Omitting Files in Dired
293 @cindex Omitting Files in Dired
294 @cindex Uninteresting files
295 @dfn{Omitting} a file means removing it from the directory listing. Omitting
296 is useful for keeping Dired buffers free of ``uninteresting'' files (for
297 instance, auto-save, auxiliary, backup, and revision control files) so that
298 the user can concentrate on the interesting files. Like hidden files, omitted
299 files are never seen by Dired. Omitting differs from hiding in several
305 Omitting works on individual files, not on directories; an entire directory
306 cannot be omitted (though each of its files could be).
309 Omitting is wholesale; if omitting is turned on for a Dired buffer, then all
310 uninteresting files listed in that buffer are omitted. The user does not omit
311 (or unomit) files one at a time.
314 Omitting can be automatic; uninteresting file lines in the buffer can be
315 removed before the user ever sees them.
318 Marked files are never omitted.
324 @findex dired-omit-mode
325 (@code{dired-omit-mode}) Toggle between displaying and omitting
326 ``uninteresting'' files.
329 @findex dired-mark-omitted
330 (@code{dired-mark-omitted}) Mark ``uninteresting'' files.
334 In order to make Dired Omit work you first need to load @file{dired-x.el}
335 inside @code{dired-load-hook} (@pxref{Installation}) and then evaluate
336 @code{(dired-omit-mode 1)} in some way (@pxref{Omitting Variables}).
340 * Omitting Variables::
341 * Omitting Examples::
342 * Omitting Technical::
346 @node Omitting Variables, Omitting Examples, , Omitting Files in Dired
347 @section Omitting Variables
349 @cindex Customizing file omitting
350 The following variables can be used to customize omitting.
354 @vindex dired-omit-mode
355 @item dired-omit-mode
359 @cindex How to make omitting the default in Dired
360 If non-@code{nil}, ``uninteresting'' files are not listed.
361 Uninteresting files are those whose files whose names match regexp
362 @code{dired-omit-files}, plus those ending with extensions in
363 @code{dired-omit-extensions}. @kbd{M-o} (@code{dired-omit-mode})
364 toggles its value, which is buffer-local. Put
371 inside your @code{dired-mode-hook} to have omitting initially turned on in
372 @emph{every} Dired buffer (@pxref{Installation}). You can then use @kbd{M-o} to
373 unomit in that buffer.
375 To enable omitting automatically only in certain directories one can use Dired
376 Local Variables and put
385 into a file @file{.dired} (the default value of
386 @code{dired-local-variables-file}) in that directory (@pxref{Local Variables}).
389 @findex dired-omit-here-always
390 @item dired-omit-here-always
392 This is an interactive function that creates a local variables file exactly
393 like the example above (if it does not already exist) in the file
394 @code{dired-local-variables-file} in the current directory and then refreshes
395 the directory listing (@pxref{Local Variables}).
398 @vindex dired-omit-files
399 @item dired-omit-files
401 Default: @code{"^#\\|\\.$"}
403 Files whose names match this buffer-local regexp will not be displayed.
404 This only has effect when @code{dired-omit-mode}'s value is @code{t}.
406 The default value omits the special directories @file{.} and @file{..} and
407 autosave files (plus other files ending in @file{.}) (@pxref{Omitting Examples}).
409 @vindex dired-omit-extensions
410 @item dired-omit-extensions
412 Default: The elements of @code{completion-ignored-extensions},
413 @code{dired-latex-unclean-extensions}, @code{dired-bibtex-unclean-extensions}
414 and @code{dired-texinfo-unclean-extensions}.
416 If non-@code{nil}, a list of extensions (strings) to omit from Dired listings.
417 Its format is the same as that of @code{completion-ignored-extensions}.
419 @vindex dired-omit-localp
420 @item dired-omit-localp
422 Default: @code{no-dir}
424 The @var{localp} argument @code{dired-omit-expunge} passes to
425 @code{dired-get-filename}. If it is @code{no-dir}, omitting is much faster,
426 but you can only match against the non-directory part of the file name. Set it
427 to @code{nil} if you need to match the whole file name or @code{t} to match the
428 file name relative to the buffer's top-level directory.
430 @item dired-omit-marker-char
431 @vindex dired-omit-marker-char
432 @cindex Omitting additional files
435 Temporary marker used by Dired to implement omitting. Should never be used
436 as marker by the user or other packages. There is one exception to this rule:
440 (setq dired-mark-keys "\C-o")
441 ;; i.e., the value of dired-omit-marker-char
442 ;; (which is not defined yet)
446 to your @file{~/.emacs}, you can bind the @kbd{C-o} key to insert a
447 @kbd{C-o} marker, thus causing these files to be omitted in addition to the
448 usually omitted files. Unfortunately the files you omitted manually this way
449 will show up again after reverting the buffer, unlike the others.
453 @node Omitting Examples, Omitting Technical, Omitting Variables, Omitting Files in Dired
454 @section Examples of Omitting Various File Types
459 @cindex RCS files, how to omit them in Dired
460 @cindex Omitting RCS files in Dired
461 If you wish to avoid seeing RCS files and the @file{RCS} directory, then put
464 (setq dired-omit-files
465 (concat dired-omit-files "\\|^RCS$\\|,v$"))
469 in the @code{dired-load-hook} (@pxref{Installation}). This assumes
470 @code{dired-omit-localp} has its default value of @code{no-dir} to make the
471 @code{^}-anchored matches work. As a slower alternative, with
472 @code{dired-omit-localp} set to @code{nil}, you can use @code{/} instead of
473 @code{^} in the regexp.
476 @cindex Tib files, how to omit them in Dired
477 @cindex Omitting tib files in Dired
478 If you use @code{tib}, the bibliography program for use with @TeX{} and
480 want to omit the @file{INDEX} and the @file{*-t.tex} files, then put
483 (setq dired-omit-files
484 (concat dired-omit-files "\\|^INDEX$\\|-t\\.tex$"))
488 in the @code{dired-load-hook} (@pxref{Installation}).
491 @cindex Dot files, how to omit them in Dired
492 @cindex Omitting dot files in Dired
493 If you do not wish to see @samp{dot} files (files starting with a @file{.}),
497 (setq dired-omit-files
498 (concat dired-omit-files "\\|^\\..+$"))
502 in the @code{dired-load-hook} (@pxref{Installation}).
506 @node Omitting Technical, , Omitting Examples, Omitting Files in Dired
507 @section Some Technical Details of Omitting
509 Loading @file{dired-x.el} will install Dired Omit by putting
510 @code{dired-omit-expunge} on your @code{dired-after-readin-hook}, and will
511 call @code{dired-extra-startup}, which in turn calls @code{dired-omit-startup}
512 in your @code{dired-mode-hook}.
514 @c FIXME does the standard dir-locals mechanism obsolete this?
515 @node Local Variables, Shell Command Guessing, Omitting Files in Dired, Top
516 @chapter Local Variables for Dired Directories
518 @cindex Local Variables for Dired Directories
519 @vindex dired-local-variables-file
520 @vindex dired-enable-local-variables
522 When Dired visits a directory, it looks for a file whose name is the value of
523 variable @code{dired-local-variables-file} (default: @file{.dired}). If such
524 a file is found, Dired will temporarily insert it into the Dired buffer and
525 run @code{hack-local-variables}.
528 For example, if the user puts
532 dired-actual-switches: "-lat"
538 into a file called @file{.dired} in a directory then when that directory is
545 omitted automatically
549 You can set @code{dired-local-variables-file} to @code{nil} to suppress this.
550 The value of @code{dired-enable-local-variables} controls if and how these
551 local variables are read. This variable exists so that it may override the
552 default value of @code{enable-local-variables}.
555 Please see the GNU Emacs Manual to learn more about local variables.
556 @xref{File Variables,Local Variables in Files,Local Variables in
557 Files,emacs,The GNU Emacs Manual}.
560 The following variables affect Dired Local Variables
563 @vindex dired-local-variables-file
564 @item dired-local-variables-file
565 Default: @code{".dired"}
567 If non-@code{nil}, file name for local variables for Dired. If Dired finds a
568 file with that name in the current directory, it will temporarily insert it
569 into the Dired buffer and run @code{hack-local-variables}.
571 @vindex dired-enable-local-variables
572 @item dired-enable-local-variables
575 Controls the use of local-variables lists in Dired. The value can be @code{t},
576 @code{nil}, or something else. A value of @code{t} means local-variables
577 lists are obeyed in the @code{dired-local-variables-file}; @code{nil} means
578 they are ignored; anything else means query. This variable temporarily
579 overrides the value of @code{enable-local-variables} when the Dired Local
580 Variables are hacked.
583 @node Shell Command Guessing, Virtual Dired, Local Variables, Top
584 @chapter Shell Command Guessing
585 @cindex Guessing shell commands for files.
587 Based upon the name of a file, Dired tries to guess what shell
588 command you might want to apply to it. For example, if you have point
589 on a file named @file{foo.tar} and you press @kbd{!}, Dired will guess
590 you want to @samp{tar xvf} it and suggest that as the default shell
593 The default is mentioned in brackets and you can type @kbd{M-n} to get
594 the default into the minibuffer and then edit it, e.g., to change
595 @samp{tar xvf} to @samp{tar tvf}. If there are several commands for a given
596 file, e.g., @samp{xtex} and @samp{dvips} for a @file{.dvi} file, you can type
597 @kbd{M-n} several times to see each of the matching commands.
599 Dired only tries to guess a command for a single file, never for a list
603 @item dired-guess-shell-alist-default
604 @vindex dired-guess-shell-alist-default
605 Predefined rules for shell commands. Set this to @code{nil} to turn guessing off.
606 The elements of @code{dired-guess-shell-alist-user} (defined by the
607 user) will override these rules.@refill
609 @item dired-guess-shell-alist-user
610 @vindex dired-guess-shell-alist-user
611 If non-@code{nil}, a user-defined alist of file regexps and their suggested
612 commands. These rules take precedence over the predefined rules in the
613 variable @code{dired-guess-shell-alist-default} (to which they are prepended)
614 when @code{dired-do-shell-command} is run).
617 Each element of the alist looks like
620 (@var{regexp} @var{command}@dots{})
624 where each @var{command} can either be a string or a Lisp expression
625 that evaluates to a string. If several commands are given, all of
626 them will temporarily be pushed onto the history.
628 If @samp{*} in the shell command, that means to substitute the file
631 You can set this variable in your @file{~/.emacs}. For example,
632 to add rules for @samp{.foo} and @samp{.bar} file extensions, write
635 (setq dired-guess-shell-alist-user
637 (list "\\.foo$" "@var{foo-command}");; fixed rule
638 ;; possibly more rules...
639 (list "\\.bar$";; rule with condition test
641 "@var{bar-command-1}"
642 "@var{bar-command-2}"))))
646 This will override any predefined rules for the same extensions.
648 @item dired-guess-shell-case-fold-search
649 @vindex dired-guess-shell-case-fold-search
652 Non-@code{nil} means @code{dired-guess-shell-alist-default} and
653 @code{dired-guess-shell-alist-user} are matched case-insensitively.
655 @item dired-guess-shell-gnutar
656 @vindex dired-guess-shell-gnutar
657 @cindex Passing GNU Tar its @samp{z} switch.
660 If non-@code{nil}, this is the name of the GNU Tar executable (e.g.,
661 @samp{tar} or @samp{gnutar}). GNU Tar's @samp{z} switch is used for
662 compressed tar files.
663 If you don't have GNU tar, set this to @code{nil}: a pipe using @samp{zcat} is
666 @item dired-guess-shell-gzip-quiet
667 @vindex dired-guess-shell-gzip-quiet
671 A non-@code{nil} value means that @samp{-q} is passed to @code{gzip}
672 overriding a verbose option in the @env{GZIP} environment variable.
674 @item dired-guess-shell-znew-switches nil
675 @vindex dired-guess-shell-znew-switches nil
679 A string of switches passed to @code{znew}. An example is
680 @samp{-K} which will make @code{znew} keep a @file{.Z} file when it is
681 smaller than the @file{.gz} file.
683 @item dired-shell-command-history nil
684 @vindex dired-shell-command-history nil
686 History list for commands that read dired-shell commands.
689 @node Virtual Dired, Advanced Mark Commands, Shell Command Guessing, Top
690 @chapter Virtual Dired
692 @cindex Virtual Dired
693 @cindex Perusing @code{ls} listings
694 @cindex @code{ls} listings, how to peruse them in Dired
695 Using @dfn{Virtual Dired} means putting a buffer with Dired-like
696 contents in Dired mode. The files described by the buffer contents need
697 not actually exist. This is useful if you want to peruse an @samp{ls -lR}
698 output file, for example one you got from an FTP server. You can use
699 all motion commands usually available in Dired. You can also use
700 it to save a Dired buffer in a file and resume it in a later session.
702 @findex dired-virtual
704 @findex dired-virtual-revert
705 Type @kbd{M-x dired-virtual} to put the current buffer into virtual
706 Dired mode. You will be prompted for the top level directory of this
707 buffer, with a default value guessed from the buffer contents. To
708 convert the virtual to a real Dired buffer again, type @kbd{g} (which
709 calls @code{dired-virtual-revert}) in the virtual Dired buffer and
710 answer @samp{y}. You don't have to do this, though: you can relist
711 single subdirectories using @kbd{l} (@code{dired-do-redisplay}) on the subdirectory
712 headerline, leaving the buffer in virtual Dired mode all the time.
714 @findex dired-virtual-mode
715 @vindex auto-mode-alist
716 The function @samp{dired-virtual-mode} is specially designed to turn on
717 virtual Dired mode from the @code{auto-mode-alist}. To edit all
718 @file{*.dired} files automatically in virtual Dired mode, put this into your
722 (setq auto-mode-alist (cons '("[^/]\\.dired$" . dired-virtual-mode)
727 The regexp is a bit more complicated than usual to exclude @file{.dired}
728 local-variable files.
730 @node Advanced Mark Commands, Multiple Dired Directories, Virtual Dired, Top
731 @chapter Advanced Mark Commands
736 @cindex Visiting several files at once
737 @cindex Simultaneous visiting of several files
738 @findex dired-do-find-marked-files
739 (@code{dired-do-find-marked-files}) Find all marked files at once displaying
740 them simultaneously. If optional @var{noselect} is non-@code{nil} then just
742 files but do not select. If you want to keep the Dired buffer displayed, type
743 @kbd{C-x 2} first. If you want just the marked files displayed and nothing
744 else, type @kbd{C-x 1} first.
746 The current window is split across all files marked, as evenly as possible.
747 Remaining lines go to the bottom-most window. The number of files that can be
748 displayed this way is restricted by the height of the current window and the
749 variable @code{window-min-height}.
753 @item dired-mark-extension
754 @findex dired-mark-extension
755 Mark all files with a certain extension for use in later commands. A @samp{.}
756 is not automatically prepended to the string entered, you must type it
759 When called from Lisp, @var{extension} may also be a list of extensions
760 and an optional argument @var{marker-char} specifies the marker used.
762 @item dired-flag-extension
763 @findex dired-flag-extension
764 Flag all files with a certain extension for deletion. A @samp{.} is
765 @emph{not} automatically prepended to the string entered.
770 * Advanced Cleaning Functions::
771 * Advanced Cleaning Variables::
772 * Special Marking Function::
776 @node Advanced Cleaning Functions, Advanced Cleaning Variables, , Advanced Mark Commands
777 @section Advanced Cleaning Functions
780 @item dired-clean-patch
781 @findex dired-clean-patch
782 Flag dispensable files created by the @samp{patch} program for deletion. See
783 variable @code{dired-patch-unclean-extensions}.
785 @item dired-clean-tex
786 @findex dired-clean-tex
787 Flag dispensable files created by @TeX{}, La@TeX{}, and @samp{texinfo} for
788 deletion. See the following variables (@pxref{Advanced Cleaning Variables}):
792 @code{dired-tex-unclean-extensions}
794 @code{dired-texinfo-unclean-extensions}
796 @code{dired-latex-unclean-extensions}
798 @code{dired-bibtex-unclean-extensions}
801 @item dired-very-clean-tex
802 @findex dired-very-clean-tex
803 Flag dispensable files created by @TeX{}, La@TeX{}, @samp{texinfo},
804 and @file{*.dvi} files for deletion.
807 @node Advanced Cleaning Variables, Special Marking Function, Advanced Cleaning Functions, Advanced Mark Commands
808 @section Advanced Cleaning Variables
810 @noindent Variables used by the above cleaning commands (and in the default value for
811 variable @code{dired-omit-extensions}, @pxref{Omitting Variables})
814 @item dired-patch-unclean-extensions
815 @vindex dired-patch-unclean-extensions
816 Default: @code{(".rej" ".orig")}
818 List of extensions of dispensable files created by the @samp{patch} program.
820 @item dired-tex-unclean-extensions
821 @vindex dired-tex-unclean-extensions
822 Default: @code{(".toc" ".log" ".aux")}
824 List of extensions of dispensable files created by @TeX{}.
826 @item dired-texinfo-unclean-extensions
827 @vindex dired-texinfo-unclean-extensions
828 Default: @code{(".cp" ".cps" ".fn" ".fns" ".ky" ".kys"}
829 @code{".pg" ".pgs" ".tp" ".tps" ".vr" ".vrs")}
831 List of extensions of dispensable files created by @samp{texinfo}.
833 @item dired-latex-unclean-extensions
834 @vindex dired-latex-unclean-extensions
835 Default: @code{(".idx" ".lof" ".lot" ".glo")}
837 List of extensions of dispensable files created by La@TeX{}.
839 @item dired-bibtex-unclean-extensions
840 @vindex dired-bibtex-unclean-extensions
841 Default: @code{(".blg" ".bbl")}
843 List of extensions of dispensable files created by Bib@TeX{}.
846 @node Special Marking Function, , Advanced Cleaning Variables, Advanced Mark Commands
847 @section Special Marking Function
852 @findex dired-mark-sexp
853 @cindex Lisp expression, marking files with in Dired
854 @cindex Mark file by Lisp expression
855 (@code{dired-mark-sexp}) Mark files for which @var{predicate} returns
856 non-@code{nil}. With a prefix argument, unflag those files instead.
858 The @var{predicate} is a Lisp expression that can refer to the following
862 [@i{integer}] the inode of the file (only for @samp{ls -i} output)
864 [@i{integer}] the size of the file for @samp{ls -s} output (usually in blocks or,
865 with @samp{-k}, in KBytes)
867 [@i{string}] file permission bits, e.g., @samp{-rw-r--r--}
869 [@i{integer}] number of links to file
873 [@i{string}] group (If the gid is not displayed by @samp{ls}, this
874 will still be set (to the same as uid))
876 [@i{integer}] file size in bytes
878 [@i{string}] the time that @samp{ls} displays, e.g., @samp{Feb 12 14:17}
880 [@i{string}] the name of the file
882 [@i{string}] if file is a symbolic link, the linked-to name, else @code{""}
890 to mark all zero length files.
892 To find out all not yet compiled Emacs Lisp files in a directory, Dired
893 all @file{.el} files in the lisp directory using the wildcard
894 @samp{*.el}. Then use @kbd{M-(} with
896 (not (file-exists-p (concat name "c")))
898 to mark all @file{.el} files without a corresponding @file{.elc} file.
902 @node Multiple Dired Directories, Find File At Point, Advanced Mark Commands, Top
903 @chapter Multiple Dired Directories and Non-Dired Commands
905 @cindex Multiple Dired directories
906 @cindex Working directory
907 An Emacs buffer can have but one working directory, stored in the
908 buffer-local variable @code{default-directory}. A Dired buffer may have
909 several subdirectories inserted, but it still has only one working
910 directory: that of the top-level Dired directory in that buffer. For
911 some commands it is appropriate that they use the current Dired
912 directory instead of @code{default-directory}, e.g., @code{find-file} and
915 A general mechanism is provided for special handling of the working
916 directory in special major modes:
919 @item default-directory-alist
920 @vindex default-directory-alist
921 Default: @code{((dired-mode . (dired-current-directory)))}
923 Alist of major modes and their notion of @code{default-directory}, as a
924 Lisp expression to evaluate. A resulting value of @code{nil} is ignored
925 in favor of @code{default-directory}.
927 @item dired-default-directory
928 @findex dired-default-directory
929 Use this function like you would use the variable
930 @code{default-directory}, except that @code{dired-default-directory}
931 also consults the variable @code{default-directory-alist}.
934 @node Find File At Point, Miscellaneous Commands, Multiple Dired Directories, Top
935 @section Find File At Point
936 @cindex Visiting a file mentioned in a buffer
937 @cindex Finding a file at point
939 @file{dired-x} provides a method of visiting or editing a file mentioned in
940 the buffer you are viewing (e.g., a mail buffer, a news article, a
941 @file{README} file, etc.) or to test if that file exists. You can then modify
942 this in the minibuffer after snatching the file name.
944 When installed @file{dired-x} will substitute @code{dired-x-find-file} for
945 @code{find-file} (normally bound to @kbd{C-x C-f}) and
946 @code{dired-x-find-file-other-window} for @code{find-file-other-window}
947 (normally bound to @kbd{C-x 4 C-f}).
949 In order to use this feature, you will need to set
950 @code{dired-x-hands-off-my-keys} to @code{nil} inside @code{dired-load-hook}
951 (@pxref{Optional Installation File At Point}).
954 @item dired-x-find-file
955 @findex dired-x-find-file
958 @code{dired-x-find-file} behaves exactly like @code{find-file} (normally bound
959 to @kbd{C-x C-f}) unless a prefix argument is passed to the function in which
960 case it will use the file name at point as a guess for the file to visit.
962 For example, if the buffer you were reading contained the words
965 Available via anonymous ftp in
967 /roebling.poly.edu:/pub/lisp/crypt++.el.gz
971 then you could move your cursor to the line containing the ftp address and
972 type @kbd{C-u C-x C-f} (the @kbd{C-u} is a universal argument). The
973 minibuffer would read
976 Find file: /roebling.poly.edu:/pub/lisp/crypt++.el.gz
980 with the point after the last @code{/}. If you hit @key{RET}, emacs will visit
981 the file at that address. This also works with files on your own computer.
983 @item dired-x-find-file-other-window
984 @findex dired-x-find-file-other-window
987 @code{dired-x-find-file-other-window} behaves exactly like
988 @code{find-file-other-window} (normally bound to @kbd{C-x 4 C-f}) unless a
989 prefix argument is used. See @code{dired-x-find-file} for more information.
991 @item dired-x-hands-off-my-keys
992 @vindex dired-x-hands-off-my-keys
993 If set to @code{t}, then it means that @file{dired-x} should @emph{not} bind
994 @code{dired-x-find-file} over @code{find-file} on keyboard. Similarly, it
995 should not bind @code{dired-x-find-file-other-window} over
996 @code{find-file-other-window}. If you change this variable after
997 @file{dired-x.el} is loaded then do @kbd{M-x dired-x-bind-find-file}. The
998 default value of this variable is @code{t}; by default, the binding is not
999 done. See @xref{Optional Installation File At Point}.
1001 @item dired-x-bind-find-file
1002 @findex dired-x-bind-find-file
1003 A function, which can be called interactively or in your @file{~/.emacs} file,
1004 that uses the value of @code{dired-x-hands-off-my-keys} to determine if
1005 @code{dired-x-find-file} should be bound over @code{find-file} and
1006 @code{dired-x-find-file-other-window} bound over
1007 @code{find-file-other-window}. See @xref{Optional Installation File At Point}.
1010 @node Miscellaneous Commands, Bugs, Find File At Point, Top
1011 @chapter Miscellaneous Commands
1013 Miscellaneous features not fitting anywhere else:
1016 @item dired-find-subdir
1017 @vindex dired-find-subdir
1020 If non-@code{nil}, Dired does not make a new buffer for a directory if it can
1021 be found (perhaps as subdirectory) in some existing Dired buffer.
1023 If there are several Dired buffers for a directory, the most recently
1026 Dired avoids switching to the current buffer, so that if you have a
1027 normal and a wildcard buffer for the same directory, @kbd{C-x d RET}
1028 will toggle between those two.
1032 @findex dired-goto-subdir
1035 (@code{dired-goto-subdir}) Go to the header line of an inserted directory.
1036 This command reads its argument, with completion derived from the names of the
1037 inserted subdirectories.
1041 @item dired-smart-shell-command
1042 @findex dired-smart-shell-command
1043 @findex shell-command
1045 Like function @code{shell-command}, but in the current Dired directory.
1046 Bound to @kbd{M-!} in Dired buffers.
1051 @cindex Jumping to Dired listing containing file.
1052 Bound to @kbd{C-x C-j}. Jump back to Dired: If in a file, edit the current
1053 directory and move to file's line. If in Dired already, pop up a level and
1054 go to old directory's line. In case the proper Dired file line cannot be
1055 found, refresh the Dired buffer and try again.
1057 @item dired-jump-other-window
1058 @findex dired-jump-other-window
1060 Bound to @kbd{C-x 4 C-j}. Like @code{dired-jump}, but to other window.
1062 These functions can be autoloaded so they work even though @file{dired-x.el}
1063 has not been loaded yet (@pxref{Optional Installation Dired Jump}).
1065 @vindex dired-bind-jump
1066 If the variable @code{dired-bind-jump} is @code{nil}, @code{dired-jump} will not be
1067 bound to @kbd{C-x C-j} and @code{dired-jump-other-window} will not be bound to
1071 @cindex Reading mail.
1074 Bound to @kbd{V} if @code{dired-bind-vm} is @code{t}. Run VM on this
1075 file (assumed to be a UNIX mail folder).
1077 @vindex dired-vm-read-only-folders
1078 If you give this command a prefix argument, it will visit the folder
1079 read-only. This only works in VM 5, not VM 4.
1081 If the variable @code{dired-vm-read-only-folders} is @code{t},
1082 @code{dired-vm} will
1083 visit all folders read-only. If it is neither @code{nil} nor @code{t}, e.g.,
1084 the symbol @code{if-file-read-only}, only files not writable by you are
1085 visited read-only. This is the recommended value if you run VM 5.
1087 @vindex dired-bind-vm
1088 If the variable @code{dired-bind-vm} is @code{t}, @code{dired-vm} will be bound
1089 to @kbd{V}. Otherwise, @code{dired-bind-rmail} will be bound.
1092 @cindex Reading mail.
1094 Bound to @kbd{V} if @code{dired-bind-vm} is @code{nil}. Run Rmail on this
1095 file (assumed to be mail folder in Rmail format).
1099 @cindex Running info.
1101 Bound to @kbd{I}. Run Info on this file (assumed to be a file in Info
1104 @vindex dired-bind-info
1105 If the variable @code{dired-bind-info} is @code{nil}, @code{dired-info} will
1106 not be bound to @kbd{I}.
1109 @cindex Running man.
1112 Bound to @kbd{N}. Run man on this file (assumed to be a file in @code{nroff}
1115 @vindex dired-bind-man
1116 If the variable @code{dired-bind-man} is @code{nil}, @code{dired-man} will not
1117 be bound to @kbd{N}.
1119 @item dired-do-relsymlink
1120 @cindex Relative symbolic links.
1122 @findex dired-do-relsymlink
1123 Bound to @kbd{Y}. Relative symlink all marked (or next ARG) files into a
1124 directory, or make a relative symbolic link to the current file. This creates
1125 relative symbolic links like
1132 not absolute ones like
1135 foo -> /ugly/path/that/may/change/any/day/bar/foo
1138 @item dired-do-relsymlink-regexp
1140 @findex dired-do-relsymlink-regexp
1141 Bound to @kbd{%Y}. Relative symlink all marked files containing
1142 @var{regexp} to @var{newname}. See functions
1143 @code{dired-do-rename-regexp} and @code{dired-do-relsymlink} for more
1147 @node Bugs, GNU Free Documentation License, Miscellaneous Commands, Top
1152 If you encounter a bug in this package, or wish to suggest an
1153 enhancement, then please use @kbd{M-x report-emacs-bug} to report it.
1155 @node GNU Free Documentation License, Concept Index, Bugs, Top
1156 @appendix GNU Free Documentation License
1157 @include doclicense.texi
1159 @node Concept Index, Command Index, GNU Free Documentation License, Top
1160 @unnumbered Concept Index
1163 @node Command Index, Key Index, Concept Index, Top
1164 @unnumbered Function Index
1167 @node Key Index, Variable Index, Command Index, Top
1168 @unnumbered Key Index
1171 @node Variable Index, , Key Index, Top
1172 @unnumbered Variable Index
1178 arch-tag: 201727aa-9318-4c74-a0d7-4f51c550c4de