Mercurial > emacs
comparison lisp/net/tramp.el @ 105351:4eaec3ddca1c
* net/tramp.el (tramp-handle-make-directory): Flush upper
directory's file properties.
(tramp-handle-delete-directory): Handle optional parameter
RECURSIVE.
(tramp-handle-dired-recursive-delete-directory): Flush directory
properties after the remove command only.
author | Michael Albinus <michael.albinus@gmx.de> |
---|---|
date | Thu, 01 Oct 2009 15:34:56 +0000 |
parents | ebd8445069df |
children | f6c5cf0fc0c9 |
comparison
equal
deleted
inserted
replaced
105350:05719e53cf8b | 105351:4eaec3ddca1c |
---|---|
3582 | 3582 |
3583 (defun tramp-handle-make-directory (dir &optional parents) | 3583 (defun tramp-handle-make-directory (dir &optional parents) |
3584 "Like `make-directory' for Tramp files." | 3584 "Like `make-directory' for Tramp files." |
3585 (setq dir (expand-file-name dir)) | 3585 (setq dir (expand-file-name dir)) |
3586 (with-parsed-tramp-file-name dir nil | 3586 (with-parsed-tramp-file-name dir nil |
3587 (tramp-flush-directory-property v (file-name-directory localname)) | |
3587 (save-excursion | 3588 (save-excursion |
3588 (tramp-barf-unless-okay | 3589 (tramp-barf-unless-okay |
3589 v | 3590 v |
3590 (format "%s %s" | 3591 (format "%s %s" |
3591 (if parents "mkdir -p" "mkdir") | 3592 (if parents "mkdir -p" "mkdir") |
3592 (tramp-shell-quote-argument localname)) | 3593 (tramp-shell-quote-argument localname)) |
3593 "Couldn't make directory %s" dir)))) | 3594 "Couldn't make directory %s" dir)))) |
3594 | 3595 |
3595 (defun tramp-handle-delete-directory (directory) | 3596 (defun tramp-handle-delete-directory (directory &optional recursive) |
3596 "Like `delete-directory' for Tramp files." | 3597 "Like `delete-directory' for Tramp files." |
3597 (setq directory (expand-file-name directory)) | 3598 (setq directory (expand-file-name directory)) |
3598 (with-parsed-tramp-file-name directory nil | 3599 (with-parsed-tramp-file-name directory nil |
3599 (tramp-flush-directory-property v localname) | 3600 (tramp-flush-directory-property v localname) |
3600 (unless (zerop (tramp-send-command-and-check | 3601 (unless (zerop (tramp-send-command-and-check |
3601 v | 3602 v |
3602 (format "rmdir %s" (tramp-shell-quote-argument localname)))) | 3603 (format |
3604 "%s %s" | |
3605 (if recursive "rm -rf" "rmdir") | |
3606 (tramp-shell-quote-argument localname)))) | |
3603 (tramp-error v 'file-error "Couldn't delete %s" directory)))) | 3607 (tramp-error v 'file-error "Couldn't delete %s" directory)))) |
3604 | 3608 |
3605 (defun tramp-handle-delete-file (filename) | 3609 (defun tramp-handle-delete-file (filename) |
3606 "Like `delete-file' for Tramp files." | 3610 "Like `delete-file' for Tramp files." |
3607 (setq filename (expand-file-name filename)) | 3611 (setq filename (expand-file-name filename)) |
3619 ;; we try and delete two directories under Tramp :/ | 3623 ;; we try and delete two directories under Tramp :/ |
3620 (defun tramp-handle-dired-recursive-delete-directory (filename) | 3624 (defun tramp-handle-dired-recursive-delete-directory (filename) |
3621 "Recursively delete the directory given. | 3625 "Recursively delete the directory given. |
3622 This is like `dired-recursive-delete-directory' for Tramp files." | 3626 This is like `dired-recursive-delete-directory' for Tramp files." |
3623 (with-parsed-tramp-file-name filename nil | 3627 (with-parsed-tramp-file-name filename nil |
3624 (tramp-flush-directory-property v localname) | |
3625 ;; Run a shell command 'rm -r <localname>' | 3628 ;; Run a shell command 'rm -r <localname>' |
3626 ;; Code shamelessly stolen from the dired implementation and, um, hacked :) | 3629 ;; Code shamelessly stolen from the dired implementation and, um, hacked :) |
3627 (unless (file-exists-p filename) | 3630 (unless (file-exists-p filename) |
3628 (tramp-error v 'file-error "No such directory: %s" filename)) | 3631 (tramp-error v 'file-error "No such directory: %s" filename)) |
3629 ;; Which is better, -r or -R? (-r works for me <daniel@danann.net>) | 3632 ;; Which is better, -r or -R? (-r works for me <daniel@danann.net>) |
3634 nil t) | 3637 nil t) |
3635 ;; Wait for the remote system to return to us... | 3638 ;; Wait for the remote system to return to us... |
3636 ;; This might take a while, allow it plenty of time. | 3639 ;; This might take a while, allow it plenty of time. |
3637 (tramp-wait-for-output (tramp-get-connection-process v) 120) | 3640 (tramp-wait-for-output (tramp-get-connection-process v) 120) |
3638 ;; Make sure that it worked... | 3641 ;; Make sure that it worked... |
3642 (tramp-flush-directory-property v localname) | |
3639 (and (file-exists-p filename) | 3643 (and (file-exists-p filename) |
3640 (tramp-error | 3644 (tramp-error |
3641 v 'file-error "Failed to recursively delete %s" filename)))) | 3645 v 'file-error "Failed to recursively delete %s" filename)))) |
3642 | 3646 |
3643 (defun tramp-handle-dired-compress-file (file &rest ok-flag) | 3647 (defun tramp-handle-dired-compress-file (file &rest ok-flag) |