[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/helm 5696da5e86 3/7: Avoid asking for overwrite at each tu
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/helm 5696da5e86 3/7: Avoid asking for overwrite at each turn in mcp |
Date: |
Wed, 21 Sep 2022 01:59:09 -0400 (EDT) |
branch: elpa/helm
commit 5696da5e86825c3ff064a9e0479567096f9fba9b
Author: Thierry Volpiatto <thievol@posteo.net>
Commit: Thierry Volpiatto <thievol@posteo.net>
Avoid asking for overwrite at each turn in mcp
Use helm-read-answer.
---
helm-files.el | 37 +++++++++++++++++++++++--------------
1 file changed, 23 insertions(+), 14 deletions(-)
diff --git a/helm-files.el b/helm-files.el
index 0a8105f45a..989af7ab7f 100644
--- a/helm-files.el
+++ b/helm-files.el
@@ -5992,7 +5992,7 @@ list."
(message "No files found in file(s)"))
:buffer "*helm find files in files*")))
-(defun helm-ff-mcp (_candidate)
+(cl-defun helm-ff-mcp (_candidate)
"Copy the car of marked candidates to the remaining marked candidates.
The car of marked should be a regular file and the rest of marked (cdr) should
@@ -6005,22 +6005,31 @@ be directories."
(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
- (cl-loop for dest in targets
+ (cl-loop with yes-for-all
+ for dest in targets
for dest-file = (expand-file-name (helm-basename file) dest)
for dir-ok = (file-accessible-directory-p dest)
- for overwrite = (and dir-ok
- (file-exists-p
- (expand-file-name
- (helm-basename file) dest)))
- for skip = (and overwrite
- (null (y-or-n-p
- (format
- "File `%s' already-exists, overwrite? "
- dest-file))))
+ for exists = (and dir-ok
+ (file-exists-p
+ (expand-file-name
+ (helm-basename file) dest)))
+ for overwrite = (or (null exists)
+ yes-for-all
+ (pcase (helm-read-answer
+ (format
+ "File `%s' already-exists,
overwrite (y,n,!,q) ? "
+ dest-file)
+ '("y" "n" "!" "q"))
+ ("y" t)
+ ("n" nil)
+ ("!" (prog1 t
+ (setq yes-for-all t)))
+ ("q" (cl-return-from helm-ff-mcp
+ (message "Operation aborted")))))
if dir-ok
- do (if skip
- (cl-incf skipped)
- (push (list file (file-name-as-directory dest) overwrite)
operations))
+ do (if overwrite
+ (push (list file (file-name-as-directory dest)
overwrite) operations)
+ (cl-incf skipped))
else do (cl-incf skipped))
(async-start
`(lambda ()
- [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 <=
- [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