emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r111944: * net/tramp-compat.el (tramp


From: Michael Albinus
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111944: * net/tramp-compat.el (tramp-compat-delete-directory): Implement
Date: Tue, 05 Mar 2013 16:55:53 +0100
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111944
committer: Michael Albinus <address@hidden
branch nick: trunk
timestamp: Tue 2013-03-05 16:55:53 +0100
message:
  * net/tramp-compat.el (tramp-compat-delete-directory): Implement
  TRASH argument.
modified:
  lisp/ChangeLog
  lisp/net/tramp-compat.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-03-05 07:38:16 +0000
+++ b/lisp/ChangeLog    2013-03-05 15:55:53 +0000
@@ -1,3 +1,8 @@
+2013-03-05  Michael Albinus  <address@hidden>
+
+       * net/tramp-compat.el (tramp-compat-delete-directory): Implement
+       TRASH argument.
+
 2013-03-05  Dmitry Gutov  <address@hidden>
 
        Keep pre-existing highlighting in completion candidates (Bug#13250).

=== modified file 'lisp/net/tramp-compat.el'
--- a/lisp/net/tramp-compat.el  2013-02-16 17:44:00 +0000
+++ b/lisp/net/tramp-compat.el  2013-03-05 15:55:53 +0000
@@ -384,25 +384,30 @@
                 trash)))
        (delete-file filename)))))
 
-;; RECURSIVE has been introduced with Emacs 23.2.
-(defun tramp-compat-delete-directory (directory &optional recursive)
+;; RECURSIVE has been introduced with Emacs 23.2.  TRASH has been
+;; introduced with Emacs 24.1.
+(defun tramp-compat-delete-directory (directory &optional recursive trash)
   "Like `delete-directory' for Tramp files (compat function)."
-  (if (null recursive)
-      (delete-directory directory)
-    (condition-case nil
-       (tramp-compat-funcall 'delete-directory directory recursive)
-      ;; This Emacs version does not support the RECURSIVE flag.  We
-      ;; use the implementation from Emacs 23.2.
-      (wrong-number-of-arguments
-       (setq directory (directory-file-name (expand-file-name directory)))
-       (if (not (file-symlink-p directory))
-          (mapc (lambda (file)
-                  (if (eq t (car (file-attributes file)))
-                      (tramp-compat-delete-directory file recursive)
-                    (delete-file file)))
-                (directory-files
-                 directory 'full "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*")))
-       (delete-directory directory)))))
+  (condition-case nil
+      (cond
+       (trash
+       (tramp-compat-funcall 'delete-directory directory recursive trash))
+       (recursive
+       (tramp-compat-funcall 'delete-directory directory recursive))
+       (t
+       (delete-directory directory)))
+    ;; This Emacs version does not support the RECURSIVE or TRASH flag.  We
+    ;; use the implementation from Emacs 23.2.
+    (wrong-number-of-arguments
+     (setq directory (directory-file-name (expand-file-name directory)))
+     (if (not (file-symlink-p directory))
+        (mapc (lambda (file)
+                (if (eq t (car (file-attributes file)))
+                    (tramp-compat-delete-directory file recursive trash)
+                  (tramp-compat-delete-file file trash)))
+              (directory-files
+               directory 'full "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*")))
+     (delete-directory directory))))
 
 ;; `number-sequence' does not exist in XEmacs.  Implementation is
 ;; taken from Emacs 23.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]