aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2017-08-15 10:06:44 -0700
committerPaul Eggert2017-08-15 10:16:33 -0700
commit5c3d0ce3e09bf070bb3c89caa9d88f25d4a39283 (patch)
tree7da01ac9a3dbed4078923e879160d0e0ad54d08f
parent63daecda016a6d8f1241c07d7a06b154e31bfcb4 (diff)
downloademacs-5c3d0ce3e09bf070bb3c89caa9d88f25d4a39283.tar.gz
emacs-5c3d0ce3e09bf070bb3c89caa9d88f25d4a39283.zip
New manual section "Copying and Naming"
* doc/emacs/files.texi (Copying and Naming): New section, split off from Misc File Ops and containing the operations that copy, name or rename files. This fixes some confusion caused by the incorrect phrase "The same rule applies to all the remaining commands in this section" in the old manual. This change does not affect the confusion about directories (see Bug#27986 for ongoing discussion).
-rw-r--r--doc/emacs/custom.texi2
-rw-r--r--doc/emacs/emacs.texi1
-rw-r--r--doc/emacs/files.texi123
3 files changed, 69 insertions, 57 deletions
diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi
index 1c9c14a962a..824fb6ede26 100644
--- a/doc/emacs/custom.texi
+++ b/doc/emacs/custom.texi
@@ -1710,7 +1710,7 @@ and mouse events:
1710specify the key sequence. Using a string is simpler, but only works 1710specify the key sequence. Using a string is simpler, but only works
1711for @acronym{ASCII} characters and Meta-modified @acronym{ASCII} 1711for @acronym{ASCII} characters and Meta-modified @acronym{ASCII}
1712characters. For example, here's how to bind @kbd{C-x M-l} to 1712characters. For example, here's how to bind @kbd{C-x M-l} to
1713@code{make-symbolic-link} (@pxref{Misc File Ops}): 1713@code{make-symbolic-link} (@pxref{Copying and Naming}):
1714 1714
1715@example 1715@example
1716(global-set-key "\C-x\M-l" 'make-symbolic-link) 1716(global-set-key "\C-x\M-l" 'make-symbolic-link)
diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi
index a3eb4225a75..f3e6c94e274 100644
--- a/doc/emacs/emacs.texi
+++ b/doc/emacs/emacs.texi
@@ -453,6 +453,7 @@ File Handling
453* Directories:: Creating, deleting, and listing file directories. 453* Directories:: Creating, deleting, and listing file directories.
454* Comparing Files:: Finding where two files differ. 454* Comparing Files:: Finding where two files differ.
455* Diff Mode:: Mode for editing file differences. 455* Diff Mode:: Mode for editing file differences.
456* Copying and Naming:: Copying, naming and renaming files.
456* Misc File Ops:: Other things you can do on files. 457* Misc File Ops:: Other things you can do on files.
457* Compressed Files:: Accessing compressed files. 458* Compressed Files:: Accessing compressed files.
458* File Archives:: Operating on tar, zip, jar etc. archive files. 459* File Archives:: Operating on tar, zip, jar etc. archive files.
diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi
index 0b4e8eda2a7..7bca988a453 100644
--- a/doc/emacs/files.texi
+++ b/doc/emacs/files.texi
@@ -33,6 +33,7 @@ on file directories.
33* Directories:: Creating, deleting, and listing file directories. 33* Directories:: Creating, deleting, and listing file directories.
34* Comparing Files:: Finding where two files differ. 34* Comparing Files:: Finding where two files differ.
35* Diff Mode:: Mode for editing file differences. 35* Diff Mode:: Mode for editing file differences.
36* Copying and Naming:: Copying, naming and renaming files.
36* Misc File Ops:: Other things you can do on files. 37* Misc File Ops:: Other things you can do on files.
37* Compressed Files:: Accessing compressed files. 38* Compressed Files:: Accessing compressed files.
38* File Archives:: Operating on tar, zip, jar etc. archive files. 39* File Archives:: Operating on tar, zip, jar etc. archive files.
@@ -1545,6 +1546,72 @@ decide whether to save the changes (the list of modified files is
1545displayed in the echo area). With a prefix argument, it tries to 1546displayed in the echo area). With a prefix argument, it tries to
1546modify the original source files rather than the patched source files. 1547modify the original source files rather than the patched source files.
1547 1548
1549@node Copying and Naming
1550@section Copying, Naming and Renaming Files
1551
1552 Emacs has several commands for copying, naming, and renaming files.
1553All of them read two file names @var{old} and @var{new} using the
1554minibuffer, and then copy or adjust a file's name accordingly; they do
1555not accept wildcard file names.
1556
1557In all these commands, if the argument @var{new} is just a directory
1558name, the real new name is in that directory, with the same
1559non-directory component as @var{old}. For example, @kbd{M-x
1560rename-file @key{RET} ~/foo @key{RET}
1561@c FIXME: This part of the example should be '/tmp/' not '/tmp',
1562@c because '/tmp' is not "just a directory name".
1563/tmp
1564@c
1565@key{RET}} renames @file{~/foo} to @file{/tmp/foo}. All these
1566commands ask for confirmation when the new file name already exists,
1567too.
1568
1569@findex copy-file
1570@cindex copying files
1571 @kbd{M-x copy-file} copies the contents of the file @var{old} to the
1572file @var{new}.
1573
1574@findex copy-directory
1575 @kbd{M-x copy-directory} copies directories, similar to the
1576@command{cp -r} shell command. If @var{new} is an existing directory,
1577it creates a copy of the @var{old} directory and puts it in @var{new}.
1578If @var{new} is not an existing directory, it copies all the contents
1579of @var{old} into a new directory named @var{new}.
1580
1581@cindex renaming files
1582@findex rename-file
1583 @kbd{M-x rename-file} renames file @var{old} as @var{new}. If the
1584file name @var{new} already exists, you must confirm with @kbd{yes} or
1585renaming is not done; this is because renaming causes the old meaning
1586of the name @var{new} to be lost. If @var{old} and @var{new} are on
1587different file systems, the file @var{old} is copied and deleted.
1588
1589@ifnottex
1590 If a file is under version control (@pxref{Version Control}), you
1591should rename it using @kbd{M-x vc-rename-file} instead of @kbd{M-x
1592rename-file}. @xref{VC Delete/Rename}.
1593@end ifnottex
1594
1595@findex add-name-to-file
1596@cindex hard links (creation)
1597 @kbd{M-x add-name-to-file} adds an additional name to an existing
1598file without removing the old name. The new name is created as a hard
1599link to the existing file. The new name must belong on the same file
1600system that the file is on. On MS-Windows, this command works only if
1601the file resides in an NTFS file system. On MS-DOS, it works by
1602copying the file.
1603
1604@findex make-symbolic-link
1605@cindex symbolic links (creation)
1606 @kbd{M-x make-symbolic-link} creates a symbolic link named
1607@var{new}, which points at @var{target}. The effect is that future
1608attempts to open file @var{new} will refer to whatever file is named
1609@var{target} at the time the opening is done, or will get an error if
1610the name @var{target} is nonexistent at that time. This command does
1611not expand the argument @var{target}, so that it allows you to specify
1612a relative name as the target of the link. On MS-Windows, this
1613command works only on MS Windows Vista and later.
1614
1548@node Misc File Ops 1615@node Misc File Ops
1549@section Miscellaneous File Operations 1616@section Miscellaneous File Operations
1550 1617
@@ -1581,62 +1648,6 @@ should delete it using @kbd{M-x vc-delete-file} instead of @kbd{M-x
1581delete-file}. @xref{VC Delete/Rename}. 1648delete-file}. @xref{VC Delete/Rename}.
1582@end ifnottex 1649@end ifnottex
1583 1650
1584@findex copy-file
1585@cindex copying files
1586 @kbd{M-x copy-file} copies the contents of the file @var{old} to the
1587file @var{new}.
1588
1589@findex copy-directory
1590 @kbd{M-x copy-directory} copies directories, similar to the
1591@command{cp -r} shell command. It prompts for a directory @var{old}
1592and a destination @var{new}. If @var{new} is an existing directory,
1593it creates a copy of the @var{old} directory and puts it in @var{new}.
1594If @var{new} is not an existing directory, it copies all the contents
1595of @var{old} into a new directory named @var{new}.
1596
1597@cindex renaming files
1598@findex rename-file
1599 @kbd{M-x rename-file} reads two file names @var{old} and @var{new}
1600using the minibuffer, then renames file @var{old} as @var{new}. If
1601the file name @var{new} already exists, you must confirm with
1602@kbd{yes} or renaming is not done; this is because renaming causes the
1603old meaning of the name @var{new} to be lost. If @var{old} and
1604@var{new} are on different file systems, the file @var{old} is copied
1605and deleted. If the argument @var{new} is just a directory name, the
1606real new name is in that directory, with the same non-directory
1607component as @var{old}. For example, @kbd{M-x rename-file @key{RET}
1608~/foo @key{RET} /tmp @key{RET}} renames @file{~/foo} to
1609@file{/tmp/foo}. The same rule applies to all the remaining commands
1610in this section. All of them ask for confirmation when the new file
1611name already exists, too.
1612
1613@ifnottex
1614 If a file is under version control (@pxref{Version Control}), you
1615should rename it using @kbd{M-x vc-rename-file} instead of @kbd{M-x
1616rename-file}. @xref{VC Delete/Rename}.
1617@end ifnottex
1618
1619@findex add-name-to-file
1620@cindex hard links (creation)
1621 @kbd{M-x add-name-to-file} adds an additional name to an existing
1622file without removing its old name. The new name is created as a
1623hard link to the existing file. The new name must belong on the
1624same file system that the file is on. On MS-Windows, this command
1625works only if the file resides in an NTFS file system. On MS-DOS, it
1626works by copying the file.
1627
1628@findex make-symbolic-link
1629@cindex symbolic links (creation)
1630 @kbd{M-x make-symbolic-link} reads two file names @var{target} and
1631@var{linkname}, then creates a symbolic link named @var{linkname},
1632which points at @var{target}. The effect is that future attempts to
1633open file @var{linkname} will refer to whatever file is named
1634@var{target} at the time the opening is done, or will get an error if
1635the name @var{target} is nonexistent at that time. This command does
1636not expand the argument @var{target}, so that it allows you to specify
1637a relative name as the target of the link. On MS-Windows, this
1638command works only on MS Windows Vista and later.
1639
1640@kindex C-x i 1651@kindex C-x i
1641@findex insert-file 1652@findex insert-file
1642 @kbd{M-x insert-file} (also @kbd{C-x i}) inserts a copy of the 1653 @kbd{M-x insert-file} (also @kbd{C-x i}) inserts a copy of the