/[emacs]/emacs/lisp/net/tramp.el
ViewVC logotype

Diff of /emacs/lisp/net/tramp.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.37 by kai, Sat May 24 14:10:15 2003 UTC revision 1.38 by kai, Tue Jun 17 14:03:58 2003 UTC
# Line 238  This variable defaults to the value of ` Line 238  This variable defaults to the value of `
238                (tramp-remote-sh            "/bin/sh")                (tramp-remote-sh            "/bin/sh")
239                (tramp-login-args           nil)                (tramp-login-args           nil)
240                (tramp-copy-args            nil)                (tramp-copy-args            nil)
241                (tramp-copy-keep-date-arg    "-p"))                (tramp-copy-keep-date-arg   "-p"))
242       ("scp"   (tramp-connection-function  tramp-open-connection-rsh)       ("scp"   (tramp-connection-function  tramp-open-connection-rsh)
243                (tramp-login-program        "ssh")                (tramp-login-program        "ssh")
244                (tramp-copy-program         "scp")                (tramp-copy-program         "scp")
245                (tramp-remote-sh            "/bin/sh")                (tramp-remote-sh            "/bin/sh")
246                (tramp-login-args           ("-e" "none"))                (tramp-login-args           ("-e" "none"))
247                (tramp-copy-args             nil)                (tramp-copy-args            nil)
248                (tramp-copy-keep-date-arg    "-p"))                (tramp-copy-keep-date-arg   "-p"))
249       ("scp1"  (tramp-connection-function  tramp-open-connection-rsh)       ("scp1"  (tramp-connection-function  tramp-open-connection-rsh)
250                (tramp-login-program        "ssh")                (tramp-login-program        "ssh")
251                (tramp-copy-program         "scp")                (tramp-copy-program         "scp")
252                (tramp-remote-sh            "/bin/sh")                (tramp-remote-sh            "/bin/sh")
253                (tramp-login-args           ("-1" "-e" "none"))                (tramp-login-args           ("-1" "-e" "none"))
254                (tramp-copy-args            ("-1"))                (tramp-copy-args            ("-1"))
255                (tramp-copy-keep-date-arg    "-p"))                (tramp-copy-keep-date-arg   "-p"))
256       ("scp2"  (tramp-connection-function  tramp-open-connection-rsh)       ("scp2"  (tramp-connection-function  tramp-open-connection-rsh)
257                (tramp-login-program        "ssh")                (tramp-login-program        "ssh")
258                (tramp-copy-program         "scp")                (tramp-copy-program         "scp")
259                (tramp-remote-sh            "/bin/sh")                (tramp-remote-sh            "/bin/sh")
260                (tramp-login-args           ("-2" "-e" "none"))                (tramp-login-args           ("-2" "-e" "none"))
261                (tramp-copy-args            ("-2"))                (tramp-copy-args            ("-2"))
262                (tramp-copy-keep-date-arg    "-p"))                (tramp-copy-keep-date-arg   "-p"))
263       ("scp1_old"       ("scp1_old"
264                (tramp-connection-function  tramp-open-connection-rsh)                (tramp-connection-function  tramp-open-connection-rsh)
265                (tramp-login-program        "ssh1")                (tramp-login-program        "ssh1")
# Line 267  This variable defaults to the value of ` Line 267  This variable defaults to the value of `
267                (tramp-remote-sh            "/bin/sh")                (tramp-remote-sh            "/bin/sh")
268                (tramp-login-args           ("-e" "none"))                (tramp-login-args           ("-e" "none"))
269                (tramp-copy-args            nil)                (tramp-copy-args            nil)
270                (tramp-copy-keep-date-arg    "-p"))                (tramp-copy-keep-date-arg   "-p"))
271       ("scp2_old"       ("scp2_old"
272                (tramp-connection-function  tramp-open-connection-rsh)                (tramp-connection-function  tramp-open-connection-rsh)
273                (tramp-login-program        "ssh2")                (tramp-login-program        "ssh2")
# Line 275  This variable defaults to the value of ` Line 275  This variable defaults to the value of `
275                (tramp-remote-sh            "/bin/sh")                (tramp-remote-sh            "/bin/sh")
276                (tramp-login-args           ("-e" "none"))                (tramp-login-args           ("-e" "none"))
277                (tramp-copy-args            nil)                (tramp-copy-args            nil)
278                (tramp-copy-keep-date-arg    "-p"))                (tramp-copy-keep-date-arg   "-p"))
279       ("rsync" (tramp-connection-function  tramp-open-connection-rsh)       ("rsync" (tramp-connection-function  tramp-open-connection-rsh)
280                (tramp-login-program        "ssh")                (tramp-login-program        "ssh")
281                (tramp-copy-program         "rsync")                (tramp-copy-program         "rsync")
282                (tramp-remote-sh            "/bin/sh")                (tramp-remote-sh            "/bin/sh")
283                (tramp-login-args           ("-e" "none"))                (tramp-login-args           ("-e" "none"))
284                (tramp-copy-args            ("-e" "ssh"))                (tramp-copy-args            ("-e" "ssh"))
285                (tramp-copy-keep-date-arg    "-t"))                (tramp-copy-keep-date-arg   "-t"))
286       ("remcp" (tramp-connection-function  tramp-open-connection-rsh)       ("remcp" (tramp-connection-function  tramp-open-connection-rsh)
287                (tramp-login-program        "remsh")                (tramp-login-program        "remsh")
288                (tramp-copy-program         "rcp")                (tramp-copy-program         "rcp")
289                (tramp-remote-sh            "/bin/sh")                (tramp-remote-sh            "/bin/sh")
290                (tramp-login-args           nil)                (tramp-login-args           nil)
291                (tramp-copy-args            nil)                (tramp-copy-args            nil)
292                (tramp-copy-keep-date-arg    "-p"))                (tramp-copy-keep-date-arg   "-p"))
293       ("rsh"   (tramp-connection-function  tramp-open-connection-rsh)       ("rsh"   (tramp-connection-function  tramp-open-connection-rsh)
294                (tramp-login-program        "rsh")                (tramp-login-program        "rsh")
295                (tramp-copy-program         nil)                (tramp-copy-program         nil)
296                (tramp-remote-sh            "/bin/sh")                (tramp-remote-sh            "/bin/sh")
297                (tramp-login-args           nil)                (tramp-login-args           nil)
298                (tramp-copy-args             nil)                (tramp-copy-args            nil)
299                (tramp-copy-keep-date-arg    nil))                (tramp-copy-keep-date-arg   nil))
300       ("ssh"   (tramp-connection-function  tramp-open-connection-rsh)       ("ssh"   (tramp-connection-function  tramp-open-connection-rsh)
301                (tramp-login-program        "ssh")                (tramp-login-program        "ssh")
302                (tramp-copy-program         nil)                (tramp-copy-program         nil)
303                (tramp-remote-sh            "/bin/sh")                (tramp-remote-sh            "/bin/sh")
304                (tramp-login-args           ("-e" "none"))                (tramp-login-args           ("-e" "none"))
305                (tramp-copy-args             nil)                (tramp-copy-args            nil)
306                (tramp-copy-keep-date-arg    nil))                (tramp-copy-keep-date-arg   nil))
307       ("ssh1"  (tramp-connection-function  tramp-open-connection-rsh)       ("ssh1"  (tramp-connection-function  tramp-open-connection-rsh)
308                (tramp-login-program        "ssh")                (tramp-login-program        "ssh")
309                (tramp-copy-program         nil)                (tramp-copy-program         nil)
310                (tramp-remote-sh            "/bin/sh")                (tramp-remote-sh            "/bin/sh")
311                (tramp-login-args           ("-1" "-e" "none"))                (tramp-login-args           ("-1" "-e" "none"))
312                (tramp-copy-args            ("-1"))                (tramp-copy-args            ("-1"))
313                (tramp-copy-keep-date-arg    nil))                (tramp-copy-keep-date-arg   nil))
314       ("ssh2"  (tramp-connection-function  tramp-open-connection-rsh)       ("ssh2"  (tramp-connection-function  tramp-open-connection-rsh)
315                (tramp-login-program        "ssh")                (tramp-login-program        "ssh")
316                (tramp-copy-program         nil)                (tramp-copy-program         nil)
317                (tramp-remote-sh            "/bin/sh")                (tramp-remote-sh            "/bin/sh")
318                (tramp-login-args           ("-2" "-e" "none"))                (tramp-login-args           ("-2" "-e" "none"))
319                (tramp-copy-args            ("-2"))                (tramp-copy-args            ("-2"))
320                (tramp-copy-keep-date-arg    nil))                (tramp-copy-keep-date-arg   nil))
321       ("ssh1_old"       ("ssh1_old"
322                (tramp-connection-function  tramp-open-connection-rsh)                (tramp-connection-function  tramp-open-connection-rsh)
323                (tramp-login-program        "ssh1")                (tramp-login-program        "ssh1")
# Line 325  This variable defaults to the value of ` Line 325  This variable defaults to the value of `
325                (tramp-remote-sh            "/bin/sh")                (tramp-remote-sh            "/bin/sh")
326                (tramp-login-args           ("-e" "none"))                (tramp-login-args           ("-e" "none"))
327                (tramp-copy-args            nil)                (tramp-copy-args            nil)
328                (tramp-copy-keep-date-arg    nil))                (tramp-copy-keep-date-arg   nil))
329       ("ssh2_old"       ("ssh2_old"
330                (tramp-connection-function  tramp-open-connection-rsh)                (tramp-connection-function  tramp-open-connection-rsh)
331                (tramp-login-program        "ssh2")                (tramp-login-program        "ssh2")
# Line 333  This variable defaults to the value of ` Line 333  This variable defaults to the value of `
333                (tramp-remote-sh            "/bin/sh")                (tramp-remote-sh            "/bin/sh")
334                (tramp-login-args           ("-e" "none"))                (tramp-login-args           ("-e" "none"))
335                (tramp-copy-args            nil)                (tramp-copy-args            nil)
336                (tramp-copy-keep-date-arg    nil))                (tramp-copy-keep-date-arg   nil))
337       ("remsh" (tramp-connection-function  tramp-open-connection-rsh)       ("remsh" (tramp-connection-function  tramp-open-connection-rsh)
338                (tramp-login-program        "remsh")                (tramp-login-program        "remsh")
339                (tramp-copy-program         nil)                (tramp-copy-program         nil)
340                (tramp-remote-sh            "/bin/sh")                (tramp-remote-sh            "/bin/sh")
341                (tramp-login-args           nil)                (tramp-login-args           nil)
342                (tramp-copy-args            nil)                (tramp-copy-args            nil)
343                (tramp-copy-keep-date-arg    nil))                (tramp-copy-keep-date-arg   nil))
344       ("telnet"       ("telnet"
345                (tramp-connection-function  tramp-open-connection-telnet)                (tramp-connection-function  tramp-open-connection-telnet)
346                (tramp-login-program        "telnet")                (tramp-login-program        "telnet")
# Line 348  This variable defaults to the value of ` Line 348  This variable defaults to the value of `
348                (tramp-remote-sh            "/bin/sh")                (tramp-remote-sh            "/bin/sh")
349                (tramp-login-args           nil)                (tramp-login-args           nil)
350                (tramp-copy-args            nil)                (tramp-copy-args            nil)
351                (tramp-copy-keep-date-arg    nil))                (tramp-copy-keep-date-arg   nil))
352       ("su"    (tramp-connection-function  tramp-open-connection-su)       ("su"    (tramp-connection-function  tramp-open-connection-su)
353                (tramp-login-program        "su")                (tramp-login-program        "su")
354                (tramp-copy-program         nil)                (tramp-copy-program         nil)
355                (tramp-remote-sh            "/bin/sh")                (tramp-remote-sh            "/bin/sh")
356                (tramp-login-args           ("-" "%u"))                (tramp-login-args           ("-" "%u"))
357                (tramp-copy-args            nil)                (tramp-copy-args            nil)
358                (tramp-copy-keep-date-arg    nil))                (tramp-copy-keep-date-arg   nil))
359       ("sudo"  (tramp-connection-function  tramp-open-connection-su)       ("sudo"  (tramp-connection-function  tramp-open-connection-su)
360                (tramp-login-program        "sudo")                (tramp-login-program        "sudo")
361                (tramp-copy-program         nil)                (tramp-copy-program         nil)
# Line 363  This variable defaults to the value of ` Line 363  This variable defaults to the value of `
363                (tramp-login-args           ("-u" "%u" "-s"                (tramp-login-args           ("-u" "%u" "-s"
364                                             "-p" "Password:"))                                             "-p" "Password:"))
365                (tramp-copy-args            nil)                (tramp-copy-args            nil)
366                (tramp-copy-keep-date-arg    nil))                (tramp-copy-keep-date-arg   nil))
367       ("multi" (tramp-connection-function  tramp-open-connection-multi)       ("multi" (tramp-connection-function  tramp-open-connection-multi)
368                (tramp-login-program        nil)                (tramp-login-program        nil)
369                (tramp-copy-program         nil)                (tramp-copy-program         nil)
370                (tramp-remote-sh            "/bin/sh")                (tramp-remote-sh            "/bin/sh")
371                (tramp-login-args           nil)                (tramp-login-args           nil)
372                (tramp-copy-args            nil)                (tramp-copy-args            nil)
373                (tramp-copy-keep-date-arg    nil))                (tramp-copy-keep-date-arg   nil))
374       ("scpx"  (tramp-connection-function  tramp-open-connection-rsh)       ("scpx"  (tramp-connection-function  tramp-open-connection-rsh)
375                (tramp-login-program        "ssh")                (tramp-login-program        "ssh")
376                (tramp-copy-program         "scp")                (tramp-copy-program         "scp")
377                (tramp-remote-sh            "/bin/sh")                (tramp-remote-sh            "/bin/sh")
378                (tramp-login-args           ("-e" "none" "-t" "-t" "/bin/sh"))                (tramp-login-args           ("-e" "none" "-t" "-t" "/bin/sh"))
379                (tramp-copy-args            nil)                (tramp-copy-args            nil)
380                (tramp-copy-keep-date-arg    "-p"))                (tramp-copy-keep-date-arg   "-p"))
381       ("sshx"  (tramp-connection-function  tramp-open-connection-rsh)       ("sshx"  (tramp-connection-function  tramp-open-connection-rsh)
382                (tramp-login-program        "ssh")                (tramp-login-program        "ssh")
383                (tramp-copy-program         nil)                (tramp-copy-program         nil)
384                (tramp-remote-sh            "/bin/sh")                (tramp-remote-sh            "/bin/sh")
385                (tramp-login-args           ("-e" "none" "-t" "-t" "/bin/sh"))                (tramp-login-args           ("-e" "none" "-t" "-t" "/bin/sh"))
386                (tramp-copy-args            nil)                (tramp-copy-args            nil)
387                (tramp-copy-keep-date-arg    nil))                (tramp-copy-keep-date-arg   nil))
388       ("krlogin"       ("krlogin"
389                (tramp-connection-function  tramp-open-connection-rsh)                (tramp-connection-function  tramp-open-connection-rsh)
390                (tramp-login-program        "krlogin")                (tramp-login-program        "krlogin")
# Line 392  This variable defaults to the value of ` Line 392  This variable defaults to the value of `
392                (tramp-remote-sh            "/bin/sh")                (tramp-remote-sh            "/bin/sh")
393                (tramp-login-args           ("-x"))                (tramp-login-args           ("-x"))
394                (tramp-copy-args            nil)                (tramp-copy-args            nil)
395                (tramp-copy-keep-date-arg    nil))                (tramp-copy-keep-date-arg   nil))
396       ("plink"       ("plink"
397                (tramp-connection-function  tramp-open-connection-rsh)                (tramp-connection-function  tramp-open-connection-rsh)
398                (tramp-login-program        "plink")                (tramp-login-program        "plink")
# Line 400  This variable defaults to the value of ` Line 400  This variable defaults to the value of `
400                (tramp-remote-sh            "/bin/sh")                (tramp-remote-sh            "/bin/sh")
401                (tramp-login-args           ("-ssh")) ;optionally add "-v"                (tramp-login-args           ("-ssh")) ;optionally add "-v"
402                (tramp-copy-args            nil)                (tramp-copy-args            nil)
403                (tramp-copy-keep-date-arg    nil))                (tramp-copy-keep-date-arg   nil))
404       ("plink1"       ("plink1"
405                (tramp-connection-function  tramp-open-connection-rsh)                (tramp-connection-function  tramp-open-connection-rsh)
406                (tramp-login-program        "plink")                (tramp-login-program        "plink")
# Line 408  This variable defaults to the value of ` Line 408  This variable defaults to the value of `
408                (tramp-remote-sh            "/bin/sh")                (tramp-remote-sh            "/bin/sh")
409                (tramp-login-args           ("-1" "-ssh")) ;optionally add "-v"                (tramp-login-args           ("-1" "-ssh")) ;optionally add "-v"
410                (tramp-copy-args            nil)                (tramp-copy-args            nil)
411                (tramp-copy-keep-date-arg    nil))                (tramp-copy-keep-date-arg   nil))
412       ("pscp"       ("pscp"
413                (tramp-connection-function  tramp-open-connection-rsh)                (tramp-connection-function  tramp-open-connection-rsh)
414                (tramp-login-program        "plink")                (tramp-login-program        "plink")
# Line 416  This variable defaults to the value of ` Line 416  This variable defaults to the value of `
416                (tramp-remote-sh            "/bin/sh")                (tramp-remote-sh            "/bin/sh")
417                (tramp-login-args           ("-ssh"))                (tramp-login-args           ("-ssh"))
418                (tramp-copy-args            nil)                (tramp-copy-args            nil)
419                (tramp-copy-keep-date-arg    "-p"))                (tramp-copy-keep-date-arg   "-p"))
420       ("fcp"         ("fcp"  
421                (tramp-connection-function  tramp-open-connection-rsh)                (tramp-connection-function  tramp-open-connection-rsh)
422                (tramp-login-program        "fsh")                (tramp-login-program        "fsh")
# Line 424  This variable defaults to the value of ` Line 424  This variable defaults to the value of `
424                (tramp-remote-sh            "/bin/sh -i")                (tramp-remote-sh            "/bin/sh -i")
425                (tramp-login-args           ("sh" "-i"))                (tramp-login-args           ("sh" "-i"))
426                (tramp-copy-args            nil)                (tramp-copy-args            nil)
427                (tramp-copy-keep-date-arg    "-p"))                (tramp-copy-keep-date-arg   "-p"))
428       )       )
429    "*Alist of methods for remote files.    "*Alist of methods for remote files.
430  This is a list of entries of the form (NAME PARAM1 PARAM2 ...).  This is a list of entries of the form (NAME PARAM1 PARAM2 ...).
# Line 620  See `tramp-methods' for a list of possib Line 620  See `tramp-methods' for a list of possib
620          (cons "scp1_old" tramp-completion-function-alist-ssh)          (cons "scp1_old" tramp-completion-function-alist-ssh)
621          (cons "scp2_old" tramp-completion-function-alist-ssh)          (cons "scp2_old" tramp-completion-function-alist-ssh)
622          (cons "rsync"    tramp-completion-function-alist-rsh)          (cons "rsync"    tramp-completion-function-alist-rsh)
623            (cons "remcp"    tramp-completion-function-alist-rsh)
624          (cons "rsh"      tramp-completion-function-alist-rsh)          (cons "rsh"      tramp-completion-function-alist-rsh)
625          (cons "ssh"      tramp-completion-function-alist-ssh)          (cons "ssh"      tramp-completion-function-alist-ssh)
626          (cons "ssh1"     tramp-completion-function-alist-ssh)          (cons "ssh1"     tramp-completion-function-alist-ssh)
627          (cons "ssh2"     tramp-completion-function-alist-ssh)          (cons "ssh2"     tramp-completion-function-alist-ssh)
628          (cons "ssh1_old" tramp-completion-function-alist-ssh)          (cons "ssh1_old" tramp-completion-function-alist-ssh)
629          (cons "ssh2_old" tramp-completion-function-alist-ssh)          (cons "ssh2_old" tramp-completion-function-alist-ssh)
630            (cons "remsh"    tramp-completion-function-alist-rsh)
631          (cons "telnet"   tramp-completion-function-alist-telnet)          (cons "telnet"   tramp-completion-function-alist-telnet)
632          (cons "su"       tramp-completion-function-alist-su)          (cons "su"       tramp-completion-function-alist-su)
633          (cons "sudo"     tramp-completion-function-alist-su)          (cons "sudo"     tramp-completion-function-alist-su)
# Line 634  See `tramp-methods' for a list of possib Line 636  See `tramp-methods' for a list of possib
636          (cons "sshx"     tramp-completion-function-alist-ssh)          (cons "sshx"     tramp-completion-function-alist-ssh)
637          (cons "krlogin"  tramp-completion-function-alist-rsh)          (cons "krlogin"  tramp-completion-function-alist-rsh)
638          (cons "plink"    tramp-completion-function-alist-ssh)          (cons "plink"    tramp-completion-function-alist-ssh)
639            (cons "plink1"   tramp-completion-function-alist-ssh)
640          (cons "pscp"     tramp-completion-function-alist-ssh)          (cons "pscp"     tramp-completion-function-alist-ssh)
641          (cons "fcp"      tramp-completion-function-alist-ssh)          (cons "fcp"      tramp-completion-function-alist-ssh)
642       )       )
# Line 665  Also see `tramp-password-end-of-line'." Line 668  Also see `tramp-password-end-of-line'."
668    :group 'tramp    :group 'tramp
669    :type 'string)    :type 'string)
670    
671  (defcustom tramp-password-end-of-line tramp-rsh-end-of-line  (defcustom tramp-password-end-of-line
672      (if (string-match "plink" tramp-default-method)
673          ;; Any two characters will do for plink!  Doesn't have to be
674          ;; newline characters.
675          "xy"
676        tramp-rsh-end-of-line)
677    "*String used for end of line after sending a password.    "*String used for end of line after sending a password.
678  It seems that people using plink under Windows need to send  It seems that people using plink under Windows need to send
679  \"\\r\\n\" (carriage-return, then newline) after a password, but just  \"\\r\\n\" (carriage-return, then newline) after a password, but just
# Line 696  The regexp should match at end of buffer Line 704  The regexp should match at end of buffer
704    :type 'regexp)    :type 'regexp)
705    
706  (defcustom tramp-shell-prompt-pattern  (defcustom tramp-shell-prompt-pattern
707    "^[^#$%>\n]*[#$%>] *\\(\e\\[[0-9;]*[a-zA-Z]\\)?"    "^[^#$%>\n]*[#$%>] *\\(\e\\[[0-9;]*[a-zA-Z] *\\)*"
708    "Regexp to match prompts from remote shell.    "Regexp to match prompts from remote shell.
709  Normally, Tramp expects you to configure `shell-prompt-pattern'  Normally, Tramp expects you to configure `shell-prompt-pattern'
710  correctly, but sometimes it happens that you are connecting to a  correctly, but sometimes it happens that you are connecting to a
# Line 1580  mentioned here will be handled by `tramp Line 1588  mentioned here will be handled by `tramp
1588  normal Emacs functions.")  normal Emacs functions.")
1589    
1590  ;; Handlers for foreign methods, like FTP or SMB, shall be plugged here.  ;; Handlers for foreign methods, like FTP or SMB, shall be plugged here.
1591  (defvar tramp-foreign-file-name-handler-alist nil  (defvar tramp-foreign-file-name-handler-alist
1592      ;; (identity . tramp-sh-file-name-handler) should always be the last
1593      ;; entry, since `identity' always matches.
1594      '((identity . tramp-sh-file-name-handler))
1595    "Alist of elements (FUNCTION . HANDLER) for foreign methods handled specially.    "Alist of elements (FUNCTION . HANDLER) for foreign methods handled specially.
1596  If (FUNCTION FILENAME) returns non-nil, then all I/O on that file is done by  If (FUNCTION FILENAME) returns non-nil, then all I/O on that file is done by
1597  calling HANDLER.")  calling HANDLER.")
# Line 2168  if the remote host can't provide the mod Line 2179  if the remote host can't provide the mod
2179                   (fa2 (file-attributes file2)))                   (fa2 (file-attributes file2)))
2180               (if (and (not (equal (nth 5 fa1) '(0 0)))               (if (and (not (equal (nth 5 fa1) '(0 0)))
2181                        (not (equal (nth 5 fa2) '(0 0))))                        (not (equal (nth 5 fa2) '(0 0))))
2182                   (> 0 (car (tramp-time-diff (nth 5 fa1) (nth 5 fa2))))                   (> 0 (tramp-time-diff (nth 5 fa1) (nth 5 fa2)))
2183                 ;; If one of them is the dont-know value, then we can                 ;; If one of them is the dont-know value, then we can
2184                 ;; still try to run a shell command on the remote host.                 ;; still try to run a shell command on the remote host.
2185                 ;; However, this only works if both files are Tramp                 ;; However, this only works if both files are Tramp
# Line 2458  if the remote host can't provide the mod Line 2469  if the remote host can't provide the mod
2469    ;; At least one file a tramp file?    ;; At least one file a tramp file?
2470    (if (or (tramp-tramp-file-p filename)    (if (or (tramp-tramp-file-p filename)
2471            (tramp-tramp-file-p newname))            (tramp-tramp-file-p newname))
2472        (tramp-do-copy-or-rename-file        (let ((modes (file-modes filename)))
2473         'copy filename newname ok-if-already-exists keep-date)          (tramp-do-copy-or-rename-file
2474             'copy filename newname ok-if-already-exists keep-date)
2475            (set-file-modes newname modes))
2476      (tramp-run-real-handler      (tramp-run-real-handler
2477       'copy-file       'copy-file
2478       (list filename newname ok-if-already-exists keep-date))))       (list filename newname ok-if-already-exists keep-date))))
# Line 2555  KEEP-DATE is non-nil if NEWNAME should h Line 2568  KEEP-DATE is non-nil if NEWNAME should h
2568      (save-excursion      (save-excursion
2569        (set-buffer trampbuf) (erase-buffer)        (set-buffer trampbuf) (erase-buffer)
2570        (insert-file-contents-literally filename)        (insert-file-contents-literally filename)
2571        (let ((coding-system-for-write 'no-conversion))        ;; We don't want the target file to be compressed, so we let-bind
2572          ;; `jka-compr-inhibit' to t.
2573          (let ((coding-system-for-write 'binary)
2574                (jka-compr-inhibit t))
2575          (write-region (point-min) (point-max) newname)))          (write-region (point-min) (point-max) newname)))
2576      ;; If the operation was `rename', delete the original file.      ;; If the operation was `rename', delete the original file.
2577      (unless (eq op 'copy)      (unless (eq op 'copy)
# Line 2961  This will break if COMMAND prints a newl Line 2977  This will break if COMMAND prints a newl
2977                 filename))                 filename))
2978        (setq tmpfil (tramp-make-temp-file))        (setq tmpfil (tramp-make-temp-file))
2979        (cond (copy-program        (cond (copy-program
2980                 ;; The following should be changed.  We need a more general
2981                 ;; mechanism to parse extra host args.
2982                 (when (string-match "\\([^#]*\\)#\\(.*\\)" host)
2983                   (setq copy-args (cons "-p" (cons (match-string 2 host)
2984                                                    rsh-args)))
2985                   (setq host (match-string 1 host)))
2986               ;; Use rcp-like program for file transfer.               ;; Use rcp-like program for file transfer.
2987               (tramp-message-for-buffer               (tramp-message-for-buffer
2988                multi-method method user host                multi-method method user host
# Line 3021  This will break if COMMAND prints a newl Line 3043  This will break if COMMAND prints a newl
3043                       ;; line from the output here.  Go to point-max,                       ;; line from the output here.  Go to point-max,
3044                       ;; search backward for tramp_exit_status, delete                       ;; search backward for tramp_exit_status, delete
3045                       ;; between point and point-max if found.                       ;; between point and point-max if found.
3046                       (let ((coding-system-for-write 'no-conversion))                       (let ((coding-system-for-write 'binary))
3047                         (funcall loc-dec (point-min) (point-max))                         (funcall loc-dec (point-min) (point-max))
3048                         (write-region (point-min) (point-max) tmpfil))                         (write-region (point-min) (point-max) tmpfil))
3049                       (kill-buffer tmpbuf))                       (kill-buffer tmpbuf))
# Line 3058  This will break if COMMAND prints a newl Line 3080  This will break if COMMAND prints a newl
3080            (signal 'file-error            (signal 'file-error
3081                    (format "File `%s' not found on remote host" filename))                    (format "File `%s' not found on remote host" filename))
3082            (list (expand-file-name filename) 0))            (list (expand-file-name filename) 0))
3083        (let ((local-copy (file-local-copy filename))        ;; `insert-file-contents-literally' takes care to avoid calling
3084          ;; jka-compr.  By let-binding inhibit-file-name-operation, we
3085          ;; propagate that care to the file-local-copy operation.
3086          (let ((local-copy
3087                 (let ((inhibit-file-name-operation 'file-local-copy))
3088                   (file-local-copy filename)))
3089              (coding-system-used nil)              (coding-system-used nil)
3090              (result nil))              (result nil))
3091          (when visit          (when visit
# Line 3148  This will break if COMMAND prints a newl Line 3175  This will break if COMMAND prints a newl
3175        ;; _also_ specifies an encoding function, then that is used for        ;; _also_ specifies an encoding function, then that is used for
3176        ;; encoding the contents of the tmp file.        ;; encoding the contents of the tmp file.
3177        (cond (copy-program        (cond (copy-program
3178                 ;; The following should be changed.  We need a more general
3179                 ;; mechanism to parse extra host args.
3180                 (when (string-match "\\([^#]*\\)#\\(.*\\)" host)
3181                   (setq copy-args (cons "-p" (cons (match-string 2 host)
3182                                                    rsh-args)))
3183                   (setq host (match-string 1 host)))
3184    
3185               ;; use rcp-like program for file transfer               ;; use rcp-like program for file transfer
3186               (let ((argl (append copy-args               (let ((argl (append copy-args
3187                                   (list                                   (list
# Line 3411  ARGS are the arguments OPERATION has bee Line 3445  ARGS are the arguments OPERATION has bee
3445  (defun tramp-find-foreign-file-name-handler (filename)  (defun tramp-find-foreign-file-name-handler (filename)
3446    "Return foreign file name handler if exists."    "Return foreign file name handler if exists."
3447    (when (tramp-tramp-file-p filename)    (when (tramp-tramp-file-p filename)
3448      (let (elt res)      (let (elt
3449        (dolist (elt tramp-foreign-file-name-handler-alist res)            res
3450              (handler-alist tramp-foreign-file-name-handler-alist))
3451          (while handler-alist
3452            (setq elt (car handler-alist)
3453                  handler-alist (cdr handler-alist))
3454          (when (funcall (car elt) filename)          (when (funcall (car elt) filename)
3455              (setq handler-alist nil)
3456            (setq res (cdr elt))))            (setq res (cdr elt))))
3457        res)))        res)))
3458    
3459  ;; Main function.  ;; Main function.
3460  ;;;###autoload  ;;;###autoload
3461  (defun tramp-file-name-handler (operation &rest args)  (defun tramp-file-name-handler (operation &rest args)
3462    "Invoke tramp file name handler.    "Invoke Tramp file name handler.
3463  Falls back to normal file name handler if no tramp file name handler exists."  Falls back to normal file name handler if no tramp file name handler exists."
3464    (save-match-data    (save-match-data
3465      (let* ((fn (assoc operation tramp-file-name-handler-alist))      (let* ((filename (apply 'tramp-file-name-for-operation operation args))
            (filename (apply 'tramp-file-name-for-operation operation args))  
3466             (foreign (tramp-find-foreign-file-name-handler filename)))             (foreign (tramp-find-foreign-file-name-handler filename)))
3467        (cond        (cond
3468         (foreign (apply foreign operation args))         (foreign (apply foreign operation args))
        (fn (apply (cdr fn) args))  
3469         (t (tramp-run-real-handler operation args))))))         (t (tramp-run-real-handler operation args))))))
3470    
3471  ;;;###autoload  ;;;###autoload
3472  (put 'tramp-file-name-handler 'file-remote-p t) ;for file-remote-p  (put 'tramp-file-name-handler 'file-remote-p t) ;for file-remote-p
3473    
3474    (defun tramp-sh-file-name-handler (operation &rest args)
3475      "Invoke remote-shell Tramp file name handler.
3476    Fall back to normal file name handler if no Tramp handler exists."
3477      (save-match-data
3478        (let ((fn (assoc operation tramp-file-name-handler-alist)))
3479          (if fn
3480              (apply (cdr fn) args)
3481            (tramp-run-real-handler operation args)))))
3482    
3483  ;;;###autoload  ;;;###autoload
3484  (defun tramp-completion-file-name-handler (operation &rest args)  (defun tramp-completion-file-name-handler (operation &rest args)
3485    "Invoke tramp file name completion handler.    "Invoke tramp file name completion handler.
# Line 6097  T1 and T2 are time values (as returned b Line 6143  T1 and T2 are time values (as returned b
6143  NOTE: This function will fail if the time difference is too large to  NOTE: This function will fail if the time difference is too large to
6144  fit in an integer."  fit in an integer."
6145    ;; Pacify byte-compiler with `symbol-function'.    ;; Pacify byte-compiler with `symbol-function'.
6146    (cond ((fboundp 'subtract-time)    (cond ((and (fboundp 'subtract-time)
6147           (cadr (funcall (symbol-function 'subtract-time) t1 t2)))                (fboundp 'float-time))
6148             (funcall (symbol-function 'float-time)
6149                      (funcall (symbol-function 'subtract-time) t1 t2)))
6150            ((and (fboundp 'subtract-time)
6151                  (fboundp 'time-to-seconds))
6152             (funcall (symbol-function 'time-to-seconds)
6153                      (funcall (symbol-function 'subtract-time) t1 t2)))
6154          ((fboundp 'itimer-time-difference)          ((fboundp 'itimer-time-difference)
6155           (floor (funcall           (floor (funcall
6156                   (symbol-function 'itimer-time-difference)                   (symbol-function 'itimer-time-difference)
6157                   (if (< (length t1) 3) (append t1 '(0)) t1)                   (if (< (length t1) 3) (append t1 '(0)) t1)
6158                   (if (< (length t2) 3) (append t2 '(0)) t2))))                   (if (< (length t2) 3) (append t2 '(0)) t2))))
6159          (t          (t
6160           ;; snarfed from Emacs 21 time-date.el           ;; snarfed from Emacs 21 time-date.el; combining
6161           (cadr (let ((borrow (< (cadr t1) (cadr t2))))           ;; time-to-seconds and subtract-time
6162             (let ((time  (let ((borrow (< (cadr t1) (cadr t2))))
6163                   (list (- (car t1) (car t2) (if borrow 1 0))                   (list (- (car t1) (car t2) (if borrow 1 0))
6164                         (- (+ (if borrow 65536 0) (cadr t1)) (cadr t2))))))))                         (- (+ (if borrow 65536 0) (cadr t1)) (cadr t2))))))
6165               (+ (* (car time) 65536.0)
6166                  (cadr time)
6167                  (/ (or (nth 2 time) 0) 1000000.0))))))
6168    
6169  (defun tramp-coding-system-change-eol-conversion (coding-system eol-type)  (defun tramp-coding-system-change-eol-conversion (coding-system eol-type)
6170    "Return a coding system like CODING-SYSTEM but with given EOL-TYPE.    "Return a coding system like CODING-SYSTEM but with given EOL-TYPE.

Legend:
Removed from v.1.37  
changed lines
  Added in v.1.38

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26