From: Chong Yidong Date: Tue, 20 Apr 2010 22:28:26 +0000 (-0400) Subject: * files.el (copy-directory): Handle symlinks (Bug#5982). X-Git-Tag: emacs-pretest-23.1.97~24^2 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=99833607e0b6a5a49159ecedfa8ad40eb1671f6c;p=emacs.git * files.el (copy-directory): Handle symlinks (Bug#5982). --- 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))