branch: master
commit 9a82294528eb8752898ab6c130ec575db11ab687
Author: Thierry Volpiatto <thierry.volpia...@gmail.com>
Commit: Thierry Volpiatto <thierry.volpia...@gmail.com>

    DRY use apply.
    
    * dired-async.el (dired-async-after-file-create): Do it.
    (dired-async-create-files):                       Do it.
---
 dired-async.el |   46 ++++++++++++++++++++++------------------------
 1 file changed, 22 insertions(+), 24 deletions(-)

diff --git a/dired-async.el b/dired-async.el
index c18ec53..1865eda 100644
--- a/dired-async.el
+++ b/dired-async.el
@@ -137,18 +137,17 @@ Should take same args as `message'."
          0.1 nil
          (lambda ()
            ;; First send error messages.
-           (cond (failures
-                  (funcall dired-async-message-function
-                           "%s failed for %d of %d file%s"
-                           'dired-async-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
-                           (car operation) (length skipped) total
-                           (dired-plural-s total))))
+           (apply dired-async-message-function
+                  (cond (failures
+                         (list "%s failed for %d of %d file%s"
+                               'dired-async-failures
+                               (car operation) (length failures)
+                               total (dired-plural-s total)))
+                        (skipped
+                         (list "%s: %d of %d file%s skipped"
+                               'dired-async-failures
+                               (car operation) (length skipped) total
+                               (dired-plural-s total)))))
            ;; Finally send the success message.
            (funcall dired-async-message-function
                     "Asynchronous %s of %s file(s) on %s file(s) done"
@@ -234,18 +233,17 @@ ESC or `q' to not overwrite any of the remaining files,
       ;; 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)))))
+        (apply dired-async-message-function
+               (cond (failures
+                      (list "%s failed for %d of %d file%s"
+                            'dired-async-failures
+                            operation (length failures)
+                            total (dired-plural-s total)))
+                     (skipped
+                      (list "%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)

Reply via email to