]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/files.el (copy-directory): Fix arguments to the recursive call.
authorChong Yidong <cyd@stupidchicken.com>
Mon, 31 Jan 2011 17:03:37 +0000 (12:03 -0500)
committerChong Yidong <cyd@stupidchicken.com>
Mon, 31 Jan 2011 17:03:37 +0000 (12:03 -0500)
lisp/ChangeLog
lisp/files.el

index 286f1eeae656ca47bc1792aa812c6f0e6f199f92..9cb406d431d6da2b149459ea2616d2bdcdd1b685 100644 (file)
@@ -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
index 46597426191dae587586936018b034dc3343d237..d896020b27bc2d146fc4dab551fbed2a4dc43747 100644 (file)
@@ -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))