From: Michael Albinus Date: Thu, 22 Sep 2011 10:00:07 +0000 (+0200) Subject: * files.el (copy-directory): Set directory attributes only in case X-Git-Tag: emacs-pretest-24.0.90~49 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e74f1bb6f82eef5bc4909f25b5c10d8e7bffc090;p=emacs.git * files.el (copy-directory): Set directory attributes only in case they could be retrieved from the source directory. (Bug#9565) --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 17000ca8697..013df43f3b7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2011-09-22 Michael Albinus + + * files.el (copy-directory): Set directory attributes only in case + they could be retrieved from the source directory. (Bug#9565) + 2011-09-22 Dima Kogan (tiny change) * progmodes/hideshow.el (hs-looking-at-block-start-p) diff --git a/lisp/files.el b/lisp/files.el index b29c0596d7b..8b05b62e524 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -4941,9 +4941,10 @@ directly into NEWNAME instead." (copy-file file target t keep-time))))) ;; Set directory attributes. - (set-file-modes newname (file-modes directory)) - (if keep-time - (set-file-times newname (nth 5 (file-attributes directory))))))) + (let ((modes (file-modes directory)) + (times (and keep-time (nth 5 (file-attributes directory))))) + (if modes (set-file-modes newname modes)) + (if times (set-file-times newname times)))))) (put 'revert-buffer-function 'permanent-local t) (defvar revert-buffer-function nil