]> code.delx.au - gnu-emacs/blobdiff - man/dired.texi
(Top): Rename top node.
[gnu-emacs] / man / dired.texi
index 8bb014a59b911558ea0bba8fa7b4b4aca193bd1b..88e994ed0273b646be09ca985bf157d273f1fd5a 100644 (file)
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985, 86, 87, 93, 94, 95, 97, 2000
+@c Copyright (C) 1985,86,87,93,94,95,97,2000,2001
 @c   Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Dired, Calendar/Diary, Rmail, Top
@@ -12,12 +12,19 @@ optionally some of its subdirectories as well.  You can use the normal
 Emacs commands to move around in this buffer, and special Dired commands
 to operate on the files listed.
 
+    The Dired buffer is ``read-only,'' and inserting text in it is not
+useful, so ordinary printing characters such as @kbd{d} and @kbd{x} are
+used for special Dired commands.  Some Dired commands @dfn{mark} or
+@dfn{flag} the @dfn{current file} (that is, the file on the current
+line); other commands operate on the marked files or on the flagged
+files.
+
   The Dired-X package provides various extra features for Dired mode.
-@xref{Dired-X,,,dired-x, Dired Extra Version 2 User's Manual}.
+@xref{Top, Dired-X,,dired-x, Dired Extra Version 2 User's Manual}.
 
 @menu
 * Enter: Dired Enter.         How to invoke Dired.
-* Commands: Dired Commands.   Commands in the Dired buffer.
+* Navigation: Dired Navigation.   Special motion commands in the Dired buffer.
 * Deletion: Dired Deletion.   Deleting files with Dired.
 * Flagging Many Files::       Flagging files based on their names.
 * Visit: Dired Visiting.      Other file operations through Dired.
@@ -32,6 +39,7 @@ to operate on the files listed.
 * Hiding Subdirectories::     Making subdirectories visible or invisible.
 * Updating: Dired Updating.   Discarding lines for files of no interest.
 * Find: Dired and Find.              Using `find' to choose the files for Dired.
+* Misc: Misc Dired Commands.  Various other features.
 @end menu
 
 @node Dired Enter
@@ -61,15 +69,8 @@ selected window, use @kbd{C-x 4 d} (@code{dired-other-window}) instead
 of @kbd{C-x d}.  @kbd{C-x 5 d} (@code{dired-other-frame}) uses a
 separate frame to display the Dired buffer.
 
-@node Dired Commands
-@section Commands in the Dired Buffer
-
-    The Dired buffer is ``read-only,'' and inserting text in it is not
-useful, so ordinary printing characters such as @kbd{d} and @kbd{x} are
-used for special Dired commands.  Some Dired commands @dfn{mark} or
-@dfn{flag} the @dfn{current file} (that is, the file on the current
-line); other commands operate on the marked files or on the flagged
-files.
+@node Dired Navigation
+@section Navigation in the Dired Buffer
 
 @kindex C-n @r{(Dired)}
 @kindex C-p @r{(Dired)}
@@ -85,13 +86,21 @@ to @kbd{C-n}.  @kbd{p} is equivalent to @kbd{C-p}.  (Moving by lines is
 so common in Dired that it deserves to be easy to type.)  @key{DEL}
 (move up and unflag) is often useful simply for moving up.
 
+@findex dired-goto-file
+@kindex M-g
+  @kbd{M-g} (@code{dired-goto-file}) moves point to the line that
+describes a specified file or directory.
+
+  Some additional navigation commands are available when the Dired
+buffer includes several directories.  @xref{Subdirectory Motion}.
+
 @node Dired Deletion
 @section Deleting Files with Dired
 @cindex flagging files (in Dired)
 @cindex deleting files (in Dired)
 
-  The primary use of Dired is to @dfn{flag} files for deletion and then
-delete the files previously flagged.
+  One of the most frequent uses of Dired is to first @dfn{flag} files for
+deletion, then delete the files that were flagged.
 
 @table @kbd
 @item d
@@ -112,6 +121,7 @@ the beginning of the line.  This command moves point to the next line,
 so that repeated @kbd{d} commands flag successive files.  A numeric
 argument serves as a repeat count.
 
+@cindex recursive deletion
 @vindex dired-recursive-deletes
   The variable @code{dired-recursive-deletes} controls whether the
 delete command will delete non-empty directories (including their
@@ -185,16 +195,17 @@ files produced by @TeX{}, @samp{.bak} files, and the @samp{.orig} and
 @samp{.rej} files produced by @code{patch}.
 
 @kindex # @r{(Dired)}
-@kindex ~ @r{(Dired)}
 @findex dired-flag-auto-save-files
-@findex dired-flag-backup-files
 @cindex deleting auto-save files
   @kbd{#} (@code{dired-flag-auto-save-files}) flags for deletion all
 files whose names look like auto-save files (@pxref{Auto Save})---that
-is, files whose names begin and end with @samp{#}.  @kbd{~}
-(@code{dired-flag-backup-files}) flags for deletion all files whose
-names say they are backup files (@pxref{Backup})---that is, whose names
-end in @samp{~}.
+is, files whose names begin and end with @samp{#}.
+
+@kindex ~ @r{(Dired)}
+@findex dired-flag-backup-files
+  @kbd{~} (@code{dired-flag-backup-files}) flags for deletion all files
+whose names say they are backup files (@pxref{Backup})---that is, files
+whose names end in @samp{~}.
 
 @kindex . @r{(Dired)}
 @vindex dired-kept-versions
@@ -237,7 +248,9 @@ Visit the file described on the current line, like typing @kbd{C-x C-f}
 and supplying that file name (@code{dired-find-file}).  @xref{Visiting}.
 
 @item @key{RET}
+@itemx e
 @kindex RET @r{(Dired)}
+@kindex e @r{(Dired)}
 Equivalent to @kbd{f}.
 
 @item a
@@ -269,12 +282,22 @@ to display the file, like the @kbd{o} command.
 @item v
 @kindex v @r{(Dired)}
 @findex dired-view-file
-View the file described on the current line, using @kbd{M-x view-file}
-(@code{dired-view-file}).
-
-Viewing a file is like visiting it, but is slanted toward moving around
-in the file conveniently and does not allow changing the file.
-@xref{Misc File Ops,View File, Miscellaneous File Operations}.
+View the file described on the current line, using either an external
+viewing program or @kbd{M-x view-file} (@code{dired-view-file}).
+
+@vindex dired-view-command-alist
+External viewers are used for certain file types under the control of
+@code{dired-view-command-alist}.  Viewing a file with @code{view-file}
+is like visiting it, but is slanted toward moving around in the file
+conveniently and does not allow changing the file.  @xref{Misc File
+Ops,View File, Miscellaneous File Operations}.
+
+@item ^
+@kindex ^ @r{(Dired)}
+@findex dired-up-directory
+Visit the parent directory of the current directory
+(@code{dired-up-directory}).  This is more convenient than moving to
+the parent directory's line and typing @kbd{f} there.
 @end table
 
 @node Marks vs Flags
@@ -312,7 +335,7 @@ those files.
 @item * @@
 @kindex * @@ @r{(Dired)}
 @findex dired-mark-symlinks
-@cindex marking symlinks (in Dired)
+@cindex marking symbolic links (in Dired)
 Mark all symbolic links with @samp{*} (@code{dired-mark-symlinks}).
 With a numeric argument, unmark all those files.
 
@@ -378,9 +401,9 @@ Move up to the previous marked file (@code{dired-prev-marked-file})
 
 @item * t
 @kindex * t @r{(Dired)}
-@findex dired-do-toggle
+@findex dired-toggle-marks
 @cindex toggling marks (in Dired)
-Toggle all marks (@code{dired-do-toggle}): files marked with @samp{*}
+Toggle all marks (@code{dired-toggle-marks}): files marked with @samp{*}
 become unmarked, and unmarked files are marked with @samp{*}.  Files
 marked in any other way are not affected.
 
@@ -438,7 +461,7 @@ name.
 @findex dired-undo
 Undo changes in the Dired buffer, such as adding or removing
 marks (@code{dired-undo}).  @emph{This command does not revert the
-actual file operations, nor recovers lost files!}  It just undoes
+actual file operations, nor recover lost files!}  It just undoes
 changes in the buffer itself.  For example, if used after renaming one
 or more files, @code{dired-undo} restores the original names, which
 will get the Dired buffer out of sync with the actual contents of the
@@ -498,6 +521,7 @@ this command sets the modification time of the new file to be the same
 as that of the old file.
 
 @vindex dired-recursive-copies
+@cindex recursive copying
 The variable @code{dired-recursive-copies} controls whether
 directories are copied recursively.  The default is to not copy
 recursively, which means that directories cannot be copied.
@@ -531,7 +555,7 @@ just one link) the name to give the link.
 
 @findex dired-do-symlink
 @kindex S @r{(Dired)}
-@cindex symlinks (in Dired)
+@cindex symbolic links (creation in Dired)
 @item S @var{new} @key{RET}
 Make symbolic links to the specified files (@code{dired-do-symlink}).
 The argument @var{new} is the directory to make the links in, or (if
@@ -643,40 +667,51 @@ command to multiple files:
 
 @itemize @bullet
 @item
-If you use @samp{*} in the shell command, then it runs just once, with
-the list of file names substituted for the @samp{*}.  The order of file
-names is the order of appearance in the Dired buffer.
+If you use @samp{*} surrounded by whitespace in the shell command,
+then the command runs just once, with the list of file names
+substituted for the @samp{*}.  The order of file names is the order of
+appearance in the Dired buffer.
 
 Thus, @kbd{! tar cf foo.tar * @key{RET}} runs @code{tar} on the entire
 list of file names, putting them into one tar file @file{foo.tar}.
 
+If you want to use @samp{*} as a shell wildcard with whitespace around
+it, write @samp{*""}.  In the shell, this is equivalent to @samp{*};
+but since the @samp{*} is not surrounded by whitespace, Dired does
+not treat it specially.
+
 @item
-If the command string doesn't contain @samp{*}, then it runs once
-@emph{for each file}, with the file name added at the end.
+If the command string doesn't contain @samp{*} surrounded by
+whitespace, then it runs once @emph{for each file}.  Normally the file
+name is added at the end.
 
 For example, @kbd{! uudecode @key{RET}} runs @code{uudecode} on each
 file.
-@end itemize
 
-What if you want to run the shell command once for each file, with the
-file name inserted in the middle?  You can use @samp{?} in the command
-instead of @samp{*}.  The current file name is substituted for
-@samp{?}.  You can use @samp{?} more than once.  For instance, here is
-how to uuencode each file, making the output file name by appending
-@samp{.uu} to the input file name:
+@item
+If the command string contains @samp{?} surrounded by whitespace, the
+current file name is substituted for @samp{?}.  You can use @samp{?}
+this way more than once in the command, and each occurrence is
+replaced.  For instance, here is how to uuencode each file, making the
+output file name by appending @samp{.uu} to the input file name:
 
 @example
 uuencode ? ? > ?.uu
 @end example
+@end itemize
 
-To use the file names in a more complicated fashion, you can use a
-shell loop.  For example, this shell command is another way to
-uuencode each file:
+To iterate over the file names in a more complicated fashion, use an
+explicit shell loop.  For example, this shell command is another way
+to uuencode each file:
 
 @example
-for file in *; do uuencode "$file" "$file" >"$file".uu; done
+for file in * ; do uuencode "$file" "$file" >"$file".uu; done
 @end example
 
+@noindent
+This simple example doesn't require a shell loop (you can do it
+with @samp{?}, but it illustrates the technique.
+
 The working directory for the shell command is the top-level directory
 of the Dired buffer.
 
@@ -1048,12 +1083,42 @@ know how to use @code{find}.
 @findex locate-with-filter
 @cindex file database (locate)
 @vindex locate-command
-  @kbd{M-x locate} provides a similar interface to the @code{locate}.
-@kbd{M-x locate-with-filter} is similar, but keeps only lines matching
-a given regular expression.
+  @kbd{M-x locate} provides a similar interface to the @code{locate}
+program.  @kbd{M-x locate-with-filter} is similar, but keeps only lines
+matching a given regular expression.
 
 @vindex find-ls-option
   The format of listing produced by these commands is controlled by the
 variable @code{find-ls-option}, whose default value specifies using
 options @samp{-ld} for @code{ls}.  If your listings are corrupted, you
 may need to change the value of this variable.
+
+@node Misc Dired Commands
+@section Other Dired Commands
+
+@table @kbd
+@item w
+@cindex Adding to the kill ring in Dired.
+@kindex w
+@findex dired-copy-filename-as-kill
+The @kbd{w} command (@code{dired-copy-filename-as-kill}) puts the
+names of the marked (or next @var{n}) files into the kill ring, as if
+you had killed them with @kbd{C-w}.  With a zero prefix argument
+@var{n}=0, use the absolute file name of each marked file.  With just
+@kbd{C-u} as the prefix argument, use the relative file name of each
+marked file.  As a special case, if no prefix argument is given and
+point is on a directory headerline, @kbd{w} gives you the name of that
+directory without looking for marked files.
+
+@vindex dired-marked-files
+The main purpose of the @kbd{w} command is so that you can yank the
+file names into arguments for other Emacs commands.  It also displays
+what was pushed onto the kill ring, so you can use it to display the
+list of currently marked files in the echo area.  It also stores the
+list of names in the variable @code{dired-marked-files}, for use in
+Lisp expressions.
+@end table
+
+@ignore
+   arch-tag: d105f9b9-fc1b-4c5f-a949-9b2cf3ca2fc1
+@end ignore