emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/async afe10c4 30/60: Add one-shot dired-async commands


From: Stefan Monnier
Subject: [elpa] externals/async afe10c4 30/60: Add one-shot dired-async commands
Date: Tue, 8 Oct 2019 10:11:32 -0400 (EDT)

branch: externals/async
commit afe10c44c2e51aa91d1f497977c440d55b3378a0
Author: Allen Li <address@hidden>
Commit: Allen Li <address@hidden>

    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)
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]