changeset 74682:3a25d9542e47

* net/tramp.el (tramp-default-method): Before setting to "pscp", check whether package password.el is loaded, or Pageant is running.
author Michael Albinus <michael.albinus@gmx.de>
date Sun, 17 Dec 2006 12:58:04 +0000
parents fa19b82ca7d3
children f1038333001f
files lisp/ChangeLog lisp/net/tramp.el
diffstat 2 files changed, 32 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sun Dec 17 11:54:10 2006 +0000
+++ b/lisp/ChangeLog	Sun Dec 17 12:58:04 2006 +0000
@@ -1,3 +1,8 @@
+2006-12-17  Michael Albinus  <michael.albinus@gmx.de>
+
+	* net/tramp.el (tramp-default-method): Before setting to "pscp",
+	check whether package password.el is loaded, or Pageant is running.
+
 2006-12-17  Ulf Jasper  <ulf.jasper@web.de>
 
 	* calendar/icalendar.el (icalendar-version): Increase to "0.14".
--- a/lisp/net/tramp.el	Sun Dec 17 11:54:10 2006 +0000
+++ b/lisp/net/tramp.el	Sun Dec 17 12:58:04 2006 +0000
@@ -684,10 +684,33 @@
   :type '(repeat (list string function string)))
 
 (defcustom tramp-default-method
-  (if (and (fboundp 'executable-find)
-	   (executable-find "pscp"))
-      "pscp"
-    "scp")
+  (or
+   ;; An external copy method seems to be preferred, because it is
+   ;; much more performant for large files, and it hasn't too serious
+   ;; delays for small files.  But it must be ensured that there
+   ;; aren't permanent password queries.  Either the copy method shall
+   ;; reuse other channels (ControlMaster of OpenSSH does it), a
+   ;; password agent like "ssh-agent" or "Pageant" shall run, or the
+   ;; optional password.el package shall be active for password caching.
+   (and (fboundp 'executable-find)
+	;; Check whether PuTTY is installed.
+	(executable-find "pscp")
+	(if (or
+	     ;; password.el is loaded.
+	     (fboundp 'password-read)
+	     ;; Pageant is running.
+	     (and (fboundp 'w32-window-exists-p)
+		  (funcall (symbol-function 'w32-window-exists-p)
+			   "Pageant" "Pageant")))
+	    ;; We know that the password will not be retrieved again.
+	    "pscp"
+	  ;; When "pscp" exists, there is also "plink".
+	  "plink"))
+   ;; Under UNIX, ControlMaster is activated.  This does not work
+   ;; under Cygwin, but ssh-agent must be enabled then anyway due to
+   ;; the pseudo-tty problem of Cygwin's OpenSSH implementation.  So
+   ;; it doesn't hurt to use "scp".
+   "scp")
   "*Default method to use for transferring files.
 See `tramp-methods' for possibilities.
 Also see `tramp-default-method-alist'."