[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/helm 69ebc19e16 2/7: Make mcp asynchronous
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/helm 69ebc19e16 2/7: Make mcp asynchronous |
Date: |
Wed, 21 Sep 2022 01:59:09 -0400 (EDT) |
branch: elpa/helm
commit 69ebc19e1649a9ec98bf136be1e7ea52d948f450
Author: Thierry Volpiatto <thievol@posteo.net>
Commit: Thierry Volpiatto <thievol@posteo.net>
Make mcp asynchronous
---
helm-files.el | 32 ++++++++++++++++++++++----------
1 file changed, 22 insertions(+), 10 deletions(-)
diff --git a/helm-files.el b/helm-files.el
index 85f9b66006..0a8105f45a 100644
--- a/helm-files.el
+++ b/helm-files.el
@@ -6001,7 +6001,7 @@ be directories."
(file (car mkd))
(targets (cdr mkd))
(skipped 0)
- (copies 0))
+ operations)
(cl-assert (file-regular-p file) nil (format "Not a regular file `%s'"
file))
(cl-assert targets nil (format "No destination specified for file `%s'"
file))
(when targets
@@ -6020,15 +6020,27 @@ be directories."
if dir-ok
do (if skip
(cl-incf skipped)
- (copy-file file (file-name-as-directory dest) overwrite)
- (cl-incf copies))
- else do (progn
- (cl-incf skipped)
- (message "Access denied `%s'" dest))
- finally do
- (message "%s %s of `%s' done, %s skipped"
- copies (if (> copies 1) "copies" "copy")
- (helm-basename file) skipped)))))
+ (push (list file (file-name-as-directory dest) overwrite)
operations))
+ else do (cl-incf skipped))
+ (async-start
+ `(lambda ()
+ (require 'cl-lib)
+ (cl-loop with copies = 0
+ with skipped = ,skipped
+ for (file dest overwrite) in ',operations
+ do (condition-case _err
+ (progn
+ (copy-file file dest overwrite)
+ (cl-incf copies))
+ (file-error (cl-incf skipped)))
+ finally return (list file copies skipped)))
+ (lambda (result)
+ (let ((copied (nth 1 result)))
+ (message "Mcp done, %s %s of %s done, %s files skipped"
+ copied (if (> copied 1)
+ "copies" "copy")
+ (helm-basename (nth 0 result))
+ (nth 2 result))))))))
(helm-make-command-from-action helm-ff-run-mcp
"Copy the car of marked candidates to the remaining marked candidates."
- [nongnu] elpa/helm updated (0c12230b4f -> 80b3a39da3), ELPA Syncer, 2022/09/21
- [nongnu] elpa/helm 8e8efdd7fb 1/7: Make action name more explicit, ELPA Syncer, 2022/09/21
- [nongnu] elpa/helm 69ebc19e16 2/7: Make mcp asynchronous,
ELPA Syncer <=
- [nongnu] elpa/helm 5696da5e86 3/7: Avoid asking for overwrite at each turn in mcp, ELPA Syncer, 2022/09/21
- [nongnu] elpa/helm 80b3a39da3 7/7: Stop removing inotify watchers from the callback, ELPA Syncer, 2022/09/21
- [nongnu] elpa/helm b738e7b65d 4/7: Better handling of errors in mcp, ELPA Syncer, 2022/09/21
- [nongnu] elpa/helm 7ad76573ee 5/7: Ask and show destinations in mcp, ELPA Syncer, 2022/09/21
- [nongnu] elpa/helm 2ff63556c2 6/7: Mcp notifications in mode-line, ELPA Syncer, 2022/09/21