(when operation
(if (file-exists-p dired-async-log-file)
(progn
- (pop-to-buffer (get-buffer-create "*dired async*"))
- (erase-buffer)
+ (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
(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
(when (string= (downcase operation) "rename")
(cl-loop for (file . to) in async-fn-list
for bf = (get-file-buffer file)
- do (and bf (with-current-buffer bf
- (set-visited-file-name to nil t))))))))
+ for destp = (file-exists-p to)
+ do (and bf destp
+ (with-current-buffer bf
+ (set-visited-file-name to nil t))))))))
;; Start async process.
(when async-fn-list
(async-start `(lambda ()
(condition-case err
(copy-file from to ok dired-copy-preserve-time)
(file-date-error
- (push (dired-make-relative from)
- dired-create-files-failures)
(dired-log "Can't set date on %s:\n%s\n" from err)))))))
;; Now run the FILE-CREATOR function on files.
(cl-loop with fn = (quote ,file-creator)
for (from . dest) in (quote ,async-fn-list)
do (funcall fn from dest t)))
(file-error
- (with-temp-file ,dired-async-log-file
- (insert (format "%S" err)))))
+ (dired-log "%s: %s\n" (car err) (cdr err))
+ (dired-log t)
+ (with-current-buffer dired-log-buffer
+ (write-region (point-min) (point-max)
+ ,dired-async-log-file))))
,(dired-async-maybe-kill-ftp))
callback)
;; Run mode-line notifications while process running.