# HG changeset patch # User Chong Yidong # Date 1256416244 0 # Node ID 26d5ef08acf0b759e3d0f32c7075d223b0b4c6ec # Parent 70c3773ee524cabe7df4014c8b7ecce53be655f2 * files.el (delete-directory): Delete symlinks to directories with delete-file (Bug#4739). diff -r 70c3773ee524 -r 26d5ef08acf0 lisp/ChangeLog --- a/lisp/ChangeLog Sat Oct 24 18:58:50 2009 +0000 +++ b/lisp/ChangeLog Sat Oct 24 20:30:44 2009 +0000 @@ -1,3 +1,8 @@ +2009-10-24 Sven Joachim + + * files.el (delete-directory): Delete symlinks to directories with + delete-file (Bug#4739). + 2009-10-24 Chong Yidong * cedet/semantic/util.el (semantic-recursive-find-nonterminal-by-name): diff -r 70c3773ee524 -r 26d5ef08acf0 lisp/files.el --- a/lisp/files.el Sat Oct 24 18:58:50 2009 +0000 +++ b/lisp/files.el Sat Oct 24 20:30:44 2009 +0000 @@ -4660,7 +4660,10 @@ (if (and recursive (not (file-symlink-p directory))) (mapc (lambda (file) - (if (file-directory-p file) + ;; This test is equivalent to + ;; (and (file-directory-p fn) (not (file-symlink-p fn))) + ;; but more efficient + (if (eq t (car (file-attributes file))) (delete-directory file recursive) (delete-file file))) ;; We do not want to delete "." and "..".