diff lisp/net/tramp-fish.el @ 81938:26330ef1aa46

* net/tramp.el (tramp-handle-file-remote-p): Handle optional parameter IDENTIFICATION. (tramp-handle-set-file-times): New defun. Replaces `tramp-touch'. (tramp-file-name-handler-alist, tramp-file-name-for-operation): Add entry for `set-file-times'. (tramp-do-copy-or-rename-file-via-buffer) (tramp-do-copy-or-rename-file-out-of-band): Use `set-file-times'. (tramp-handle-unhandled-file-name-directory): Rewrite. (tramp-convert-file-attributes): Add error handling when inode is extraordinary big. (tramp-get-inode): Change parameter from FILE to VEC. (tramp-handle-start-file-process ): Use (current-buffer) if BUFFER is NIL. This is according to the specification. Goto (point-max) when ready. (tramp-handle-shell-command): Rewrite completely, using `process-file' and `start-file-process'. (tramp-methods, tramp-find-shell) (tramp-open-connection-setup-interactive-shell) (tramp-maybe-open-connection): Guard against $PROMPT_COMMAND shell var. Reported by Steve Youngs <steve@sxemacs.org>. * net/tramp-fish.el (tramp-fish-file-name-handler-alist): Add entry for `set-file-times'. Rename `start-process' into `start-file-process'. Remove `call-process' entry. (tramp-fish-handle-set-file-times): New defun. (tramp-fish-handle-executable-find): Use `process-file'. (tramp-fish-handle-process-file): New defun. Replaces `tramp-fish-handle-call-process'. (tramp-fish-do-copy-or-rename-file-directly): Use `set-file-times'. (tramp-fish-get-file-entries): Change `tramp-get-inode' parameter. * net/tramp-smb.el (tramp-smb-handle-file-attributes): Change `tramp-get-inode' parameter.
author Michael Albinus <michael.albinus@gmx.de>
date Tue, 17 Jul 2007 21:10:07 +0000
parents 44b53335982a
children 9077ada922e0
line wrap: on
line diff
--- a/lisp/net/tramp-fish.el	Tue Jul 17 21:09:12 2007 +0000
+++ b/lisp/net/tramp-fish.el	Tue Jul 17 21:10:07 2007 +0000
@@ -263,6 +263,7 @@
     (make-symbolic-link . tramp-fish-handle-make-symbolic-link)
     (rename-file . tramp-fish-handle-rename-file)
     (set-file-modes . tramp-fish-handle-set-file-modes)
+    (set-file-times . tramp-fish-handle-set-file-times)
     (set-visited-file-modtime . ignore)
     (shell-command . tramp-handle-shell-command)
     (substitute-in-file-name . tramp-handle-substitute-in-file-name)
@@ -271,9 +272,8 @@
     (verify-visited-file-modtime . ignore)
     (write-region . tramp-fish-handle-write-region)
     (executable-find . tramp-fish-handle-executable-find)
-    (start-process . ignore)
-    (call-process . tramp-fish-handle-call-process)
-    (process-file . tramp-handle-process-file)
+    (start-file-process . ignore)
+    (process-file . tramp-fish-handle-process-file)
 )
   "Alist of handler functions for Tramp FISH method.
 Operations not mentioned here will be handled by the default Emacs primitives.")
@@ -698,6 +698,15 @@
       (tramp-error
        v 'file-error "Error while changing file's mode %s" filename))))
 
+(defun tramp-fish-handle-set-file-times (filename &optional time)
+  "Like `set-file-times' for Tramp files."
+  (with-parsed-tramp-file-name filename nil
+    (let ((time (if (or (null time) (equal time '(0 0))) (current-time) time)))
+      (zerop (process-file
+	      "touch" nil nil nil "-t"
+	      (format-time-string "%Y%m%d%H%M.%S" time)
+	      (tramp-shell-quote-argument localname))))))
+
 (defun tramp-fish-handle-write-region
   (start end filename &optional append visit lockname confirm)
   "Like `write-region' for Tramp files."
@@ -731,14 +740,14 @@
 (defun tramp-fish-handle-executable-find (command)
   "Like `executable-find' for Tramp files."
   (with-temp-buffer
-    (if (zerop (call-process "which" nil t nil command))
+    (if (zerop (process-file "which" nil t nil command))
 	(progn
 	  (goto-char (point-min))
 	  (buffer-substring (point-min) (tramp-line-end-position))))))
 
-(defun tramp-fish-handle-call-process
+(defun tramp-fish-handle-process-file
   (program &optional infile destination display &rest args)
-  "Like `call-process' for Tramp files."
+  "Like `process-file' for Tramp files."
   ;; The implementation is not complete yet.
   (when (and (numberp destination) (zerop destination))
     (error "Implementation does not handle immediate return"))
@@ -926,11 +935,8 @@
 	       (tramp-shell-quote-argument v1-localname)
 	       (tramp-shell-quote-argument v2-localname)))))
   ;; KEEP-DATE handling.
-  (when keep-date
-    (let ((modtime (nth 5 (file-attributes filename))))
-      (when (and (not (null modtime))
-		 (not (equal modtime '(0 0))))
-	(tramp-touch newname modtime))))
+  (when (and keep-date (functionp 'set-file-times))
+    (apply 'set-file-times (list newname (nth 5 (file-attributes filename)))))
   ;; Set the mode.
   (set-file-modes newname (file-modes filename)))
 
@@ -942,7 +948,8 @@
 SIZE MODE WEIRD INODE DEVICE)."
   (block nil
     (with-current-buffer (tramp-get-buffer vec)
-      ;; #LIST does not work properly with trailing "/", at least in .fishsrv.pl
+      ;; #LIST does not work properly with trailing "/", at least in
+      ;; .fishsrv.pl.
       (when (string-match "/$" localname)
 	(setq localname (concat localname ".")))
 
@@ -974,7 +981,7 @@
 	    ;; Add inode and device.
 	    (add-to-list
 	     'res (append item
-			  (list (tramp-get-inode (car item))
+			  (list (tramp-get-inode vec)
 				(tramp-get-device vec))))))
 
 	;; Read return code