]> code.delx.au - gnu-emacs-elpa/blobdiff - dired-async.el
When failures have been printed to dired log add the date at bob.
[gnu-emacs-elpa] / dired-async.el
index d97195354e820be70b0f5c55c147027a54d76318..df8ea01d38cdaafbde7e7cee48cd34cecc743569 100644 (file)
@@ -44,7 +44,6 @@
 
 (eval-when-compile
   (defvar async-callback))
-;; (defvar dired-async-operation nil)
 
 (defgroup dired-async nil
   "Copy rename files asynchronously from dired."
@@ -141,13 +140,13 @@ Should take same args as `message'."
                   (funcall dired-async-message-function
                            "%s failed for %d of %d file%s"
                            'dired-async-failures
-                           operation (length failures)
+                           (car operation) (length failures)
                            total (dired-plural-s total)))
                  (skipped
                   (funcall dired-async-message-function
                            "%s: %d of %d file%s skipped"
                            'dired-async-failures
-                           operation (length skipped) total
+                           (car operation) (length skipped) total
                            (dired-plural-s total))))
            ;; Finally send the success message.
            (funcall dired-async-message-function
@@ -226,9 +225,28 @@ ESC or `q' to not overwrite any of the remaining files,
                            (push (cons from to) async-fn-list))
                       (progn
                         (push (dired-make-relative from) failures)
-                        (dired-log "%s `%s' to `%s' failed"
+                        (dired-log "%s `%s' to `%s' failed\n"
                                    operation from to)))
                   (push (cons from to) async-fn-list)))))
+      ;; When failures have been printed to dired log add the date at bob.
+      (when (or failures skipped) (dired-log t))
+      ;; When async-fn-list is empty that's mean only one file
+      ;; had to be copied and user finally answer NO.
+      ;; In this case async process will never start and callback
+      ;; will have no chance to run, so notify failures here.
+      (unless async-fn-list
+        (cond (failures
+               (funcall dired-async-message-function
+                        "%s failed for %d of %d file%s"
+                        'dired-async-failures
+                        operation (length failures)
+                        total (dired-plural-s total)))
+              (skipped
+               (funcall dired-async-message-function
+                        "%s: %d of %d file%s skipped"
+                        'dired-async-failures
+                        operation (length skipped) total
+                        (dired-plural-s total)))))
       ;; Setup callback.
       (setq callback
             (lambda (&optional _ignore)