emacs-31 0448b4e09af 1/3: Backport: Fix 'with-tramp-progress-reporter' (bug#81455)

Michael Albinus via Mailing list for Emacs changes <[email protected]> Fri, 24 Jul 2026 10:37:55 -0400 (EDT)
Newsgroups gmane.emacs.diffs
Message-ID <[email protected]>
branch: emacs-31
commit 0448b4e09af24606fd807b1d8bbf852459e7d2e1
Author: Stéphane Marks <[email protected]>
Commit: Michael Albinus <[email protected]>

    Backport: Fix 'with-tramp-progress-reporter' (bug#81455)
    
    Clear stateful progress reporters like 'system-taskbar'.
    
    * lisp/net/tramp.el (with-tramp-progress-reporter): Call
    'progress-reporter-done' in 'unwind-protect'.
    
    (cherry picked from commit 1f9a492aeace12c0e49cf8ac3e0b09fb8a82ddb3)
---
 lisp/net/tramp.el | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 41dcffd8b19..b461f8b3cd1 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -2235,15 +2235,16 @@ without a visible progress reporter."
   `(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))))
+     (let* ((cookie "failed")
+            (pr (and (null tramp-inhibit-progress-reporter)
+		     (<= ,level (min tramp-verbose 3))
+		     (make-progress-reporter ,message)))
+            (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 pr
+	       (run-at-time 3 0.1 #'tramp-progress-reporter-update pr))))
        (unwind-protect
            ;; Execute the body.
            (prog1
@@ -2253,7 +2254,8 @@ without a visible progress reporter."
 		 ,@body)
 	     (setq cookie "done"))
          ;; Stop progress reporter.
-         (if tm (cancel-timer tm))
+         (when tm (cancel-timer tm))
+         (when pr (progress-reporter-done pr))
          (tramp-message ,vec ,level "%s...%s" ,message cookie)))))
 
 (defmacro with-tramp-timeout (list &rest body)