emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 3e8f948: Suppress timers in tramp-send-string


From: Michael Albinus
Subject: [Emacs-diffs] master 3e8f948: Suppress timers in tramp-send-string
Date: Tue, 2 Apr 2019 09:17:25 -0400 (EDT)

branch: master
commit 3e8f9482fe2288baedd9cc5026e25ffc543683ab
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    Suppress timers in tramp-send-string
    
    * lisp/net/tramp.el (tramp-send-string): Suppress timers.  Use
    `with-local-quit'.
---
 lisp/net/tramp.el | 37 ++++++++++++++++++++++++-------------
 1 file changed, 24 insertions(+), 13 deletions(-)

diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 5b50d39..7206d8e 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -3881,7 +3881,7 @@ of."
       (tramp-check-for-regexp proc tramp-password-prompt-regexp)
       (tramp-message vec 3 "Sending %s" (match-string 1))
       ;; We don't call `tramp-send-string' in order to hide the
-      ;; password from the debug buffer.
+      ;; password from the debug buffer and the traces.
       (process-send-string
        proc (concat (tramp-read-passwd proc) tramp-local-end-of-line))
       ;; Hide password prompt.
@@ -4171,12 +4171,20 @@ The STRING is expected to use Unix line-endings, but 
the lines sent to
 the remote host use line-endings as defined in the variable
 `tramp-rsh-end-of-line'.  The communication buffer is erased before sending."
   (let* ((p (tramp-get-connection-process vec))
-        (chunksize (tramp-get-connection-property p "chunksize" nil)))
+        (chunksize (tramp-get-connection-property p "chunksize" nil))
+        ;; We do not want to run timers.
+        (tl timer-list)
+         (stimers (with-timeout-suspend))
+        timer-list timer-idle-list)
     (unless p
       (tramp-error
        vec 'file-error "Can't send string to remote host -- not logged in"))
     (tramp-set-connection-property p "last-cmd-time" (current-time))
     (tramp-message vec 10 "%s" string)
+    ;; Enable our progress reporter.
+    (dolist (timer tl)
+      (if (eq (timer--function timer) #'tramp-progress-reporter-update)
+          (push timer timer-list)))
     (with-current-buffer (tramp-get-connection-buffer vec)
       ;; Clean up the buffer.  We cannot call `erase-buffer' because
       ;; narrowing might be in effect.
@@ -4189,17 +4197,20 @@ the remote host use line-endings as defined in the 
variable
                  (string-equal (substring string -1) tramp-rsh-end-of-line))
        (setq string (concat string tramp-rsh-end-of-line)))
       ;; Send the string.
-      (if (and chunksize (not (zerop chunksize)))
-         (let ((pos 0)
-               (end (length string)))
-           (while (< pos end)
-             (tramp-message
-              vec 10 "Sending chunk from %s to %s"
-              pos (min (+ pos chunksize) end))
-             (process-send-string
-              p (substring string pos (min (+ pos chunksize) end)))
-             (setq pos (+ pos chunksize))))
-       (process-send-string p string)))))
+      (with-local-quit
+       (if (and chunksize (not (zerop chunksize)))
+           (let ((pos 0)
+                 (end (length string)))
+             (while (< pos end)
+               (tramp-message
+                vec 10 "Sending chunk from %s to %s"
+                pos (min (+ pos chunksize) end))
+               (process-send-string
+                p (substring string pos (min (+ pos chunksize) end)))
+               (setq pos (+ pos chunksize))))
+         (process-send-string p string)))
+      ;; Reenable the timers.
+      (with-timeout-unsuspend stimers))))
 
 (defun tramp-get-inode (vec)
   "Returns the virtual inode number.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]