emacs-diffs
[Top][All Lists]
Advanced

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

master 0939465300: Tramp code cleanup


From: Michael Albinus
Subject: master 0939465300: Tramp code cleanup
Date: Tue, 21 Jun 2022 08:59:55 -0400 (EDT)

branch: master
commit 0939465300f7c80f110c8596c0388f555619ea62
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>

    Tramp code cleanup
    
    * lisp/net/tramp-adb.el (tramp-adb-handle-make-process):
    * lisp/net/tramp-sh.el (tramp-sh-handle-make-process):
    Improve handling of "process-name" and "process-buffer" connection
    properties.
---
 lisp/net/tramp-adb.el |  3 +--
 lisp/net/tramp-sh.el  | 34 +++++++++++++++++++---------------
 2 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index ebcdf00c48..9981cc3c13 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -1048,8 +1048,7 @@ implementation will be used."
                    ;; Save exit.
                    (if (string-prefix-p tramp-temp-buffer-name (buffer-name))
                        (ignore-errors
-                         (set-process-buffer
-                          (tramp-get-connection-process v) nil)
+                         (set-process-buffer p nil)
                          (kill-buffer (current-buffer)))
                      (set-buffer-modified-p bmp))))))))))))
 
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index eccc15efe7..f2e91a1977 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -2977,13 +2977,13 @@ implementation will be used."
                    name1 (format "%s<%d>" name i)))
            (setq name name1)
 
-           (with-current-buffer (tramp-get-connection-buffer v)
-             (unwind-protect
-                 (with-tramp-saved-connection-property v "process-name"
-                   (with-tramp-saved-connection-property v "process-buffer"
-                     ;; Set the new process properties.
-                     (tramp-set-connection-property v "process-name" name)
-                     (tramp-set-connection-property v "process-buffer" buffer)
+           (with-tramp-saved-connection-property v "process-name"
+             (with-tramp-saved-connection-property v "process-buffer"
+               ;; Set the new process properties.
+               (tramp-set-connection-property v "process-name" name)
+               (tramp-set-connection-property v "process-buffer" buffer)
+               (with-current-buffer (tramp-get-connection-buffer v)
+                 (unwind-protect
                      ;; We catch this event.  Otherwise,
                      ;; `make-process' could be called on the local
                      ;; host.
@@ -3049,6 +3049,10 @@ implementation will be used."
                            (ignore-errors
                              (set-process-query-on-exit-flag p (null noquery))
                              (set-marker (process-mark p) (point)))
+                           ;; We must flush them here already;
+                           ;; otherwise `delete-file' will fail.
+                           (tramp-flush-connection-property v "process-name")
+                           (tramp-flush-connection-property v "process-buffer")
                            ;; Kill stderr process and delete named pipe.
                            (when (bufferp stderr)
                              (add-function
@@ -3061,14 +3065,14 @@ implementation will be used."
                                 (ignore-errors
                                   (delete-file remote-tmpstderr)))))
                            ;; Return process.
-                           p)))))
-
-               ;; Save exit.
-               (if (string-prefix-p tramp-temp-buffer-name (buffer-name))
-                   (ignore-errors
-                     (set-process-buffer p nil)
-                     (kill-buffer (current-buffer)))
-                 (set-buffer-modified-p bmp))))))))))
+                           p)))
+
+                   ;; Save exit.
+                   (if (string-prefix-p tramp-temp-buffer-name (buffer-name))
+                       (ignore-errors
+                         (set-process-buffer p nil)
+                         (kill-buffer (current-buffer)))
+                     (set-buffer-modified-p bmp))))))))))))
 
 (defun tramp-sh-get-signal-strings (vec)
   "Strings to return by `process-file' in case of signals."



reply via email to

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