changeset 85943:85b6f7d4aca8

* net/tramp.el (top): Don't autoload `tramp-cache-print'. * net/tramp-cache (tramp-cache-print): Move down. (tramp-cache-list-connections): New defun. * net/tramp-cmds.el (tramp-cleanup-connection): Use it.
author Michael Albinus <michael.albinus@gmx.de>
date Tue, 06 Nov 2007 21:17:36 +0000
parents bed8827b7f62
children 69f410562c03
files lisp/ChangeLog lisp/net/tramp-cache.el lisp/net/tramp-cmds.el lisp/net/tramp.el
diffstat 4 files changed, 45 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Tue Nov 06 12:32:16 2007 +0000
+++ b/lisp/ChangeLog	Tue Nov 06 21:17:36 2007 +0000
@@ -1,3 +1,12 @@
+2007-11-06  Michael Albinus  <michael.albinus@gmx.de>
+
+	* net/tramp.el (top): Don't autoload `tramp-cache-print'.
+
+	* net/tramp-cache (tramp-cache-print): Move down.
+	(tramp-cache-list-connections): New defun.
+
+	* net/tramp-cmds.el (tramp-cleanup-connection): Use it.
+
 2007-11-06  Juanma Barranquero  <lekktu@gmail.com>
 
 	* ido.el (ido-save-history): Write the history file in the current
--- a/lisp/net/tramp-cache.el	Tue Nov 06 12:32:16 2007 +0000
+++ b/lisp/net/tramp-cache.el	Tue Nov 06 21:17:36 2007 +0000
@@ -138,26 +138,6 @@
 	  (remhash key tramp-cache-data)))
      tramp-cache-data)))
 
-(defun tramp-cache-print (table)
-  "Prints hash table TABLE."
-  (when (hash-table-p table)
-    (let (result)
-      (maphash
-       '(lambda (key value)
-	  (let ((tmp (format
-		      "(%s %s)"
-		      (if (processp key)
-			  (prin1-to-string (prin1-to-string key))
-			(prin1-to-string key))
-		      (if (hash-table-p value)
-			  (tramp-cache-print value)
-			(if (bufferp value)
-			    (prin1-to-string (prin1-to-string value))
-			  (prin1-to-string value))))))
-	    (setq result (if result (concat result " " tmp) tmp))))
-       table)
-      result)))
-
 ;; Reverting or killing a buffer should also flush file properties.
 ;; They could have been changed outside Tramp.  In eshell, "ls" would
 ;; not show proper directory contents when a file has been copied or
@@ -236,6 +216,36 @@
 ;  (tramp-message key 7 "%s" event)
   (remhash key tramp-cache-data))
 
+(defun tramp-cache-print (table)
+  "Prints hash table TABLE."
+  (when (hash-table-p table)
+    (let (result)
+      (maphash
+       '(lambda (key value)
+	  (let ((tmp (format
+		      "(%s %s)"
+		      (if (processp key)
+			  (prin1-to-string (prin1-to-string key))
+			(prin1-to-string key))
+		      (if (hash-table-p value)
+			  (tramp-cache-print value)
+			(if (bufferp value)
+			    (prin1-to-string (prin1-to-string value))
+			  (prin1-to-string value))))))
+	    (setq result (if result (concat result " " tmp) tmp))))
+       table)
+      result)))
+
+(defun tramp-cache-list-connections ()
+  "Return a list of all known connection vectors."
+    (let (result)
+      (maphash
+       '(lambda (key value)
+	  (when (and (vectorp key) (null (aref key 3)))
+	    (add-to-list 'result key)))
+       tramp-cache-data)
+      result))
+
 (defun tramp-dump-connection-properties ()
 "Writes persistent connection properties into file
 `tramp-persistency-file-name'."
--- a/lisp/net/tramp-cmds.el	Tue Nov 06 12:32:16 2007 +0000
+++ b/lisp/net/tramp-cmds.el	Tue Nov 06 21:17:36 2007 +0000
@@ -61,12 +61,12 @@
     (let ((connections
 	   (mapcar
 	    (lambda (x)
-	      (with-current-buffer x (list (file-remote-p default-directory))))
-	    ;; We shall not count debug buffers, because their
-	    ;; default-directory is random.  It could be even a remote
-	    ;; one from another connection.
-	    (all-completions
-	     "*tramp" (mapcar 'list (tramp-list-tramp-buffers)))))
+	      (tramp-make-tramp-file-name
+	       (tramp-file-name-method x)
+	       (tramp-file-name-user x)
+	       (tramp-file-name-host x)
+	       (tramp-file-name-localname x)))
+	    (tramp-cache-list-connections)))
 	  name)
 
       (when connections
--- a/lisp/net/tramp.el	Tue Nov 06 12:32:16 2007 +0000
+++ b/lisp/net/tramp.el	Tue Nov 06 21:17:36 2007 +0000
@@ -93,7 +93,6 @@
 (autoload 'tramp-set-file-property "tramp-cache")
 (autoload 'tramp-flush-file-property "tramp-cache")
 (autoload 'tramp-flush-directory-property "tramp-cache")
-(autoload 'tramp-cache-print "tramp-cache")
 (autoload 'tramp-get-connection-property "tramp-cache")
 (autoload 'tramp-set-connection-property "tramp-cache")
 (autoload 'tramp-flush-connection-property "tramp-cache")