From: Michael Albinus Date: Tue, 21 Jun 2022 12:59:46 +0000 (+0200) Subject: Tramp code cleanup X-Git-Tag: emacs-29.0.90~1447^2~1563 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=0939465300f7c80f110c8596c0388f555619ea62;p=emacs.git 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. --- diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index ebcdf00c488..9981cc3c138 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 eccc15efe76..f2e91a1977e 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."