summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChong Yidong <cyd@stupidchicken.com>2011-01-31 12:03:37 -0500
committerChong Yidong <cyd@stupidchicken.com>2011-01-31 12:03:37 -0500
commit6fa1f65165a76364fc4b808857f7bb06b014b0d6 (patch)
tree7aaffb012097f9134712c6f469462a61fd3653b9
parentdf61c79005470fad666b3c3ae257eef1e06bd079 (diff)
downloademacs-6fa1f65165a76364fc4b808857f7bb06b014b0d6.tar.gz
* lisp/files.el (copy-directory): Fix arguments to the recursive call.
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/files.el32
2 files changed, 19 insertions, 17 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 286f1eeae65..9cb406d431d 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,7 @@
+2011-01-31 Chong Yidong <cyd@stupidchicken.com>
+
+ * files.el (copy-directory): Fix arguments to recursive call.
+
2011-01-29 Chong Yidong <cyd@stupidchicken.com>
* files.el (copy-directory): If destination is an existing
diff --git a/lisp/files.el b/lisp/files.el
index 46597426191..d896020b27b 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -4767,26 +4767,24 @@ this happens by default."
(file-name-nondirectory
(directory-file-name directory))
newname))
- (if (and (file-exists-p newname)
- (not (file-directory-p newname)))
- (error "Cannot overwrite non-directory %s with a directory"
- newname))
+ (and (file-exists-p newname)
+ (not (file-directory-p newname))
+ (error "Cannot overwrite non-directory %s with a directory"
+ newname))
(make-directory newname t))
;; Copy recursively.
- (mapc
- (lambda (file)
- (let ((target (expand-file-name
- (file-name-nondirectory file) newname))
- (attrs (file-attributes file)))
- (cond ((file-directory-p file)
- (copy-directory file target keep-time parents))
- ((stringp (car attrs)) ; Symbolic link
- (make-symbolic-link (car attrs) target t))
- (t
- (copy-file file target t keep-time)))))
- ;; We do not want to copy "." and "..".
- (directory-files directory 'full directory-files-no-dot-files-regexp))
+ (dolist (file
+ ;; We do not want to copy "." and "..".
+ (directory-files directory 'full
+ directory-files-no-dot-files-regexp))
+ (if (file-directory-p file)
+ (copy-directory file newname keep-time parents)
+ (let ((target (expand-file-name (file-name-nondirectory file) newname))
+ (attrs (file-attributes file)))
+ (if (stringp (car attrs)) ; Symbolic link
+ (make-symbolic-link (car attrs) target t)
+ (copy-file file target t keep-time)))))
;; Set directory attributes.
(set-file-modes newname (file-modes directory))