From 99833607e0b6a5a49159ecedfa8ad40eb1671f6c Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Tue, 20 Apr 2010 18:28:26 -0400 Subject: [PATCH] * files.el (copy-directory): Handle symlinks (Bug#5982). --- lisp/ChangeLog | 2 ++ lisp/files.el | 12 ++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6cf40c75d6c..8a8f7ef9732 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,7 @@ 2010-04-20 Chong Yidong + * files.el (copy-directory): Handle symlinks (Bug#5982). + * progmodes/compile.el (compilation-next-error-function): Revert 2009-10-12 change (Bug#5983). diff --git a/lisp/files.el b/lisp/files.el index 99fa7ddf1b5..76345034c6e 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -4735,10 +4735,14 @@ this happens by default." (mapc (lambda (file) (let ((target (expand-file-name - (file-name-nondirectory file) newname))) - (if (file-directory-p file) - (copy-directory file target keep-time parents) - (copy-file file target t keep-time)))) + (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)) -- 2.11.4.GIT