Commit 3c586e18 authored by Michael Albinus's avatar Michael Albinus
Browse files

Rework fixing Bug#24432

* lisp/net/tramp.el (tramp-get-buffer): Set connection property
"process-buffer" in order to mark connection as active.

* lisp/net/tramp-cache.el (tramp-get-hash-table)
(tramp-dump-connection-properties): Do not use "active" property.
(tramp-list-connections): Use "process-buffer" property.

* lisp/net/tramp-cmds.el (tramp-cleanup-connection): Flush process
properties prior deletion of process.
parent 5b6066d9
......@@ -99,8 +99,7 @@ matching entries of `tramp-connection-properties'."
(or (nth 0 elt) "")
(aref key 0) (aref key 1) (aref key 2) nil))
(tramp-set-connection-property key (nth 1 elt) (nth 2 elt))))
(tramp-set-connection-property key "active" 'undef))
(tramp-set-connection-property key (nth 1 elt) (nth 2 elt)))))
......@@ -263,7 +262,6 @@ KEY is a vector."
(aset key 3 nil)
(aset key 4 nil))
(let ((hash (tramp-get-hash-table key)))
(puthash "active" t hash)
(puthash property value hash)
(setq tramp-cache-data-changed t)
(tramp-message key 7 "%s %s" property value)
......@@ -333,11 +331,11 @@ properties of the local machine."
(defun tramp-list-connections ()
"Return a list of all known connection vectors according to `tramp-cache'."
(let (result)
(let (result tramp-verbose)
(lambda (key _value)
(when (and (vectorp key) (null (aref key 3))
(tramp-connection-property-p key "active"))
(tramp-connection-property-p key "process-buffer"))
(add-to-list 'result key)))
......@@ -362,7 +360,6 @@ properties of the local machine."
(not (tramp-file-name-localname key))
(not (gethash "login-as" value)))
(remhash "active" value)
(remhash "process-name" value)
(remhash "process-buffer" value)
(remhash "first-password-request" value))
......@@ -430,8 +427,7 @@ for all methods. Resulting data are derived from connection history."
;; `tramp-connection-properties'. The cache is
;; initialized properly by side effect.
(unless (tramp-connection-property-p key (car item))
(tramp-set-connection-property key (pop item) (car item))))
(tramp-set-connection-property key "active" 'undef)))
(tramp-set-connection-property key (pop item) (car item))))))
(setq tramp-cache-data-changed nil))
;; Most likely because the file doesn't exist yet. No message.
......@@ -101,8 +101,8 @@ When called interactively, a Tramp connection has to be selected."
;; Flush connection cache.
(when (processp (tramp-get-connection-process vec))
(delete-process (tramp-get-connection-process vec))
(tramp-flush-connection-property (tramp-get-connection-process vec)))
(tramp-flush-connection-property (tramp-get-connection-process vec))
(delete-process (tramp-get-connection-process vec)))
(tramp-flush-connection-property vec)
;; Remove buffers.
......@@ -384,10 +384,12 @@ please ensure that the buffers are attached to your email.\n\n"))
;;; TODO:
;; * Clean up unused *tramp/foo* buffers after a while. (Pete Forman)
;; * WIBNI there was an interactive command prompting for Tramp
;; method, hostname, username and filename and translates the user
;; input into the correct filename syntax (depending on the Emacs
;; flavor) (Reiner Steib)
;; * Let the user edit the connection properties interactively.
;; Something like `gnus-server-edit-server' in Gnus' *Server* buffer.
......@@ -1314,6 +1314,7 @@ necessary only. This function will be used in file name completion."
"Get the connection buffer to be used for VEC."
(or (get-buffer (tramp-buffer-name vec))
(with-current-buffer (get-buffer-create (tramp-buffer-name vec))
(tramp-set-connection-property vec "process-buffer" nil)
(setq buffer-undo-list t)
(setq default-directory
......@@ -4306,30 +4307,40 @@ Only works for Bourne-like shells."
;; * In Emacs 21, `insert-directory' shows total number of bytes used
;; by the files in that directory. Add this here.
;; * Avoid screen blanking when hitting `g' in dired. (Eli Tziperman)
;; * Better error checking. At least whenever we see something
;; strange when doing zerop, we should kill the process and start
;; again. (Greg Stark)
;; * Username and hostname completion.
;; ** Try to avoid usage of `last-input-event' in `tramp-completion-mode-p'.
;; * Make `tramp-default-user' obsolete.
;; * Implement a general server-local-variable mechanism, as there are
;; probably other variables that need different values for different
;; servers too. The user could then configure a variable (such as
;; tramp-server-local-variable-alist) to define any such variables
;; that they need to, which would then be let bound as appropriate
;; in tramp functions. (Jason Rumney)
;; * Make shadowfile.el grok Tramp filenames. (Bug#4526, Bug#4846)
;; * I was wondering if it would be possible to use tramp even if I'm
;; actually using sshfs. But when I launch a command I would like
;; to get it executed on the remote machine where the files really
;; are. (Andrea Crotti)
;; * Run emerge on two remote files. Bug is described here:
;; <>.
;; (Bug#6850)
;; * Use also port to distinguish connections. This is needed for
;; different hosts sitting behind a single router (distinguished by
;; different port numbers). (Tzvi Edelman)
;; * Refactor code from different handlers. Start with
;; *-process-file. One idea is to generalize `tramp-send-command'
;; and friends, for most of the handlers this is the major
;; difference between the different backends. Other handlers but
;; *-process-file would profit from this as well.
;;; tramp.el ends here
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment