branch: externals/ssh-deploy commit fd7abe9b5e59b66a20b67c8df5fcdf15b272d2ce Author: Christian Johansson <christ...@cvj.se> Commit: Christian Johansson <christ...@cvj.se>
Mode-line status update for asynchronously deleted file working --- ssh-deploy.el | 62 ++++++++++++++++++++++++++++++----------------------------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/ssh-deploy.el b/ssh-deploy.el index 2b25af1..4149000 100644 --- a/ssh-deploy.el +++ b/ssh-deploy.el @@ -791,39 +791,41 @@ (defun ssh-deploy-delete (path &optional async debug buffer) "Delete PATH and use flags ASYNC and DEBUG, set status in BUFFER." (if (and async (fboundp 'async-start)) - (async-start - `(lambda() - (if (file-exists-p ,path) - (when (and (boundp 'buffer) - buffer) - (ssh-deploy--mode-line-set-status-and-update ssh-deploy--status-deleting buffer)) - (let ((file-or-directory (not (file-directory-p ,path)))) - (progn - (if file-or-directory - (delete-file ,path t) - (delete-directory ,path t t)) - (list ,path 0 buffer))) - (list ,path 1 buffer))) - (lambda(response) - (when (nth 2 response) - (ssh-deploy--mode-line-set-status-and-update ssh-deploy--status-idle (nth 2 response)) - (kill-buffer (find-buffer-visiting (nth 2 response)))) - (cond ((= 0 (nth 1 response)) (message "Completed deletion of '%s'. (asynchronously)" (nth 0 response))) - (t (display-warning 'ssh-deploy (format "Did not find '%s' for deletion. (asynchronously)" (nth 0 response)) :warning))))) + (progn + (when (and (boundp 'buffer) + buffer) + (ssh-deploy--mode-line-set-status-and-update ssh-deploy--status-deleting buffer)) + (async-start + `(lambda() + (if (file-exists-p ,path) + (let ((file-or-directory (not (file-directory-p ,path)))) + (progn + (if file-or-directory + (delete-file ,path t) + (delete-directory ,path t t)) + (list ,path 0 ,buffer))) + (list ,path 1 ,buffer))) + (lambda(response) + (when (nth 2 response) + (ssh-deploy--mode-line-set-status-and-update ssh-deploy--status-idle (nth 2 response)) + (kill-buffer (find-buffer-visiting (nth 2 response)))) + (cond ((= 0 (nth 1 response)) (message "Completed deletion of '%s'. (asynchronously)" (nth 0 response))) + (t (display-warning 'ssh-deploy (format "Did not find '%s' for deletion. (asynchronously)" (nth 0 response)) :warning)))))) (if (file-exists-p path) - (let ((file-or-directory (not (file-directory-p path)))) + (ssh-deploy--mode-line-set-status-and-update ssh-deploy--status-deleting buffer) + (let ((file-or-directory (not (file-directory-p path)))) + (when (and (boundp 'buffer) + buffer) + (ssh-deploy--mode-line-set-status-and-update ssh-deploy--status-deleting buffer)) + (progn + (if file-or-directory + (delete-file path t) + (delete-directory path t t)) (when (and (boundp 'buffer) buffer) - (ssh-deploy--mode-line-set-status-and-update ssh-deploy--status-deleting buffer)) - (progn - (if file-or-directory - (delete-file path t) - (delete-directory path t t)) - (when (and (boundp 'buffer) - buffer) - (ssh-deploy--mode-line-set-status-and-update ssh-deploy--status-idle) - (kill-buffer (find-buffer-visiting buffer))) - (message "Completed deletion of '%s'. (synchronously)" path))) + (ssh-deploy--mode-line-set-status-and-update ssh-deploy--status-idle buffer) + (kill-buffer (find-buffer-visiting buffer))) + (message "Completed deletion of '%s'. (synchronously)" path))) (display-warning 'ssh-deploy (format "Did not find '%s' for deletion. (synchronously)" path) :warning)))) ;;;### autoload