]> git.eshelyaron.com Git - emacs.git/commitdiff
(tramp-default-method): Under Windows, change from plink to pscp.
authorLars Hansen <larsh@soem.dk>
Fri, 24 Nov 2006 19:14:46 +0000 (19:14 +0000)
committerLars Hansen <larsh@soem.dk>
Fri, 24 Nov 2006 19:14:46 +0000 (19:14 +0000)
(tramp-copy-failed-regexp, tramp-action-copy-failed): Add.
(tramp-actions-copy-out-of-band): Add pair (tramp-copy-failed-regexp tramp-action-copy-failed).
(tramp-action-out-of-band): Move "Permission denied" handling to tramp-action-copy-failed.
(tramp-do-copy-or-rename-file-out-of-band): unwind-protect killing of process buffer.

lisp/ChangeLog
lisp/net/tramp.el

index c5f0c9aa9bb8db69f16fecb7db08925e26866acd..9a4c4001f297de1bc0c330994d1f5f90bc0c16aa 100644 (file)
@@ -1,3 +1,14 @@
+2006-11-24  Lars Hansen  <larsh@soem.dk>
+       * net/tramp.el (tramp-default-method): Under Windows, change from
+       plink to pscp.
+       (tramp-copy-failed-regexp, tramp-action-copy-failed): Add.
+       (tramp-actions-copy-out-of-band): Add pair (tramp-copy-failed-regexp
+       tramp-action-copy-failed).
+       (tramp-action-out-of-band): Move "Permission denied" handling to
+       tramp-action-copy-failed.
+       (tramp-do-copy-or-rename-file-out-of-band): unwind-protect killing of
+       process buffer.
+
 2006-11-24  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * pgg-pgp.el (pgg-pgp-process-region): Change `args' from a list of
index 3c6733e6dfac8c8e7c246d4e346ce1e39d916cb4..1ee7ca03dc5e1d5bb165522f656a66108cc53b05 100644 (file)
@@ -673,8 +673,8 @@ various functions for details."
 
 (defcustom tramp-default-method
   (if (and (fboundp 'executable-find)
-          (executable-find "plink"))
-      "plink"
+          (executable-find "pscp"))
+      "pscp"
     "scp")
   "*Default method to use for transferring files.
 See `tramp-methods' for possibilities.
@@ -943,6 +943,17 @@ be ignored safely."
   :group 'tramp
   :type 'regexp)
 
+(defcustom tramp-copy-failed-regexp
+  (concat "\\(.+: "
+          (regexp-opt '("Permission denied"
+                        "not a regular file"
+                        "is a directory"
+                        "No such file or directory") t)
+          "\\)\\s-*")
+  "Regular expression matching copy problems in (s)cp operations."
+  :group 'tramp
+  :type 'regexp)
+
 (defcustom tramp-process-alive-regexp
   ""
   "Regular expression indicating a process has finished.
@@ -1340,6 +1351,7 @@ corresponding PATTERN matches, the ACTION function is called."
 (defcustom tramp-actions-copy-out-of-band
   '((tramp-password-prompt-regexp tramp-action-password)
     (tramp-wrong-passwd-regexp tramp-action-permission-denied)
+    (tramp-copy-failed-regexp tramp-action-copy-failed)
     (tramp-process-alive-regexp tramp-action-out-of-band))
   "List of pattern/action pairs.
 This list is used for copying/renaming with out-of-band methods.
@@ -3174,12 +3186,13 @@ be a local filename.  The method used must be an out-of-band method."
       (message "Transferring %s to %s..." filename newname)
 
       ;; Use rcp-like program for file transfer.
-      (let ((p (apply 'start-process (buffer-name trampbuf) trampbuf
-                     copy-program copy-args)))
-       (tramp-set-process-query-on-exit-flag p nil)
-       (tramp-process-actions p multi-method method user host
-                              tramp-actions-copy-out-of-band))
-      (kill-buffer trampbuf)
+      (unwind-protect
+          (let ((p (apply 'start-process (buffer-name trampbuf) trampbuf
+                          copy-program copy-args)))
+            (tramp-set-process-query-on-exit-flag p nil)
+            (tramp-process-actions p multi-method method user host
+                                   tramp-actions-copy-out-of-band))
+        (kill-buffer trampbuf))
       (message "Transferring %s to %s...done" filename newname)
 
       ;; Set the mode.
@@ -5353,6 +5366,11 @@ Returns nil if none was found, else the command is returned."
   (kill-process p)
   (throw 'tramp-action 'permission-denied))
 
+(defun tramp-action-copy-failed (p multi-method method user host)
+  "Signal copy failed."
+  (kill-process p)
+  (error "%s" (match-string 1)))
+
 (defun tramp-action-yesno (p multi-method method user host)
   "Ask the user for confirmation using `yes-or-no-p'.
 Send \"yes\" to remote process on confirmation, abort otherwise.
@@ -5409,9 +5427,6 @@ The terminal type can be configured with `tramp-terminal-type'."
               (tramp-message 10 "'set mode' error ignored.")
               (tramp-message 9 "Process has finished.")
               (throw 'tramp-action 'ok))
-          (goto-char (point-min))
-          (when (re-search-forward "^.cp.?: \\(.+: Permission denied.?\\)$" nil t)
-            (error "Remote host: %s" (match-string 1)))
           (tramp-message 9 "Process has died.")
           (throw 'tramp-action 'process-died)))
        (t nil)))