Function: with-tramp-progress-reporter
with-tramp-progress-reporter is a macro defined in tramp.el.gz.
Signature
(with-tramp-progress-reporter VEC LEVEL MESSAGE &rest BODY)
Documentation
Execute BODY, spinning a progress reporter with MESSAGE in interactive mode.
If LEVEL does not fit for visible messages, there are only traces without a visible progress reporter.
Source Code
;; Defined in /usr/src/emacs/lisp/net/tramp.el.gz
(defmacro with-tramp-progress-reporter (vec level message &rest body)
"Execute BODY, spinning a progress reporter with MESSAGE in interactive mode.
If LEVEL does not fit for visible messages, there are only traces
without a visible progress reporter."
(declare (indent 3) (debug t))
`(if (or noninteractive inhibit-message)
(progn ,@body)
(tramp-message ,vec ,level "%s..." ,message)
(let ((cookie "failed")
(tm
;; We start a pulsing progress reporter after 3 seconds.
;; Start only when there is no other progress reporter
;; running, and when there is a minimum level.
(when-let* ((pr (and (null tramp-inhibit-progress-reporter)
(<= ,level (min tramp-verbose 3))
(make-progress-reporter ,message))))
(run-at-time 3 0.1 #'tramp-progress-reporter-update pr))))
(unwind-protect
;; Execute the body.
(prog1
;; Suppress concurrent progress reporter messages.
(let ((tramp-inhibit-progress-reporter
(or tramp-inhibit-progress-reporter tm)))
,@body)
(setq cookie "done"))
;; Stop progress reporter.
(if tm (cancel-timer tm))
(tramp-message ,vec ,level "%s...%s" ,message cookie)))))