Function: dired-async-after-file-create

dired-async-after-file-create is a natively compiled function defined in dired-async.el.

Signature

(dired-async-after-file-create TOTAL OPERATION FAILURES SKIPPED)

Documentation

Callback function used for operation handled by dired-create-file.

Source Code

;; Defined in /nix/store/jhxqyr2zk061dl3wd3vm38lw3zin47b9-emacs-packages-deps/share/emacs/site-lisp/elpa/async-20260729.1431/dired-async.el
(defun dired-async-after-file-create (total operation failures skipped)
  "Callback function used for operation handled by `dired-create-file'."
  (unless (dired-async-processes)
    ;; Turn off mode-line notification
    ;; only when last process end.
    (dired-async--modeline-mode -1))
  (when operation
    (if (file-exists-p dired-async-log-file)
        (progn
          (pop-to-buffer (get-buffer-create dired-log-buffer))
          (goto-char (point-max))
          (setq inhibit-read-only t)
          (insert "Error: ")
          (insert-file-contents dired-async-log-file)
          (special-mode)
          (shrink-window-if-larger-than-buffer)
          (delete-file dired-async-log-file))
      (run-with-timer
       0.1 nil
       (lambda ()
         ;; First send error messages.
         (cond (failures
                (funcall dired-async-message-function
                         "%s failed for %d of %d file%s -- See *Dired log* buffer"
                         '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 -- See *Dired log* buffer"
                         'dired-async-failures
                         (car operation) (length skipped) total
                         (dired-plural-s total))))
         (when dired-buffers
           (cl-loop for (_f . b) in dired-buffers
                    when (buffer-live-p b)
                    do (with-current-buffer b
                         (when (and (not (file-remote-p default-directory nil t))
                                    (file-exists-p default-directory))
                           (revert-buffer nil t)))))
         ;; Finally send the success message.
         (funcall dired-async-message-function
                  "Asynchronous %s of %s on %s file%s done"
                  'dired-async-message
                  (car operation) (cadr operation)
                  total (dired-plural-s total)))))))