Mercurial > emacs
comparison lisp/net/tramp-compat.el @ 108851:cb093dac3d58
Merge from mainline.
author | Katsumi Yamaoka <yamaoka@jpl.org> |
---|---|
date | Fri, 28 May 2010 00:48:45 +0000 |
parents | 511da81b16c5 |
children | 94d1d8a6dcfd |
comparison
equal
deleted
inserted
replaced
108850:7cd8ffa6f7db | 108851:cb093dac3d58 |
---|---|
332 ;; Set directory attributes. | 332 ;; Set directory attributes. |
333 (set-file-modes newname (file-modes directory)) | 333 (set-file-modes newname (file-modes directory)) |
334 (if keep-time | 334 (if keep-time |
335 (set-file-times newname (nth 5 (file-attributes directory)))))))) | 335 (set-file-times newname (nth 5 (file-attributes directory)))))))) |
336 | 336 |
337 ;; FORCE has been introduced with Emacs 24.1. | 337 ;; TRASH has been introduced with Emacs 24.1. |
338 (defun tramp-compat-delete-file (filename &optional force) | 338 (defun tramp-compat-delete-file (filename &optional trash) |
339 "Like `delete-file' for Tramp files (compat function)." | 339 "Like `delete-file' for Tramp files (compat function)." |
340 (if (null force) | 340 (condition-case nil |
341 (delete-file filename) | 341 (tramp-compat-funcall 'delete-file filename trash) |
342 (condition-case nil | 342 ;; This Emacs version does not support the TRASH flag. |
343 (tramp-compat-funcall 'delete-file filename force) | 343 (wrong-number-of-arguments |
344 ;; This Emacs version does not support the FORCE flag. Setting | 344 (let ((delete-by-moving-to-trash |
345 ;; `delete-by-moving-to-trash' shall give us the same effect. | 345 (and (boundp 'delete-by-moving-to-trash) |
346 (wrong-number-of-arguments | 346 delete-by-moving-to-trash |
347 (let ((delete-by-moving-to-trash | 347 trash))) |
348 (cond | 348 (delete-file filename))))) |
349 ((null force) t) | |
350 ((boundp 'delete-by-moving-to-trash) | |
351 (symbol-value 'delete-by-moving-to-trash)) | |
352 (t nil)))) | |
353 (delete-file filename)))))) | |
354 | 349 |
355 ;; RECURSIVE has been introduced with Emacs 23.2. | 350 ;; RECURSIVE has been introduced with Emacs 23.2. |
356 (defun tramp-compat-delete-directory (directory &optional recursive) | 351 (defun tramp-compat-delete-directory (directory &optional recursive) |
357 "Like `delete-directory' for Tramp files (compat function)." | 352 "Like `delete-directory' for Tramp files (compat function)." |
358 (if (null recursive) | 353 (if (null recursive) |