diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index dbd13183a92..32fd1888d36 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el @@ -1250,7 +1250,10 @@ connection if a previous connection has died for some reason." ;; Read the expression. (goto-char (point-min)) (read (current-buffer))) - ":" 'omit-nulls)))))))) + ":" 'omit-nulls)) + + ;; Mark it as connected. + (tramp-set-connection-property p "connected" t))))))) (add-hook 'tramp-unload-hook (lambda () diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index e19ceae89da..dee8333e547 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el @@ -1617,7 +1617,11 @@ connection if a previous connection has died for some reason." ;; is marked with the fuse-mountpoint "/". We shall react. (when (string-equal (tramp-get-file-property vec "/" "fuse-mountpoint" "") "/") - (tramp-error vec 'file-error "FUSE mount denied"))))) + (tramp-error vec 'file-error "FUSE mount denied")) + + ;; Mark it as connected. + (tramp-set-connection-property + (tramp-get-connection-process vec) "connected" t)))) ;; In `tramp-check-cached-permissions', the connection properties ;; {uig,gid}-{integer,string} are used. We set them to their local diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 7ace8864f88..1f43747c094 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -5040,7 +5040,10 @@ connection if a previous connection has died for some reason." target-alist (cdr target-alist))) ;; Make initial shell settings. - (tramp-open-connection-setup-interactive-shell p vec))))) + (tramp-open-connection-setup-interactive-shell p vec) + + ;; Mark it as connected. + (tramp-set-connection-property p "connected" t))))) ;; When the user did interrupt, we must cleanup. (quit diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index e957fdfd612..509e2e388b8 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el @@ -1914,7 +1914,10 @@ If ARGUMENT is non-nil, use it as argument for ;; character by character; if we send the string ;; at once, it is read painfully slow. (tramp-set-connection-property p "smb-share" share) - (tramp-set-connection-property p "chunksize" 1)) + (tramp-set-connection-property p "chunksize" 1) + + ;; Mark it as connected. + (tramp-set-connection-property p "connected" t)) ;; Check for the error reason. If it was due to wrong ;; password, reestablish the connection. We cannot diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index e8e40ae23dc..43962169d5a 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -3009,7 +3009,8 @@ User is always nil." (when (tramp-tramp-file-p filename) (let* ((v (tramp-dissect-file-name filename)) (p (tramp-get-connection-process v)) - (c (and p (processp p) (memq (process-status p) '(run open))))) + (c (and p (processp p) (memq (process-status p) '(run open)) + (tramp-get-connection-property p "connected" nil)))) ;; We expand the file name only, if there is already a connection. (with-parsed-tramp-file-name (if c (expand-file-name filename) filename) nil