[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/helm b738e7b65d 4/7: Better handling of errors in mcp
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/helm b738e7b65d 4/7: Better handling of errors in mcp |
Date: |
Wed, 21 Sep 2022 01:59:10 -0400 (EDT) |
branch: elpa/helm
commit b738e7b65dd6fe9ee5ed1f957f3feacd1e2f0a6f
Author: Thierry Volpiatto <thievol@posteo.net>
Commit: Thierry Volpiatto <thievol@posteo.net>
Better handling of errors in mcp
---
helm-files.el | 45 ++++++++++++++++++++++++---------------------
1 file changed, 24 insertions(+), 21 deletions(-)
diff --git a/helm-files.el b/helm-files.el
index 989af7ab7f..22458b2657 100644
--- a/helm-files.el
+++ b/helm-files.el
@@ -6002,8 +6002,10 @@ be directories."
(targets (cdr mkd))
(skipped 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))
+ (cl-assert (file-regular-p file) nil (format "ERROR: Not a regular file
`%s'" file))
+ (cl-assert targets nil (format "ERROR: No destination specified for file
`%s'" file))
+ (cl-assert (cl-loop for f in targets always (file-directory-p f)) nil
+ "ERROR: Destinations must be directories")
(when targets
(cl-loop with yes-for-all
for dest in targets
@@ -6031,25 +6033,26 @@ be directories."
(push (list file (file-name-as-directory dest)
overwrite) operations)
(cl-incf skipped))
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))))))))
+ (when operations
+ (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, 2022/09/21
- [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 <=
- [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