aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGerd Moellmann2001-10-05 12:50:48 +0000
committerGerd Moellmann2001-10-05 12:50:48 +0000
commita9d14e54a813172e7a841371981e426c72f8feb4 (patch)
treed681b671dec5ac67e0b5e87635f4be204f5148cd /src
parent7bdb67b2b38fec58469658b93bcf6f6ecaf69ea3 (diff)
downloademacs-a9d14e54a813172e7a841371981e426c72f8feb4.tar.gz
emacs-a9d14e54a813172e7a841371981e426c72f8feb4.zip
(Fcopy_file): If NEWNAME is a directory copy FILE there.
Diffstat (limited to 'src')
-rw-r--r--src/fileio.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/fileio.c b/src/fileio.c
index b152f0a74e0..4c7921752a5 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -2287,6 +2287,7 @@ barf_or_query_if_file_exists (absname, querystring, interactive, statptr, quick)
2287DEFUN ("copy-file", Fcopy_file, Scopy_file, 2, 4, 2287DEFUN ("copy-file", Fcopy_file, Scopy_file, 2, 4,
2288 "fCopy file: \nFCopy %s to file: \np\nP", 2288 "fCopy file: \nFCopy %s to file: \np\nP",
2289 "Copy FILE to NEWNAME. Both args must be strings.\n\ 2289 "Copy FILE to NEWNAME. Both args must be strings.\n\
2290If NEWNAME names a directory, copy FILE there.\n\
2290Signals a `file-already-exists' error if file NEWNAME already exists,\n\ 2291Signals a `file-already-exists' error if file NEWNAME already exists,\n\
2291unless a third argument OK-IF-ALREADY-EXISTS is supplied and non-nil.\n\ 2292unless a third argument OK-IF-ALREADY-EXISTS is supplied and non-nil.\n\
2292A number as third arg means request confirmation if NEWNAME already exists.\n\ 2293A number as third arg means request confirmation if NEWNAME already exists.\n\
@@ -2311,8 +2312,12 @@ A prefix arg makes KEEP-TIME non-nil.")
2311 CHECK_STRING (file, 0); 2312 CHECK_STRING (file, 0);
2312 CHECK_STRING (newname, 1); 2313 CHECK_STRING (newname, 1);
2313 2314
2315 if (!NILP (Ffile_directory_p (newname)))
2316 newname = Fexpand_file_name (file, newname);
2317 else
2318 newname = Fexpand_file_name (newname, Qnil);
2319
2314 file = Fexpand_file_name (file, Qnil); 2320 file = Fexpand_file_name (file, Qnil);
2315 newname = Fexpand_file_name (newname, Qnil);
2316 2321
2317 /* If the input file name has special constructs in it, 2322 /* If the input file name has special constructs in it,
2318 call the corresponding file handler. */ 2323 call the corresponding file handler. */