[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 416c73a 037/187: * helm-async.el (helm-async-be-async): Ne
From: |
Michael Albinus |
Subject: |
[elpa] master 416c73a 037/187: * helm-async.el (helm-async-be-async): New, allow turning off async. |
Date: |
Wed, 30 Dec 2015 11:49:33 +0000 |
branch: master
commit 416c73ae4114ac81c15eb819b28db2f09b5a8423
Author: Thierry Volpiatto <address@hidden>
Commit: Thierry Volpiatto <address@hidden>
* helm-async.el (helm-async-be-async): New, allow turning off async.
(dired-create-file): Use it.
---
helm-async.el | 65 ++++++++++++++++++++++++++++++++++++++++++---------------
1 files changed, 48 insertions(+), 17 deletions(-)
diff --git a/helm-async.el b/helm-async.el
index 9fe680e..2ac93d2 100644
--- a/helm-async.el
+++ b/helm-async.el
@@ -60,10 +60,16 @@ Should take same args as `message'."
:type 'function)
(defcustom helm-async-log-file "/tmp/helm-async.log"
- "Where file errors are printed."
+ "File use to communicate errors from Child Emacs to host Emacs."
:group 'helm-async
:type 'string)
+(defcustom helm-async-be-async t
+ "When non--nil make `dired-create-file' async.
+This allow to turn off async features provided to this package."
+ :group 'helm-async
+ :type 'boolean)
+
(defface helm-async-message
'((t (:foreground "yellow")))
"Face used for mode-line message.")
@@ -194,19 +200,38 @@ ESC or `q' to not overwrite any of the remaining files,
(file-in-directory-p destname from)
(error "Cannot copy `%s' into its subdirectory `%s'"
from to)))
- (push (cons from to) async-fn-list)))))
- (async-start `(lambda ()
- (require 'cl) (require 'dired-aux)
- ,(async-inject-variables helm-async-env-variables-regexp)
- (condition-case err
- (let ((dired-recursive-copies (quote always)))
- (loop for (f . d) in (quote ,async-fn-list)
- do (funcall (quote ,file-creator) f d t)))
- (file-error
- (with-temp-file ,helm-async-log-file
- (insert (format "%S" err)))))
- ,(helm-async-maybe-kill-ftp))
- callback)
+ (if helm-async-be-async
+ (push (cons from to) async-fn-list)
+ (condition-case err
+ (progn
+ (funcall file-creator from to dired-overwrite-confirmed)
+ (if overwrite
+ ;; If we get here, file-creator hasn't been aborted
+ ;; and the old entry (if any) has to be deleted
+ ;; before adding the new entry.
+ (dired-remove-file to))
+ (setq success-count (1+ success-count))
+ (message "%s: %d of %d" operation success-count total)
+ (dired-add-file to actual-marker-char))
+ (file-error ; FILE-CREATOR aborted
+ (progn
+ (push (dired-make-relative from)
+ failures)
+ (dired-log "%s `%s' to `%s' failed:\n%s\n"
+ operation from to err)))))))))
+ (when (and async-fn-list helm-async-be-async)
+ (async-start `(lambda ()
+ (require 'cl) (require 'dired-aux)
+ ,(async-inject-variables helm-async-env-variables-regexp)
+ (condition-case err
+ (let ((dired-recursive-copies (quote always)))
+ (loop for (f . d) in (quote ,async-fn-list)
+ do (funcall (quote ,file-creator) f d t)))
+ (file-error
+ (with-temp-file ,helm-async-log-file
+ (insert (format "%S" err)))))
+ ,(helm-async-maybe-kill-ftp))
+ callback))
(cond
(dired-create-files-failures
(setq failures (nconc failures dired-create-files-failures))
@@ -229,9 +254,15 @@ ESC or `q' to not overwrite any of the remaining files,
(dired-plural-s total))
skipped))
(t
- (helm-async-mode 1)
- (setq helm-async-operation (list operation (length fn-list)))
- (message "%s proceeding asynchronously..." operation)))))
+ (if (and async-fn-list helm-async-be-async)
+ (progn
+ (helm-async-mode 1)
+ (setq helm-async-operation (list operation (length fn-list)))
+ (message "%s proceeding asynchronously..." operation))
+ (message "%s: %s file%s"
+ operation success-count (dired-plural-s success-count))))))
+ (unless helm-async-be-async
+ (dired-move-to-filename)))
(provide 'helm-async)
- [elpa] master 66610f4 026/187: smtpmail-async: Report status to user when done, (continued)
- [elpa] master 66610f4 026/187: smtpmail-async: Report status to user when done, Michael Albinus, 2015/12/30
- [elpa] master b7ec203 021/187: Fix for when async.el is byte-compiled, Michael Albinus, 2015/12/30
- [elpa] master 3f870f5 028/187: Show ops in progress `dired-async-in-process-face', Michael Albinus, 2015/12/30
- [elpa] master 1cec376 030/187: Added async-sandbox, Michael Albinus, 2015/12/30
- [elpa] master 24811ee 027/187: Show full backtraces if `async-debug' is non-nil, Michael Albinus, 2015/12/30
- [elpa] master 15f737f 032/187: Propagate non-zero exit codes as errors, Michael Albinus, 2015/12/30
- [elpa] master eda8d32 035/187: * helm-async.el (dired-create-file): Use quote., Michael Albinus, 2015/12/30
- [elpa] master ec1f0e8 034/187: * helm-async.el: let-bind dired-recursive-copies to 'always to avoid hanging on child., Michael Albinus, 2015/12/30
- [elpa] master acb0885 031/187: Several minor fixes, Michael Albinus, 2015/12/30
- [elpa] master 49f8b81 038/187: * helm-async.el: Update copyright, Michael Albinus, 2015/12/30
- [elpa] master 416c73a 037/187: * helm-async.el (helm-async-be-async): New, allow turning off async.,
Michael Albinus <=
- [elpa] master 2db438b 029/187: dired-async now shows progress using overlays, Michael Albinus, 2015/12/30
- [elpa] master c472c4a 036/187: * helm-async.el Return file errors in child Emacs., Michael Albinus, 2015/12/30
- [elpa] master eb26295 033/187: * helm-async.el: New, redefine dired-create-file to work with helm and dired., Michael Albinus, 2015/12/30
- [elpa] master c35324c 043/187: Async queue handling has to happen in dired-async, Michael Albinus, 2015/12/30
- [elpa] master ac1b896 040/187: Minor touches, Michael Albinus, 2015/12/30
- [elpa] master ad07ff3 039/187: Merge pull request #1 from thierryvolpiatto/master, Michael Albinus, 2015/12/30
- [elpa] master 6941276 046/187: * helm-async.el (helm-async-processes): use process-name., Michael Albinus, 2015/12/30
- [elpa] master 1647b97 047/187: * async.el (async-start): Use the possible true name of emacs executable., Michael Albinus, 2015/12/30
- [elpa] master 9779abc 044/187: Fix github issue 2, Michael Albinus, 2015/12/30
- [elpa] master 96cbe3a 048/187: Fix missing optional arguments when calling `async-copy-file' in `async-dired.el'., Michael Albinus, 2015/12/30