diff options
| author | Michael Albinus | 2013-03-05 16:55:53 +0100 |
|---|---|---|
| committer | Michael Albinus | 2013-03-05 16:55:53 +0100 |
| commit | 11f4d68f254fd7bb62d5148b78a0c9b1d49b97fe (patch) | |
| tree | 54aef0b9c78f61340c94fcacbec0d9a478b13cf5 | |
| parent | 2054a6c3119c1115782bf7897747c4c71e9fbadb (diff) | |
| download | emacs-11f4d68f254fd7bb62d5148b78a0c9b1d49b97fe.tar.gz emacs-11f4d68f254fd7bb62d5148b78a0c9b1d49b97fe.zip | |
* net/tramp-compat.el (tramp-compat-delete-directory): Implement
TRASH argument.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/net/tramp-compat.el | 41 |
2 files changed, 28 insertions, 18 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8feb3df5cdd..ac56cd8ba79 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2013-03-05 Michael Albinus <michael.albinus@gmx.de> | ||
| 2 | |||
| 3 | * net/tramp-compat.el (tramp-compat-delete-directory): Implement | ||
| 4 | TRASH argument. | ||
| 5 | |||
| 1 | 2013-03-05 Dmitry Gutov <dgutov@yandex.ru> | 6 | 2013-03-05 Dmitry Gutov <dgutov@yandex.ru> |
| 2 | 7 | ||
| 3 | Keep pre-existing highlighting in completion candidates (Bug#13250). | 8 | Keep pre-existing highlighting in completion candidates (Bug#13250). |
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index 81c4d5ccced..d4639817b18 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el | |||
| @@ -384,25 +384,30 @@ Not actually used. Use `(format \"%o\" i)' instead?" | |||
| 384 | trash))) | 384 | trash))) |
| 385 | (delete-file filename))))) | 385 | (delete-file filename))))) |
| 386 | 386 | ||
| 387 | ;; RECURSIVE has been introduced with Emacs 23.2. | 387 | ;; RECURSIVE has been introduced with Emacs 23.2. TRASH has been |
| 388 | (defun tramp-compat-delete-directory (directory &optional recursive) | 388 | ;; introduced with Emacs 24.1. |
| 389 | (defun tramp-compat-delete-directory (directory &optional recursive trash) | ||
| 389 | "Like `delete-directory' for Tramp files (compat function)." | 390 | "Like `delete-directory' for Tramp files (compat function)." |
| 390 | (if (null recursive) | 391 | (condition-case nil |
| 391 | (delete-directory directory) | 392 | (cond |
| 392 | (condition-case nil | 393 | (trash |
| 393 | (tramp-compat-funcall 'delete-directory directory recursive) | 394 | (tramp-compat-funcall 'delete-directory directory recursive trash)) |
| 394 | ;; This Emacs version does not support the RECURSIVE flag. We | 395 | (recursive |
| 395 | ;; use the implementation from Emacs 23.2. | 396 | (tramp-compat-funcall 'delete-directory directory recursive)) |
| 396 | (wrong-number-of-arguments | 397 | (t |
| 397 | (setq directory (directory-file-name (expand-file-name directory))) | 398 | (delete-directory directory))) |
| 398 | (if (not (file-symlink-p directory)) | 399 | ;; This Emacs version does not support the RECURSIVE or TRASH flag. We |
| 399 | (mapc (lambda (file) | 400 | ;; use the implementation from Emacs 23.2. |
| 400 | (if (eq t (car (file-attributes file))) | 401 | (wrong-number-of-arguments |
| 401 | (tramp-compat-delete-directory file recursive) | 402 | (setq directory (directory-file-name (expand-file-name directory))) |
| 402 | (delete-file file))) | 403 | (if (not (file-symlink-p directory)) |
| 403 | (directory-files | 404 | (mapc (lambda (file) |
| 404 | directory 'full "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*"))) | 405 | (if (eq t (car (file-attributes file))) |
| 405 | (delete-directory directory))))) | 406 | (tramp-compat-delete-directory file recursive trash) |
| 407 | (tramp-compat-delete-file file trash))) | ||
| 408 | (directory-files | ||
| 409 | directory 'full "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*"))) | ||
| 410 | (delete-directory directory)))) | ||
| 406 | 411 | ||
| 407 | ;; `number-sequence' does not exist in XEmacs. Implementation is | 412 | ;; `number-sequence' does not exist in XEmacs. Implementation is |
| 408 | ;; taken from Emacs 23. | 413 | ;; taken from Emacs 23. |