aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2016-09-15 09:24:07 +0200
committerMichael Albinus2016-09-15 09:24:07 +0200
commit3c586e182c0694896dda670f5fc663b46c9bac63 (patch)
treecb821b3e9ce09f9b18cca8d6a0fbea5d1134e127
parent5b6066d942d8463f8944f687a9dca1f61061ef3a (diff)
downloademacs-3c586e182c0694896dda670f5fc663b46c9bac63.tar.gz
emacs-3c586e182c0694896dda670f5fc663b46c9bac63.zip
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-set-connection-property) (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.
-rw-r--r--lisp/net/tramp-cache.el12
-rw-r--r--lisp/net/tramp-cmds.el6
-rw-r--r--lisp/net/tramp.el17
3 files changed, 22 insertions, 13 deletions
diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el
index 43b3ba07708..531044fddfd 100644
--- a/lisp/net/tramp-cache.el
+++ b/lisp/net/tramp-cache.el
@@ -99,8 +99,7 @@ matching entries of `tramp-connection-properties'."
99 (or (nth 0 elt) "") 99 (or (nth 0 elt) "")
100 (tramp-make-tramp-file-name 100 (tramp-make-tramp-file-name
101 (aref key 0) (aref key 1) (aref key 2) nil)) 101 (aref key 0) (aref key 1) (aref key 2) nil))
102 (tramp-set-connection-property key (nth 1 elt) (nth 2 elt)))) 102 (tramp-set-connection-property key (nth 1 elt) (nth 2 elt)))))
103 (tramp-set-connection-property key "active" 'undef))
104 hash))) 103 hash)))
105 104
106;;;###tramp-autoload 105;;;###tramp-autoload
@@ -263,7 +262,6 @@ KEY is a vector."
263 (aset key 3 nil) 262 (aset key 3 nil)
264 (aset key 4 nil)) 263 (aset key 4 nil))
265 (let ((hash (tramp-get-hash-table key))) 264 (let ((hash (tramp-get-hash-table key)))
266 (puthash "active" t hash)
267 (puthash property value hash) 265 (puthash property value hash)
268 (setq tramp-cache-data-changed t) 266 (setq tramp-cache-data-changed t)
269 (tramp-message key 7 "%s %s" property value) 267 (tramp-message key 7 "%s %s" property value)
@@ -333,11 +331,11 @@ properties of the local machine."
333;;;###tramp-autoload 331;;;###tramp-autoload
334(defun tramp-list-connections () 332(defun tramp-list-connections ()
335 "Return a list of all known connection vectors according to `tramp-cache'." 333 "Return a list of all known connection vectors according to `tramp-cache'."
336 (let (result) 334 (let (result tramp-verbose)
337 (maphash 335 (maphash
338 (lambda (key _value) 336 (lambda (key _value)
339 (when (and (vectorp key) (null (aref key 3)) 337 (when (and (vectorp key) (null (aref key 3))
340 (tramp-connection-property-p key "active")) 338 (tramp-connection-property-p key "process-buffer"))
341 (add-to-list 'result key))) 339 (add-to-list 'result key)))
342 tramp-cache-data) 340 tramp-cache-data)
343 result)) 341 result))
@@ -362,7 +360,6 @@ properties of the local machine."
362 (not (tramp-file-name-localname key)) 360 (not (tramp-file-name-localname key))
363 (not (gethash "login-as" value))) 361 (not (gethash "login-as" value)))
364 (progn 362 (progn
365 (remhash "active" value)
366 (remhash "process-name" value) 363 (remhash "process-name" value)
367 (remhash "process-buffer" value) 364 (remhash "process-buffer" value)
368 (remhash "first-password-request" value)) 365 (remhash "first-password-request" value))
@@ -430,8 +427,7 @@ for all methods. Resulting data are derived from connection history."
430 ;; `tramp-connection-properties'. The cache is 427 ;; `tramp-connection-properties'. The cache is
431 ;; initialized properly by side effect. 428 ;; initialized properly by side effect.
432 (unless (tramp-connection-property-p key (car item)) 429 (unless (tramp-connection-property-p key (car item))
433 (tramp-set-connection-property key (pop item) (car item)))) 430 (tramp-set-connection-property key (pop item) (car item))))))
434 (tramp-set-connection-property key "active" 'undef)))
435 (setq tramp-cache-data-changed nil)) 431 (setq tramp-cache-data-changed nil))
436 (file-error 432 (file-error
437 ;; Most likely because the file doesn't exist yet. No message. 433 ;; Most likely because the file doesn't exist yet. No message.
diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el
index 45f30042ad8..d0c49156500 100644
--- a/lisp/net/tramp-cmds.el
+++ b/lisp/net/tramp-cmds.el
@@ -101,8 +101,8 @@ When called interactively, a Tramp connection has to be selected."
101 101
102 ;; Flush connection cache. 102 ;; Flush connection cache.
103 (when (processp (tramp-get-connection-process vec)) 103 (when (processp (tramp-get-connection-process vec))
104 (delete-process (tramp-get-connection-process vec)) 104 (tramp-flush-connection-property (tramp-get-connection-process vec))
105 (tramp-flush-connection-property (tramp-get-connection-process vec))) 105 (delete-process (tramp-get-connection-process vec)))
106 (tramp-flush-connection-property vec) 106 (tramp-flush-connection-property vec)
107 107
108 ;; Remove buffers. 108 ;; Remove buffers.
@@ -384,10 +384,12 @@ please ensure that the buffers are attached to your email.\n\n"))
384;;; TODO: 384;;; TODO:
385 385
386;; * Clean up unused *tramp/foo* buffers after a while. (Pete Forman) 386;; * Clean up unused *tramp/foo* buffers after a while. (Pete Forman)
387;;
387;; * WIBNI there was an interactive command prompting for Tramp 388;; * WIBNI there was an interactive command prompting for Tramp
388;; method, hostname, username and filename and translates the user 389;; method, hostname, username and filename and translates the user
389;; input into the correct filename syntax (depending on the Emacs 390;; input into the correct filename syntax (depending on the Emacs
390;; flavor) (Reiner Steib) 391;; flavor) (Reiner Steib)
392;;
391;; * Let the user edit the connection properties interactively. 393;; * Let the user edit the connection properties interactively.
392;; Something like `gnus-server-edit-server' in Gnus' *Server* buffer. 394;; Something like `gnus-server-edit-server' in Gnus' *Server* buffer.
393 395
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index ad00f31010f..0dade732c46 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1314,6 +1314,7 @@ necessary only. This function will be used in file name completion."
1314 "Get the connection buffer to be used for VEC." 1314 "Get the connection buffer to be used for VEC."
1315 (or (get-buffer (tramp-buffer-name vec)) 1315 (or (get-buffer (tramp-buffer-name vec))
1316 (with-current-buffer (get-buffer-create (tramp-buffer-name vec)) 1316 (with-current-buffer (get-buffer-create (tramp-buffer-name vec))
1317 (tramp-set-connection-property vec "process-buffer" nil)
1317 (setq buffer-undo-list t) 1318 (setq buffer-undo-list t)
1318 (setq default-directory 1319 (setq default-directory
1319 (tramp-make-tramp-file-name 1320 (tramp-make-tramp-file-name
@@ -4306,30 +4307,40 @@ Only works for Bourne-like shells."
4306 4307
4307;; * In Emacs 21, `insert-directory' shows total number of bytes used 4308;; * In Emacs 21, `insert-directory' shows total number of bytes used
4308;; by the files in that directory. Add this here. 4309;; by the files in that directory. Add this here.
4310;;
4309;; * Avoid screen blanking when hitting `g' in dired. (Eli Tziperman) 4311;; * Avoid screen blanking when hitting `g' in dired. (Eli Tziperman)
4312;;
4310;; * Better error checking. At least whenever we see something 4313;; * Better error checking. At least whenever we see something
4311;; strange when doing zerop, we should kill the process and start 4314;; strange when doing zerop, we should kill the process and start
4312;; again. (Greg Stark) 4315;; again. (Greg Stark)
4313;; * Username and hostname completion. 4316;;
4314;; ** Try to avoid usage of `last-input-event' in `tramp-completion-mode-p'.
4315;; * Make `tramp-default-user' obsolete.
4316;; * Implement a general server-local-variable mechanism, as there are 4317;; * Implement a general server-local-variable mechanism, as there are
4317;; probably other variables that need different values for different 4318;; probably other variables that need different values for different
4318;; servers too. The user could then configure a variable (such as 4319;; servers too. The user could then configure a variable (such as
4319;; tramp-server-local-variable-alist) to define any such variables 4320;; tramp-server-local-variable-alist) to define any such variables
4320;; that they need to, which would then be let bound as appropriate 4321;; that they need to, which would then be let bound as appropriate
4321;; in tramp functions. (Jason Rumney) 4322;; in tramp functions. (Jason Rumney)
4323;;
4322;; * Make shadowfile.el grok Tramp filenames. (Bug#4526, Bug#4846) 4324;; * Make shadowfile.el grok Tramp filenames. (Bug#4526, Bug#4846)
4325;;
4323;; * I was wondering if it would be possible to use tramp even if I'm 4326;; * I was wondering if it would be possible to use tramp even if I'm
4324;; actually using sshfs. But when I launch a command I would like 4327;; actually using sshfs. But when I launch a command I would like
4325;; to get it executed on the remote machine where the files really 4328;; to get it executed on the remote machine where the files really
4326;; are. (Andrea Crotti) 4329;; are. (Andrea Crotti)
4330;;
4327;; * Run emerge on two remote files. Bug is described here: 4331;; * Run emerge on two remote files. Bug is described here:
4328;; <http://www.mail-archive.com/tramp-devel@nongnu.org/msg01041.html>. 4332;; <http://www.mail-archive.com/tramp-devel@nongnu.org/msg01041.html>.
4329;; (Bug#6850) 4333;; (Bug#6850)
4334;;
4330;; * Use also port to distinguish connections. This is needed for 4335;; * Use also port to distinguish connections. This is needed for
4331;; different hosts sitting behind a single router (distinguished by 4336;; different hosts sitting behind a single router (distinguished by
4332;; different port numbers). (Tzvi Edelman) 4337;; different port numbers). (Tzvi Edelman)
4338;;
4339;; * Refactor code from different handlers. Start with
4340;; *-process-file. One idea is to generalize `tramp-send-command'
4341;; and friends, for most of the handlers this is the major
4342;; difference between the different backends. Other handlers but
4343;; *-process-file would profit from this as well.
4333 4344
4334;;; tramp.el ends here 4345;;; tramp.el ends here
4335 4346