changeset 105752:26d5ef08acf0

* files.el (delete-directory): Delete symlinks to directories with delete-file (Bug#4739).
author Chong Yidong <cyd@stupidchicken.com>
date Sat, 24 Oct 2009 20:30:44 +0000
parents 70c3773ee524
children cdd9e1b1a30f
files lisp/ChangeLog lisp/files.el
diffstat 2 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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  <svenjoac@gmx.de>
+
+	* files.el (delete-directory): Delete symlinks to directories with
+	delete-file (Bug#4739).
+
 2009-10-24  Chong Yidong  <cyd@stupidchicken.com>
 
 	* cedet/semantic/util.el (semantic-recursive-find-nonterminal-by-name):
--- 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 "..".