branch: externals/async commit dea9627e64465678024262d8b92453e2cc0f5d47 Merge: 87853ae afe10c4 Author: John Wiegley <jwieg...@gmail.com> Commit: GitHub <nore...@github.com>
Merge pull request #87 from darkfeline/async Add one-shot dired-async commands --- dired-async.el | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/dired-async.el b/dired-async.el index 485786c..5428206 100644 --- a/dired-async.el +++ b/dired-async.el @@ -362,6 +362,39 @@ ESC or `q' to not overwrite any of the remaining files, (ad-deactivate 'dired-create-files) (ad-deactivate 'wdired-do-renames)))) +(defmacro dired-async--with-async-create-files (&rest body) + "Evaluate BODY with ‘dired-create-files’ set to ‘dired-async-create-files’." + (declare (indent 0)) + `(cl-letf (((symbol-function 'dired-create-files) #'dired-async-create-files)) + ,@body)) + +;;;###autoload +(defun dired-async-do-copy (&optional arg) + "Run ‘dired-do-copy’ asynchronously." + (interactive "P") + (dired-async--with-async-create-files + (dired-do-copy arg))) + +;;;###autoload +(defun dired-async-do-symlink (&optional arg) + "Run ‘dired-do-symlink’ asynchronously." + (interactive "P") + (dired-async--with-async-create-files + (dired-do-symlink arg))) + +;;;###autoload +(defun dired-async-do-hardlink (&optional arg) + "Run ‘dired-do-hardlink’ asynchronously." + (interactive "P") + (dired-async--with-async-create-files + (dired-do-hardlink arg))) + +;;;###autoload +(defun dired-async-do-rename (&optional arg) + "Run ‘dired-do-rename’ asynchronously." + (interactive "P") + (dired-async--with-async-create-files + (dired-do-rename arg))) (provide 'dired-async)