aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Großjohann2004-05-07 21:20:10 +0000
committerKai Großjohann2004-05-07 21:20:10 +0000
commit38c65fca8d8b18246f0fe601a25cb0138bd89e0b (patch)
tree5674961ceead8a0e1eb8a07a98fb5dfba729e5b5
parent9bcabb45f768dd93913642239b13bda290e5942d (diff)
downloademacs-38c65fca8d8b18246f0fe601a25cb0138bd89e0b.tar.gz
emacs-38c65fca8d8b18246f0fe601a25cb0138bd89e0b.zip
2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Version 2.0.40 of Tramp released. * net/tramp.el (tramp-completion-mode, tramp-md5-function): Use symbol-function to invoke functions only known on some Emacs flavors. This avoids byte-compiler warnings. Reported by Kevin Scaldeferri <kevin@scaldeferri.com>. (tramp-do-copy-or-rename-file-via-buffer): Renamed from tramp-do-copy-or-rename-via-buffer (without `file'), to make it consistent with the other tramp-do-* functions. (tramp-do-copy-or-rename-file): Calls adjusted. (tramp-process-initial-commands): Avoid liveness check on shell -- we know that it must be alive since we're opening a connection at this moment. (tramp-last-cmd): New internal variable. (tramp-process-echoes): New tunable. (tramp-send-command): Set tramp-last-cmd. (tramp-wait-for-output): Delete echo, if applicable. (tramp-read-passwd): Construct the key for the password cache in a way that works for multi methods, too. (tramp-bug): Add backup-directory-alist and bkup-backup-directory-info to bug reports, with Tramp counterparts. 2004-05-01 Michael Albinus <michael.albinus@gmx.de> * net/tramp*.el: Suppress byte-compiler warnings where possible. * net/tramp.el (tramp-out-of-band-prompt-regexp) (tramp-actions-copy-out-of-band): New defcustoms. (tramp-do-copy-or-rename-file-out-of-band): Asynchronous process used instead of a synchronous one. Allows password entering. (tramp-action-out-of-band): New defun. (tramp-open-connection-rsh, tramp-method-out-of-band-p): Remove restriction with password from doc string. (tramp-bug): Add variables `tramp-terminal-prompt-regexp', `tramp-out-of-band-prompt-regexp', `tramp-actions-copy-out-of-band', `password-cache' and `password-cache-expiry'. (toplevel): Remove todo item wrt ssh-agent. Obsolete due to password caching. (tramp-touch): FILE can be a local file, too. (TODO): Remove items done. (tramp-handle-insert-directory): Properly quote file name also if not full-directory-p. Handle wildcard case. Reported by Andreas Schwab <schwab@suse.de>. (tramp-do-copy-or-rename-file-via-buffer): Set permissions of the new file. (tramp-handle-file-local-copy, tramp-handle-write-region): The permissions of the temporary file are set if filename exists. Reported by Ted Stern <stern@cray.com>. (tramp-backup-directory-alist) (tramp-bkup-backup-directory-info): New defcustoms. (tramp-file-name-handler-alist): Add entry for `find-backup-file-name'. (tramp-handle-find-backup-file-name): New function. Implements Tramp's find-backup-file-name. * net/tramp-smb.el (tramp-smb-file-name-handler-alist): Add entry for `find-backup-file-name'. * net/tramp-vc.el (tramp-vc-workfile-unchanged-p): Correct typo ("file" -> "filename"). Reported by Kim F. Storm <storm@cua.dk>.
-rw-r--r--lisp/ChangeLog65
-rw-r--r--lisp/net/tramp-smb.el15
-rw-r--r--lisp/net/tramp-vc.el41
-rw-r--r--lisp/net/tramp.el362
4 files changed, 373 insertions, 110 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index bc1b996c817..dbf9f72d804 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,68 @@
12004-05-07 Kai Grossjohann <kai@emptydomain.de>
2
3 Version 2.0.40 of Tramp released.
4
5 * net/tramp.el (tramp-completion-mode, tramp-md5-function): Use
6 symbol-function to invoke functions only known on some Emacs
7 flavors. This avoids byte-compiler warnings. Reported by Kevin
8 Scaldeferri <kevin@scaldeferri.com>.
9 (tramp-do-copy-or-rename-file-via-buffer): Renamed from
10 tramp-do-copy-or-rename-via-buffer (without `file'), to make it
11 consistent with the other tramp-do-* functions.
12 (tramp-do-copy-or-rename-file): Calls adjusted.
13 (tramp-process-initial-commands): Avoid liveness check on shell --
14 we know that it must be alive since we're opening a connection at
15 this moment.
16 (tramp-last-cmd): New internal variable.
17 (tramp-process-echoes): New tunable.
18 (tramp-send-command): Set tramp-last-cmd.
19 (tramp-wait-for-output): Delete echo, if applicable.
20 (tramp-read-passwd): Construct the key for the password cache in a
21 way that works for multi methods, too.
22 (tramp-bug): Add backup-directory-alist and
23 bkup-backup-directory-info to bug reports, with Tramp
24 counterparts.
25
262004-05-01 Michael Albinus <michael.albinus@gmx.de>
27
28 * net/tramp*.el: Suppress byte-compiler warnings where possible.
29
30 * net/tramp.el (tramp-out-of-band-prompt-regexp)
31 (tramp-actions-copy-out-of-band): New defcustoms.
32 (tramp-do-copy-or-rename-file-out-of-band): Asynchronous process
33 used instead of a synchronous one. Allows password entering.
34 (tramp-action-out-of-band): New defun.
35 (tramp-open-connection-rsh, tramp-method-out-of-band-p): Remove
36 restriction with password from doc string.
37 (tramp-bug): Add variables `tramp-terminal-prompt-regexp',
38 `tramp-out-of-band-prompt-regexp',
39 `tramp-actions-copy-out-of-band', `password-cache' and
40 `password-cache-expiry'.
41 (toplevel): Remove todo item wrt ssh-agent. Obsolete due to
42 password caching.
43 (tramp-touch): FILE can be a local file, too.
44 (TODO): Remove items done.
45 (tramp-handle-insert-directory): Properly quote file name also if
46 not full-directory-p. Handle wildcard case. Reported by Andreas
47 Schwab <schwab@suse.de>.
48 (tramp-do-copy-or-rename-file-via-buffer): Set permissions of the
49 new file.
50 (tramp-handle-file-local-copy, tramp-handle-write-region): The
51 permissions of the temporary file are set if filename exists.
52 Reported by Ted Stern <stern@cray.com>.
53 (tramp-backup-directory-alist)
54 (tramp-bkup-backup-directory-info): New defcustoms.
55 (tramp-file-name-handler-alist): Add entry for
56 `find-backup-file-name'.
57 (tramp-handle-find-backup-file-name): New function. Implements
58 Tramp's find-backup-file-name.
59
60 * net/tramp-smb.el (tramp-smb-file-name-handler-alist): Add entry
61 for `find-backup-file-name'.
62
63 * net/tramp-vc.el (tramp-vc-workfile-unchanged-p): Correct typo
64 ("file" -> "filename"). Reported by Kim F. Storm <storm@cua.dk>.
65
12004-05-07 Lars Hansen <larsh@math.ku.dk> 662004-05-07 Lars Hansen <larsh@math.ku.dk>
2 67
3 * desktop.el (desktop-buffer-mode-handlers): Fix docstring. 68 * desktop.el (desktop-buffer-mode-handlers): Fix docstring.
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index ab6ad3310c1..781814a9d55 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -38,6 +38,19 @@
38 (or (>= emacs-major-version 20) 38 (or (>= emacs-major-version 20)
39 (load "cl-seq"))) 39 (load "cl-seq")))
40 40
41;; Avoid byte-compiler warnings if the byte-compiler supports this.
42;; Currently, XEmacs supports this.
43(eval-when-compile
44 (when (fboundp 'byte-compiler-options)
45 (let (unused-vars) ; Pacify Emacs byte-compiler
46 (defalias 'warnings 'identity) ; Pacify Emacs byte-compiler
47 (byte-compiler-options (warnings (- unused-vars))))))
48
49;; XEmacs byte-compiler raises warning abouts `last-coding-system-used'.
50(eval-when-compile
51 (unless (boundp 'last-coding-system-used)
52 (defvar last-coding-system-used nil)))
53
41;; Define SMB method ... 54;; Define SMB method ...
42(defcustom tramp-smb-method "smb" 55(defcustom tramp-smb-method "smb"
43 "*Method to connect SAMBA and M$ SMB servers." 56 "*Method to connect SAMBA and M$ SMB servers."
@@ -145,7 +158,7 @@ This variable is local to each buffer.")
145 (file-symlink-p . tramp-smb-not-handled) 158 (file-symlink-p . tramp-smb-not-handled)
146 ;; `file-truename' performed by default handler 159 ;; `file-truename' performed by default handler
147 (file-writable-p . tramp-smb-handle-file-writable-p) 160 (file-writable-p . tramp-smb-handle-file-writable-p)
148 ;; `find-backup-file-name' performed by default handler 161 (find-backup-file-name . tramp-handle-find-backup-file-name)
149 ;; `find-file-noselect' performed by default handler 162 ;; `find-file-noselect' performed by default handler
150 ;; `get-file-buffer' performed by default handler 163 ;; `get-file-buffer' performed by default handler
151 (insert-directory . tramp-smb-handle-insert-directory) 164 (insert-directory . tramp-smb-handle-insert-directory)
diff --git a/lisp/net/tramp-vc.el b/lisp/net/tramp-vc.el
index ded30f4b09c..839a8702dd9 100644
--- a/lisp/net/tramp-vc.el
+++ b/lisp/net/tramp-vc.el
@@ -1,6 +1,6 @@
1;;; tramp-vc.el --- Version control integration for TRAMP.el 1;;; tramp-vc.el --- Version control integration for TRAMP.el
2 2
3;; Copyright (C) 2000 by Free Software Foundation, Inc. 3;; Copyright (C) 2000, 2001, 2002, 2003, 2004 by Free Software Foundation, Inc.
4 4
5;; Author: Daniel Pittman <daniel@danann.net> 5;; Author: Daniel Pittman <daniel@danann.net>
6;; Keywords: comm, processes 6;; Keywords: comm, processes
@@ -38,6 +38,14 @@
38 (require 'vc-rcs)) 38 (require 'vc-rcs))
39(require 'tramp) 39(require 'tramp)
40 40
41;; Avoid byte-compiler warnings if the byte-compiler supports this.
42;; Currently, XEmacs supports this.
43(eval-when-compile
44 (when (fboundp 'byte-compiler-options)
45 (let (unused-vars) ; Pacify Emacs byte-compiler
46 (defalias 'warnings 'identity) ; Pacify Emacs byte-compiler
47 (byte-compiler-options (warnings (- unused-vars))))))
48
41;; -- vc -- 49;; -- vc --
42 50
43;; This used to blow away the file-name-handler-alist and reinstall 51;; This used to blow away the file-name-handler-alist and reinstall
@@ -163,7 +171,9 @@ Since TRAMP doesn't do async commands yet, this function doesn't, either."
163 (if vc-command-messages 171 (if vc-command-messages
164 (message "Running %s on %s..." command file)) 172 (message "Running %s on %s..." command file))
165 (save-current-buffer 173 (save-current-buffer
166 (unless (eq buffer t) (vc-setup-buffer buffer)) 174 (unless (eq buffer t)
175 ; Pacify byte-compiler
176 (funcall (symbol-function 'vc-setup-buffer) buffer))
167 (let ((squeezed nil) 177 (let ((squeezed nil)
168 (inhibit-read-only t) 178 (inhibit-read-only t)
169 (status 0)) 179 (status 0))
@@ -192,9 +202,10 @@ Since TRAMP doesn't do async commands yet, this function doesn't, either."
192 (if (integerp status) (format "status %d" status) status)))) 202 (if (integerp status) (format "status %d" status) status))))
193 (if vc-command-messages 203 (if vc-command-messages
194 (message "Running %s...OK" command)) 204 (message "Running %s...OK" command))
195 (vc-exec-after 205 ; Pacify byte-compiler
196 `(run-hook-with-args 206 (funcall (symbol-function 'vc-exec-after)
197 'vc-post-command-functions ',command ',localname ',flags)) 207 `(run-hook-with-args
208 'vc-post-command-functions ',command ',localname ',flags))
198 status)))) 209 status))))
199 210
200 211
@@ -325,7 +336,8 @@ Since TRAMP doesn't do async commands yet, this function doesn't, either."
325 (not want-differences-if-changed)))) 336 (not want-differences-if-changed))))
326 (zerop status)) 337 (zerop status))
327 ;; New VC. Call `vc-default-workfile-unchanged-p'. 338 ;; New VC. Call `vc-default-workfile-unchanged-p'.
328 (vc-default-workfile-unchanged-p (vc-backend file) filename))) 339 (funcall (symbol-function 'vc-default-workfile-unchanged-p)
340 (vc-backend filename) filename)))
329 341
330(defadvice vc-workfile-unchanged-p 342(defadvice vc-workfile-unchanged-p
331 (around tramp-advice-vc-workfile-unchanged-p 343 (around tramp-advice-vc-workfile-unchanged-p
@@ -391,14 +403,15 @@ filename we are thinking about..."
391 ;; Pacify byte-compiler; this symbol is bound in the calling 403 ;; Pacify byte-compiler; this symbol is bound in the calling
392 ;; function. CCC: Maybe it would be better to move the 404 ;; function. CCC: Maybe it would be better to move the
393 ;; boundness-checking into this function? 405 ;; boundness-checking into this function?
394 (let ((file (symbol-value 'file)) 406 (let* ((file (symbol-value 'file))
395 (remote-uid 407 (remote-uid
396 ;; With Emacs 21.4, `file-attributes' has got an optional parameter 408 ;; With Emacs 21.4, `file-attributes' has got an optional parameter
397 ;; ID-FORMAT. Handle this case backwards compatible. 409 ;; ID-FORMAT. Handle this case backwards compatible.
398 (if (and (functionp 'subr-arity) 410 (if (and (functionp 'subr-arity)
399 (= 2 (cdr (subr-arity (symbol-function 'file-attributes))))) 411 (= 2 (cdr (funcall (symbol-function 'subr-arity)
400 (nth 2 (file-attributes file 'integer)) 412 (symbol-function 'file-attributes)))))
401 (nth 2 (file-attributes file))))) 413 (nth 2 (file-attributes file 'integer))
414 (nth 2 (file-attributes file)))))
402 (if (and uid (/= uid remote-uid)) 415 (if (and uid (/= uid remote-uid))
403 (error "tramp-handle-vc-user-login-name cannot map a uid to a name") 416 (error "tramp-handle-vc-user-login-name cannot map a uid to a name")
404 (let* ((v (tramp-dissect-file-name (tramp-handle-expand-file-name file))) 417 (let* ((v (tramp-dissect-file-name (tramp-handle-expand-file-name file)))
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index cd6ed337927..0fd955b27bc 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -135,11 +135,25 @@ Nil means to use a separate filename syntax for Tramp.")
135(unless (boundp 'custom-print-functions) 135(unless (boundp 'custom-print-functions)
136 (defvar custom-print-functions nil)) ; not autoloaded before Emacs 20.4 136 (defvar custom-print-functions nil)) ; not autoloaded before Emacs 20.4
137 137
138;; Avoid bytecompiler warnings if the byte-compiler supports this. 138;; Avoid byte-compiler warnings if the byte-compiler supports this.
139;; Currently, XEmacs supports this. 139;; Currently, XEmacs supports this.
140(eval-when-compile 140(eval-when-compile
141 (when (fboundp 'byte-compiler-options) 141 (when (fboundp 'byte-compiler-options)
142 (byte-compiler-options (warnings (- unused-vars))))) 142 (let (unused-vars) ; Pacify Emacs byte-compiler
143 (defalias 'warnings 'identity) ; Pacify Emacs byte-compiler
144 (byte-compiler-options (warnings (- unused-vars))))))
145
146;; `directory-sep-char' is an obsolete variable in Emacs. But it is
147;; used in XEmacs, so we set it here and there. The following is needed
148;; to pacify Emacs byte-compiler.
149(eval-when-compile
150 (when (boundp 'byte-compile-not-obsolete-var)
151 (setq byte-compile-not-obsolete-var 'directory-sep-char)))
152
153;; XEmacs byte-compiler raises warning abouts `last-coding-system-used'.
154(eval-when-compile
155 (unless (boundp 'last-coding-system-used)
156 (defvar last-coding-system-used nil)))
143 157
144;;; User Customizable Internal Variables: 158;;; User Customizable Internal Variables:
145 159
@@ -157,6 +171,49 @@ Nil means to use a separate filename syntax for Tramp.")
157 :group 'tramp 171 :group 'tramp
158 :type 'boolean) 172 :type 'boolean)
159 173
174;; Emacs case
175(eval-and-compile
176 (when (boundp 'backup-directory-alist)
177 (defcustom tramp-backup-directory-alist nil
178 "Alist of filename patterns and backup directory names.
179Each element looks like (REGEXP . DIRECTORY), with the same meaning like
180in `backup-directory-alist'. If a Tramp file is backed up, and DIRECTORY
181is a local file name, the backup directory is prepended with Tramp file
182name prefix \(multi-method, method, user, host\) of file.
183
184\(setq tramp-backup-directory-alist backup-directory-alist\)
185
186gives the same backup policy for Tramp files on their hosts like the
187policy for local files."
188 :group 'tramp
189 :type '(repeat (cons (regexp :tag "Regexp matching filename")
190 (directory :tag "Backup directory name"))))))
191
192;; XEmacs case. We cannot check for `bkup-backup-directory-info', because
193;; the package "backup-dir" might not be loaded yet.
194(eval-and-compile
195 (when (featurep 'xemacs)
196 (defcustom tramp-bkup-backup-directory-info nil
197 "*Alist of (FILE-REGEXP BACKUP-DIR OPTIONS ...))
198It has the same meaning like `bkup-backup-directory-info' from package
199`backup-dir'. If a Tramp file is backed up, and BACKUP-DIR is a local
200file name, the backup directory is prepended with Tramp file name prefix
201\(multi-method, method, user, host\) of file.
202
203\(setq tramp-bkup-backup-directory-info bkup-backup-directory-info\)
204
205gives the same backup policy for Tramp files on their hosts like the
206policy for local files."
207 :type '(repeat
208 (list (regexp :tag "File regexp")
209 (string :tag "Backup Dir")
210 (set :inline t
211 (const ok-create)
212 (const full-path)
213 (const prepend-name)
214 (const search-upward))))
215 :group 'tramp)))
216
160(defcustom tramp-auto-save-directory nil 217(defcustom tramp-auto-save-directory nil
161 "*Put auto-save files in this directory, if set. 218 "*Put auto-save files in this directory, if set.
162The idea is to use a local directory so that auto-saving is faster." 219The idea is to use a local directory so that auto-saving is faster."
@@ -854,6 +911,15 @@ The answer will be provided by `tramp-action-terminal', which see."
854 :group 'tramp 911 :group 'tramp
855 :type 'regexp) 912 :type 'regexp)
856 913
914(defcustom tramp-out-of-band-prompt-regexp
915 ""
916 "Regular expression indicating an out-of-band copy has finished.
917In fact this expression is empty by intention, it will be used only to
918check regularly the status of the associated process.
919The answer will be provided by `tramp-action-out-of-band', which see."
920 :group 'tramp
921 :type 'regexp)
922
857(defcustom tramp-temp-name-prefix "tramp." 923(defcustom tramp-temp-name-prefix "tramp."
858 "*Prefix to use for temporary files. 924 "*Prefix to use for temporary files.
859If this is a relative file name (such as \"tramp.\"), it is considered 925If this is a relative file name (such as \"tramp.\"), it is considered
@@ -1237,6 +1303,16 @@ corresponding PATTERN matches, the ACTION function is called."
1237 :group 'tramp 1303 :group 'tramp
1238 :type '(repeat (list variable function))) 1304 :type '(repeat (list variable function)))
1239 1305
1306(defcustom tramp-actions-copy-out-of-band
1307 '((tramp-password-prompt-regexp tramp-action-password)
1308 (tramp-wrong-passwd-regexp tramp-action-permission-denied)
1309 (tramp-out-of-band-prompt-regexp tramp-action-out-of-band))
1310 "List of pattern/action pairs.
1311This list is used for copying/renaming with out-of-band methods.
1312See `tramp-actions-before-shell' for more info."
1313 :group 'tramp
1314 :type '(repeat (list variable function)))
1315
1240(defcustom tramp-multi-actions 1316(defcustom tramp-multi-actions
1241 '((tramp-password-prompt-regexp tramp-multi-action-password) 1317 '((tramp-password-prompt-regexp tramp-multi-action-password)
1242 (tramp-login-prompt-regexp tramp-multi-action-login) 1318 (tramp-login-prompt-regexp tramp-multi-action-login)
@@ -1326,7 +1402,8 @@ the visited file modtime.")
1326(defvar tramp-md5-function 1402(defvar tramp-md5-function
1327 (cond ((and (require 'md5) (fboundp 'md5)) 'md5) 1403 (cond ((and (require 'md5) (fboundp 'md5)) 'md5)
1328 ((fboundp 'md5-encode) 1404 ((fboundp 'md5-encode)
1329 (lambda (x) (base64-encode-string (md5-encode x)))) 1405 (lambda (x) (base64-encode-string
1406 (funcall (symbol-function 'md5-encode) x))))
1330 (t (error "Coulnd't find an `md5' function"))) 1407 (t (error "Coulnd't find an `md5' function")))
1331 "Function to call for running the MD5 algorithm.") 1408 "Function to call for running the MD5 algorithm.")
1332 1409
@@ -1464,7 +1541,7 @@ some systems don't, and for them we have this shell function.")
1464;; The device number is returned as "-1", because there will be a virtual 1541;; The device number is returned as "-1", because there will be a virtual
1465;; device number set in `tramp-handle-file-attributes' 1542;; device number set in `tramp-handle-file-attributes'
1466(defconst tramp-perl-file-attributes "\ 1543(defconst tramp-perl-file-attributes "\
1467($f, $n) = @ARGV; 1544\($f, $n) = @ARGV;
1468@s = lstat($f); 1545@s = lstat($f);
1469if (($s[2] & 0170000) == 0120000) { $l = readlink($f); $l = \"\\\"$l\\\"\"; } 1546if (($s[2] & 0170000) == 0120000) { $l = readlink($f); $l = \"\\\"$l\\\"\"; }
1470elsif (($s[2] & 0170000) == 040000) { $l = \"t\"; } 1547elsif (($s[2] & 0170000) == 040000) { $l = \"t\"; }
@@ -1628,6 +1705,14 @@ This is used to map a mode number to a permission string.")
1628 'undecided-dos) 1705 'undecided-dos)
1629 "Some Emacsen know the `dos' coding system, others need `undecided-dos'.") 1706 "Some Emacsen know the `dos' coding system, others need `undecided-dos'.")
1630 1707
1708(defvar tramp-last-cmd nil
1709 "Internal Tramp variable recording the last command sent.
1710This variable is buffer-local in every buffer.")
1711(make-variable-buffer-local 'tramp-last-cmd)
1712
1713(defvar tramp-process-echoes nil
1714 "Whether to process echoes from the remote shell.")
1715
1631(defvar tramp-last-cmd-time nil 1716(defvar tramp-last-cmd-time nil
1632 "Internal Tramp variable recording the time when the last cmd was sent. 1717 "Internal Tramp variable recording the time when the last cmd was sent.
1633This variable is buffer-local in every buffer.") 1718This variable is buffer-local in every buffer.")
@@ -1638,7 +1723,8 @@ This variable is buffer-local in every buffer.")
1638(defvar tramp-feature-write-region-fix 1723(defvar tramp-feature-write-region-fix
1639 (when (fboundp 'find-operation-coding-system) 1724 (when (fboundp 'find-operation-coding-system)
1640 (let ((file-coding-system-alist '(("test" emacs-mule)))) 1725 (let ((file-coding-system-alist '(("test" emacs-mule))))
1641 (find-operation-coding-system 'write-region 0 0 "" nil "test"))) 1726 (funcall (symbol-function 'find-operation-coding-system)
1727 'write-region 0 0 "" nil "test")))
1642 "Internal variable to say if `write-region' chooses the right coding. 1728 "Internal variable to say if `write-region' chooses the right coding.
1643Older versions of Emacs chose the coding system for `write-region' based 1729Older versions of Emacs chose the coding system for `write-region' based
1644on the FILENAME argument, even if VISIT was a string.") 1730on the FILENAME argument, even if VISIT was a string.")
@@ -1684,6 +1770,7 @@ on the FILENAME argument, even if VISIT was a string.")
1684 (file-local-copy . tramp-handle-file-local-copy) 1770 (file-local-copy . tramp-handle-file-local-copy)
1685 (insert-file-contents . tramp-handle-insert-file-contents) 1771 (insert-file-contents . tramp-handle-insert-file-contents)
1686 (write-region . tramp-handle-write-region) 1772 (write-region . tramp-handle-write-region)
1773 (find-backup-file-name . tramp-handle-find-backup-file-name)
1687 (unhandled-file-name-directory . tramp-handle-unhandled-file-name-directory) 1774 (unhandled-file-name-directory . tramp-handle-unhandled-file-name-directory)
1688 (dired-compress-file . tramp-handle-dired-compress-file) 1775 (dired-compress-file . tramp-handle-dired-compress-file)
1689 (dired-call-process . tramp-handle-dired-call-process) 1776 (dired-call-process . tramp-handle-dired-call-process)
@@ -1756,8 +1843,8 @@ remaining args passed to `tramp-message'."
1756Calls `line-end-position' or `point-at-eol' if defined, else 1843Calls `line-end-position' or `point-at-eol' if defined, else
1757own implementation." 1844own implementation."
1758 (cond 1845 (cond
1759 ((fboundp 'line-end-position) (funcall 'line-end-position)) 1846 ((fboundp 'line-end-position) (funcall (symbol-function 'line-end-position)))
1760 ((fboundp 'point-at-eol) (funcall 'point-at-eol)) 1847 ((fboundp 'point-at-eol) (funcall (symbol-function 'point-at-eol)))
1761 (t (save-excursion (end-of-line) (point))))) 1848 (t (save-excursion (end-of-line) (point)))))
1762 1849
1763(defmacro with-parsed-tramp-file-name (filename var &rest body) 1850(defmacro with-parsed-tramp-file-name (filename var &rest body)
@@ -1790,6 +1877,8 @@ If VAR is nil, then we bind `v' to the structure and `multi-method',
1790 ,@body)) 1877 ,@body))
1791 1878
1792(put 'with-parsed-tramp-file-name 'lisp-indent-function 2) 1879(put 'with-parsed-tramp-file-name 'lisp-indent-function 2)
1880;; To be activated for debugging containing this macro
1881(def-edebug-spec with-parsed-tramp-file-name t)
1793 1882
1794;;; Config Manipulation Functions: 1883;;; Config Manipulation Functions:
1795 1884
@@ -2711,7 +2800,7 @@ and `rename'. FILENAME and NEWNAME must be absolute file names."
2711 ;; matter which filename handlers are used for the 2800 ;; matter which filename handlers are used for the
2712 ;; source and target file. 2801 ;; source and target file.
2713 (t 2802 (t
2714 (tramp-do-copy-or-rename-via-buffer 2803 (tramp-do-copy-or-rename-file-via-buffer
2715 op filename newname keep-date)))) 2804 op filename newname keep-date))))
2716 2805
2717 ;; One file is a Tramp file, the other one is local. 2806 ;; One file is a Tramp file, the other one is local.
@@ -2727,14 +2816,14 @@ and `rename'. FILENAME and NEWNAME must be absolute file names."
2727 (tramp-do-copy-or-rename-file-out-of-band 2816 (tramp-do-copy-or-rename-file-out-of-band
2728 op filename newname keep-date) 2817 op filename newname keep-date)
2729 ;; Use the generic method via a Tramp buffer. 2818 ;; Use the generic method via a Tramp buffer.
2730 (tramp-do-copy-or-rename-via-buffer op filename newname keep-date))) 2819 (tramp-do-copy-or-rename-file-via-buffer
2820 op filename newname keep-date)))
2731 2821
2732 (t 2822 (t
2733 ;; One of them must be a Tramp file. 2823 ;; One of them must be a Tramp file.
2734 (error "Tramp implementation says this cannot happen"))))) 2824 (error "Tramp implementation says this cannot happen")))))
2735 2825
2736;; CCC: implement keep-date if possible -- via touch? 2826(defun tramp-do-copy-or-rename-file-via-buffer (op filename newname keep-date)
2737(defun tramp-do-copy-or-rename-via-buffer (op filename newname keep-date)
2738 "Use an Emacs buffer to copy or rename a file. 2827 "Use an Emacs buffer to copy or rename a file.
2739First arg OP is either `copy' or `rename' and indicates the operation. 2828First arg OP is either `copy' or `rename' and indicates the operation.
2740FILENAME is the source file, NEWNAME the target file. 2829FILENAME is the source file, NEWNAME the target file.
@@ -2754,10 +2843,11 @@ KEEP-DATE is non-nil if NEWNAME should have the same timestamp as FILENAME."
2754 (jka-compr-inhibit t)) 2843 (jka-compr-inhibit t))
2755 (write-region (point-min) (point-max) newname)) 2844 (write-region (point-min) (point-max) newname))
2756 ;; KEEP-DATE handling. 2845 ;; KEEP-DATE handling.
2757 (when (and keep-date 2846 (when keep-date
2758 (not (null modtime)) 2847 (when (and (not (null modtime))
2759 (not (equal modtime '(0 0)))) 2848 (not (equal modtime '(0 0))))
2760 (tramp-touch newname modtime))) 2849 (tramp-touch newname modtime))
2850 (set-file-modes newname (file-modes filename))))
2761 ;; If the operation was `rename', delete the original file. 2851 ;; If the operation was `rename', delete the original file.
2762 (unless (eq op 'copy) 2852 (unless (eq op 'copy)
2763 (delete-file filename)))) 2853 (delete-file filename))))
@@ -2791,12 +2881,12 @@ If KEEP-DATE is non-nil, preserve the time stamp when copying."
2791 "Invoke rcp program to copy. 2881 "Invoke rcp program to copy.
2792One of FILENAME and NEWNAME must be a Tramp name, the other must 2882One of FILENAME and NEWNAME must be a Tramp name, the other must
2793be a local filename. The method used must be an out-of-band method." 2883be a local filename. The method used must be an out-of-band method."
2794 (let ((trampbuf (get-buffer-create "*tramp output*")) 2884 (let ((t1 (tramp-tramp-file-p filename))
2795 (t1 (tramp-tramp-file-p filename))
2796 (t2 (tramp-tramp-file-p newname)) 2885 (t2 (tramp-tramp-file-p newname))
2797 v1-multi-method v1-method v1-user v1-host v1-localname 2886 v1-multi-method v1-method v1-user v1-host v1-localname
2798 v2-multi-method v2-method v2-user v2-host v2-localname 2887 v2-multi-method v2-method v2-user v2-host v2-localname
2799 method copy-program copy-args source target) 2888 multi-method method user host copy-program copy-args
2889 source target trampbuf)
2800 2890
2801 ;; Check which ones of source and target are Tramp files. 2891 ;; Check which ones of source and target are Tramp files.
2802 ;; We cannot invoke `with-parsed-tramp-file-name'; 2892 ;; We cannot invoke `with-parsed-tramp-file-name';
@@ -2808,8 +2898,11 @@ be a local filename. The method used must be an out-of-band method."
2808 v1-user l-user 2898 v1-user l-user
2809 v1-host l-host 2899 v1-host l-host
2810 v1-localname l-localname 2900 v1-localname l-localname
2901 multi-method l-multi-method
2811 method (tramp-find-method 2902 method (tramp-find-method
2812 v1-multi-method v1-method v1-user v1-host) 2903 v1-multi-method v1-method v1-user v1-host)
2904 user l-user
2905 host l-host
2813 copy-program (tramp-get-method-parameter 2906 copy-program (tramp-get-method-parameter
2814 v1-multi-method method 2907 v1-multi-method method
2815 v1-user v1-host 'tramp-copy-program) 2908 v1-user v1-host 'tramp-copy-program)
@@ -2825,8 +2918,11 @@ be a local filename. The method used must be an out-of-band method."
2825 v2-user l-user 2918 v2-user l-user
2826 v2-host l-host 2919 v2-host l-host
2827 v2-localname l-localname 2920 v2-localname l-localname
2921 multi-method l-multi-method
2828 method (tramp-find-method 2922 method (tramp-find-method
2829 v2-multi-method v2-method v2-user v2-host) 2923 v2-multi-method v2-method v2-user v2-host)
2924 user l-user
2925 host l-host
2830 copy-program (tramp-get-method-parameter 2926 copy-program (tramp-get-method-parameter
2831 v2-multi-method method 2927 v2-multi-method method
2832 v2-user v2-host 'tramp-copy-program) 2928 v2-user v2-host 'tramp-copy-program)
@@ -2871,24 +2967,29 @@ be a local filename. The method used must be an out-of-band method."
2871 v2-user v2-host 'tramp-copy-keep-date-arg) 2967 v2-user v2-host 'tramp-copy-keep-date-arg)
2872 copy-args)))) 2968 copy-args))))
2873 2969
2874 (setq copy-args (append copy-args (list source target))) 2970 (setq copy-args (append copy-args (list source target))
2971 trampbuf (generate-new-buffer
2972 (tramp-buffer-name multi-method method user host)))
2875 2973
2876 ;; Use rcp-like program for file transfer. 2974 ;; Use an asynchronous process. By this, password can be handled.
2877 (tramp-message 2975 (save-excursion
2878 5 "Transferring %s to file %s..." filename newname) 2976 (set-buffer trampbuf)
2879 (save-excursion (set-buffer trampbuf) (erase-buffer)) 2977 (setq tramp-current-multi-method multi-method
2880 (unless (equal 2978 tramp-current-method method
2881 0 2979 tramp-current-user user
2882 (apply #'call-process copy-program 2980 tramp-current-host host)
2883 nil trampbuf nil copy-args)) 2981 (tramp-message
2884 (pop-to-buffer trampbuf) 2982 5 "Transferring %s to file %s..." filename newname)
2885 (error 2983
2886 (concat 2984 ;; Use rcp-like program for file transfer.
2887 "tramp-do-copy-or-rename-file-out-of-band: `%s' didn't work, " 2985 (let ((p (apply 'start-process (buffer-name trampbuf) trampbuf
2888 "see buffer `%s' for details") 2986 copy-program copy-args)))
2889 copy-program trampbuf)) 2987 (process-kill-without-query p)
2890 (tramp-message 2988 (tramp-process-actions p multi-method method user host
2891 5 "Transferring %s to file %s...done" filename newname) 2989 tramp-actions-copy-out-of-band))
2990 (kill-buffer trampbuf)
2991 (tramp-message
2992 5 "Transferring %s to file %s...done" filename newname))
2892 2993
2893 ;; If the operation was `rename', delete the original file. 2994 ;; If the operation was `rename', delete the original file.
2894 (unless (eq op 'copy) 2995 (unless (eq op 'copy)
@@ -3012,7 +3113,8 @@ This is like `dired-recursive-delete-directory' for tramp files."
3012 multi-method method user host 3113 multi-method method user host
3013 (concat (nth 2 suffix) " " localname))) 3114 (concat (nth 2 suffix) " " localname)))
3014 (message "Uncompressing %s...done" file) 3115 (message "Uncompressing %s...done" file)
3015 (dired-remove-file file) 3116 ;; `dired-remove-file' is not defined in XEmacs
3117 (funcall (symbol-function 'dired-remove-file) file)
3016 (string-match (car suffix) file) 3118 (string-match (car suffix) file)
3017 (concat (substring file 0 (match-beginning 0))))) 3119 (concat (substring file 0 (match-beginning 0)))))
3018 (t 3120 (t
@@ -3023,7 +3125,8 @@ This is like `dired-recursive-delete-directory' for tramp files."
3023 multi-method method user host 3125 multi-method method user host
3024 (concat "gzip -f " localname))) 3126 (concat "gzip -f " localname)))
3025 (message "Compressing %s...done" file) 3127 (message "Compressing %s...done" file)
3026 (dired-remove-file file) 3128 ;; `dired-remove-file' is not defined in XEmacs
3129 (funcall (symbol-function 'dired-remove-file) file)
3027 (cond ((file-exists-p (concat file ".gz")) 3130 (cond ((file-exists-p (concat file ".gz"))
3028 (concat file ".gz")) 3131 (concat file ".gz"))
3029 ((file-exists-p (concat file ".z")) 3132 ((file-exists-p (concat file ".z"))
@@ -3091,12 +3194,10 @@ This is like `dired-recursive-delete-directory' for tramp files."
3091 (format "%s %s %s" 3194 (format "%s %s %s"
3092 (tramp-get-ls-command multi-method method user host) 3195 (tramp-get-ls-command multi-method method user host)
3093 switches 3196 switches
3094 (if full-directory-p 3197 (if wildcard
3095 ;; Add "/." to make sure we got complete dir 3198 localname
3096 ;; listing for symlinks, too. 3199 (tramp-shell-quote-argument
3097 (concat (file-name-as-directory 3200 (file-name-nondirectory localname))))))
3098 (file-name-nondirectory localname)) ".")
3099 (file-name-nondirectory localname)))))
3100 (sit-for 1) ;needed for rsh but not ssh? 3201 (sit-for 1) ;needed for rsh but not ssh?
3101 (tramp-wait-for-output)) 3202 (tramp-wait-for-output))
3102 ;; The following let-binding is used by code that's commented 3203 ;; The following let-binding is used by code that's commented
@@ -3361,7 +3462,6 @@ This will break if COMMAND prints a newline, followed by the value of
3361 filename)) 3462 filename))
3362 (setq tmpfil (tramp-make-temp-file)) 3463 (setq tmpfil (tramp-make-temp-file))
3363 3464
3364
3365 (cond ((tramp-method-out-of-band-p multi-method method user host) 3465 (cond ((tramp-method-out-of-band-p multi-method method user host)
3366 ;; `copy-file' handles out-of-band methods 3466 ;; `copy-file' handles out-of-band methods
3367 (copy-file filename tmpfil t t)) 3467 (copy-file filename tmpfil t t))
@@ -3418,7 +3518,9 @@ This will break if COMMAND prints a newline, followed by the value of
3418 (delete-file tmpfil2))) 3518 (delete-file tmpfil2)))
3419 (tramp-message-for-buffer 3519 (tramp-message-for-buffer
3420 multi-method method user host 3520 multi-method method user host
3421 5 "Decoding remote file %s...done" filename))) 3521 5 "Decoding remote file %s...done" filename)
3522 ;; Set proper permissions.
3523 (set-file-modes tmpfil (file-modes filename))))
3422 3524
3423 (t (error "Wrong method specification for `%s'" method))) 3525 (t (error "Wrong method specification for `%s'" method)))
3424 tmpfil))) 3526 tmpfil)))
@@ -3470,6 +3572,49 @@ This will break if COMMAND prints a newline, followed by the value of
3470 (list (expand-file-name filename) 3572 (list (expand-file-name filename)
3471 (second result)))))) 3573 (second result))))))
3472 3574
3575
3576(defun tramp-handle-find-backup-file-name (filename)
3577 "Like `find-backup-file-name' for tramp files."
3578
3579 (if (or (and (not (featurep 'xemacs))
3580 (not (boundp 'tramp-backup-directory-alist)))
3581 (and (featurep 'xemacs)
3582 (not (boundp 'tramp-bkup-backup-directory-info))))
3583
3584 ;; No tramp backup directory alist defined, or nil
3585 (tramp-run-real-handler 'find-backup-file-name (list filename))
3586
3587 (with-parsed-tramp-file-name filename nil
3588 (let* ((backup-var
3589 (copy-tree
3590 (if (featurep 'xemacs)
3591 ;; XEmacs case
3592 (symbol-value 'tramp-bkup-backup-directory-info)
3593 ;; Emacs case
3594 (symbol-value 'tramp-backup-directory-alist))))
3595
3596 ;; We set both variables. It doesn't matter whether it is
3597 ;; Emacs or XEmacs
3598 (backup-directory-alist backup-var)
3599 (bkup-backup-directory-info backup-var))
3600
3601 (mapcar
3602 '(lambda (x)
3603 (let ((dir (if (consp (cdr x)) (car (cdr x)) (cdr x))))
3604 (when (and (stringp dir)
3605 (file-name-absolute-p dir)
3606 (not (tramp-file-name-p dir)))
3607 ;; Prepend absolute directory names with tramp prefix
3608 (if (consp (cdr x))
3609 (setcar (cdr x)
3610 (tramp-make-tramp-file-name
3611 multi-method method user host dir))
3612 (setcdr x (tramp-make-tramp-file-name
3613 multi-method method user host dir))))))
3614 backup-var)
3615
3616 (tramp-run-real-handler 'find-backup-file-name (list filename))))))
3617
3473;; CCC grok APPEND, LOCKNAME, CONFIRM 3618;; CCC grok APPEND, LOCKNAME, CONFIRM
3474(defun tramp-handle-write-region 3619(defun tramp-handle-write-region
3475 (start end filename &optional append visit lockname confirm) 3620 (start end filename &optional append visit lockname confirm)
@@ -3499,6 +3644,7 @@ This will break if COMMAND prints a newline, followed by the value of
3499 (loc-enc (tramp-get-local-encoding multi-method method user host)) 3644 (loc-enc (tramp-get-local-encoding multi-method method user host))
3500 (loc-dec (tramp-get-local-decoding multi-method method user host)) 3645 (loc-dec (tramp-get-local-decoding multi-method method user host))
3501 (trampbuf (get-buffer-create "*tramp output*")) 3646 (trampbuf (get-buffer-create "*tramp output*"))
3647 (modes (file-modes filename))
3502 ;; We use this to save the value of `last-coding-system-used' 3648 ;; We use this to save the value of `last-coding-system-used'
3503 ;; after writing the tmp file. At the end of the function, 3649 ;; after writing the tmp file. At the end of the function,
3504 ;; we set `last-coding-system-used' to this saved value. 3650 ;; we set `last-coding-system-used' to this saved value.
@@ -3519,6 +3665,11 @@ This will break if COMMAND prints a newline, followed by the value of
3519 (if confirm ; don't pass this arg unless defined for backward compat. 3665 (if confirm ; don't pass this arg unless defined for backward compat.
3520 (list start end tmpfil append 'no-message lockname confirm) 3666 (list start end tmpfil append 'no-message lockname confirm)
3521 (list start end tmpfil append 'no-message lockname))) 3667 (list start end tmpfil append 'no-message lockname)))
3668 ;; The permissions of the temporary file should be set. If
3669 ;; filename does not exist (eq modes nil) it has been renamed to
3670 ;; the backup file. This case `save-buffer' handles
3671 ;; permissions.
3672 (when modes (set-file-modes tmpfil modes))
3522 ;; Now, `last-coding-system-used' has the right value. Remember it. 3673 ;; Now, `last-coding-system-used' has the right value. Remember it.
3523 (when (boundp 'last-coding-system-used) 3674 (when (boundp 'last-coding-system-used)
3524 (setq coding-system-used last-coding-system-used)) 3675 (setq coding-system-used last-coding-system-used))
@@ -3885,7 +4036,7 @@ necessary anymore."
3885 (list (tramp-handle-expand-file-name name)))))) 4036 (list (tramp-handle-expand-file-name name))))))
3886 4037
3887;; Check for complete.el and override PC-expand-many-files if appropriate. 4038;; Check for complete.el and override PC-expand-many-files if appropriate.
3888(eval-when-compile 4039(eval-and-compile
3889 (defun tramp-save-PC-expand-many-files (name))); avoid compiler warning 4040 (defun tramp-save-PC-expand-many-files (name))); avoid compiler warning
3890 4041
3891(defun tramp-setup-complete () 4042(defun tramp-setup-complete ()
@@ -3936,11 +4087,14 @@ necessary anymore."
3936 (and (featurep 'xemacs) 4087 (and (featurep 'xemacs)
3937 (not (event-modifiers last-input-event)) 4088 (not (event-modifiers last-input-event))
3938 (or (char-equal 4089 (or (char-equal
3939 (funcall 'event-to-character last-input-event) ?\?) 4090 (funcall (symbol-function 'event-to-character)
4091 last-input-event) ?\?)
3940 (char-equal 4092 (char-equal
3941 (funcall 'event-to-character last-input-event) ?\t) 4093 (funcall (symbol-function 'event-to-character)
4094 last-input-event) ?\t)
3942 (char-equal 4095 (char-equal
3943 (funcall 'event-to-character last-input-event) ?\ )))) 4096 (funcall (symbol-function 'event-to-character)
4097 last-input-event) ?\ ))))
3944 t))) 4098 t)))
3945 4099
3946(defun tramp-completion-handle-file-exists-p (filename) 4100(defun tramp-completion-handle-file-exists-p (filename)
@@ -4478,17 +4632,24 @@ hosts, or files, disagree."
4478 "Set the last-modified timestamp of the given file. 4632 "Set the last-modified timestamp of the given file.
4479TIME is an Emacs internal time value as returned by `current-time'." 4633TIME is an Emacs internal time value as returned by `current-time'."
4480 (let ((touch-time (format-time-string "%Y%m%d%H%M.%S" time))) 4634 (let ((touch-time (format-time-string "%Y%m%d%H%M.%S" time)))
4481 (with-parsed-tramp-file-name file nil 4635 (if (tramp-tramp-file-p file)
4482 (let ((buf (tramp-get-buffer multi-method method user host))) 4636 (with-parsed-tramp-file-name file nil
4483 (unless (zerop (tramp-send-command-and-check 4637 (let ((buf (tramp-get-buffer multi-method method user host)))
4484 multi-method method user host 4638 (unless (zerop (tramp-send-command-and-check
4485 (format "touch -t %s %s" 4639 multi-method method user host
4486 touch-time 4640 (format "touch -t %s %s"
4487 localname))) 4641 touch-time
4488 (pop-to-buffer buf) 4642 localname)))
4489 (error "tramp-touch: touch failed, see buffer `%s' for details" 4643 (pop-to-buffer buf)
4490 buf)))))) 4644 (error "tramp-touch: touch failed, see buffer `%s' for details"
4491 4645 buf))))
4646 ;; It's a local file
4647 (with-temp-buffer
4648 (unless (zerop (call-process
4649 "touch" nil (current-buffer) nil "-t" touch-time file))
4650 (pop-to-buffer (current-buffer))
4651 (error "tramp-touch: touch failed"))))))
4652
4492(defun tramp-buffer-name (multi-method method user host) 4653(defun tramp-buffer-name (multi-method method user host)
4493 "A name for the connection buffer for USER at HOST using METHOD." 4654 "A name for the connection buffer for USER at HOST using METHOD."
4494 (if multi-method 4655 (if multi-method
@@ -4815,6 +4976,19 @@ The terminal type can be configured with `tramp-terminal-type'."
4815 (process-send-string nil (concat tramp-terminal-type 4976 (process-send-string nil (concat tramp-terminal-type
4816 tramp-rsh-end-of-line))) 4977 tramp-rsh-end-of-line)))
4817 4978
4979(defun tramp-action-out-of-band (p multi-method method user host)
4980 "Check whether an out-of-band copy has finished."
4981 (cond ((and (memq (process-status p) '(stop exit))
4982 (zerop (process-exit-status p)))
4983 (tramp-message 9 "Process has finished.")
4984 (throw 'tramp-action 'ok))
4985 ((or (and (memq (process-status p) '(stop exit))
4986 (not (zerop (process-exit-status p))))
4987 (memq (process-status p) '(signal)))
4988 (tramp-message 9 "Process has died.")
4989 (throw 'tramp-action 'process-died))
4990 (t nil)))
4991
4818;; The following functions are specifically for multi connections. 4992;; The following functions are specifically for multi connections.
4819 4993
4820(defun tramp-multi-action-login (p method user host) 4994(defun tramp-multi-action-login (p method user host)
@@ -4931,7 +5105,7 @@ The terminal type can be configured with `tramp-terminal-type'."
4931 (erase-buffer) 5105 (erase-buffer)
4932 (tramp-message 10 "Sending command to remote shell: %s" 5106 (tramp-message 10 "Sending command to remote shell: %s"
4933 cmd) 5107 cmd)
4934 (tramp-send-command multi-method method user host cmd) 5108 (tramp-send-command multi-method method user host cmd nil t)
4935 (tramp-barf-if-no-shell-prompt 5109 (tramp-barf-if-no-shell-prompt
4936 p 60 "Remote shell command failed: %s" cmd)) 5110 p 60 "Remote shell command failed: %s" cmd))
4937 (erase-buffer))) 5111 (erase-buffer)))
@@ -5014,12 +5188,6 @@ Recognition of the remote shell prompt is based on the variables
5014`shell-prompt-pattern' and `tramp-shell-prompt-pattern' which must be 5188`shell-prompt-pattern' and `tramp-shell-prompt-pattern' which must be
5015set up correctly. 5189set up correctly.
5016 5190
5017Please note that it is NOT possible to use this connection method with
5018an out-of-band transfer method if this function asks the user for a
5019password! You must use an inline transfer method in this case.
5020Sadly, the transfer method cannot be switched on the fly, instead you
5021must specify the right method in the file name.
5022
5023Kludgy feature: if HOST has the form \"xx#yy\", then yy is assumed to 5191Kludgy feature: if HOST has the form \"xx#yy\", then yy is assumed to
5024be a port number for ssh, and \"-p yy\" will be added to the list of 5192be a port number for ssh, and \"-p yy\" will be added to the list of
5025arguments, and xx will be used as the host name to connect to. 5193arguments, and xx will be used as the host name to connect to.
@@ -5412,6 +5580,10 @@ to set up. METHOD, USER and HOST specify the connection."
5412 (tramp-send-command-internal multi-method method user host 5580 (tramp-send-command-internal multi-method method user host
5413 "stty -inlcr -echo kill '^U'") 5581 "stty -inlcr -echo kill '^U'")
5414 (erase-buffer) 5582 (erase-buffer)
5583 ;; Ignore garbage after stty command.
5584 (tramp-send-command-internal multi-method method user host
5585 "echo foo")
5586 (erase-buffer)
5415 (tramp-send-command-internal multi-method method user host 5587 (tramp-send-command-internal multi-method method user host
5416 "TERM=dumb; export TERM") 5588 "TERM=dumb; export TERM")
5417 ;; Try to set up the coding system correctly. 5589 ;; Try to set up the coding system correctly.
@@ -5858,6 +6030,7 @@ connection. This is meant to be used from
5858 (or neveropen 6030 (or neveropen
5859 (tramp-maybe-open-connection multi-method method user host)) 6031 (tramp-maybe-open-connection multi-method method user host))
5860 (setq tramp-last-cmd-time (current-time)) 6032 (setq tramp-last-cmd-time (current-time))
6033 (setq tramp-last-cmd command)
5861 (when tramp-debug-buffer 6034 (when tramp-debug-buffer
5862 (save-excursion 6035 (save-excursion
5863 (set-buffer (tramp-get-debug-buffer multi-method method user host)) 6036 (set-buffer (tramp-get-debug-buffer multi-method method user host))
@@ -5886,6 +6059,7 @@ Sends COMMAND, then waits 30 seconds for shell prompt."
5886 (let ((proc (get-buffer-process (current-buffer))) 6059 (let ((proc (get-buffer-process (current-buffer)))
5887 (found nil) 6060 (found nil)
5888 (start-time (current-time)) 6061 (start-time (current-time))
6062 (start-point (point))
5889 (end-of-output (concat "^" 6063 (end-of-output (concat "^"
5890 (regexp-quote tramp-end-of-output) 6064 (regexp-quote tramp-end-of-output)
5891 "\r?$"))) 6065 "\r?$")))
@@ -5920,6 +6094,12 @@ Sends COMMAND, then waits 30 seconds for shell prompt."
5920 (goto-char (point-max)) 6094 (goto-char (point-max))
5921 (forward-line -2) 6095 (forward-line -2)
5922 (delete-region (point) (point-max))) 6096 (delete-region (point) (point-max)))
6097 ;; If processing echoes, look for it in the first line and delete.
6098 (when tramp-process-echoes
6099 (save-excursion
6100 (goto-char start-point)
6101 (when (looking-at (regexp-quote tramp-last-cmd))
6102 (delete-region (point) (forward-line 1)))))
5923 ;; Add output to debug buffer if appropriate. 6103 ;; Add output to debug buffer if appropriate.
5924 (when tramp-debug-buffer 6104 (when tramp-debug-buffer
5925 (append-to-buffer 6105 (append-to-buffer
@@ -6325,9 +6505,7 @@ If both MULTI-METHOD and METHOD are nil, do a lookup in
6325 (format "%s:%s" host localname))) 6505 (format "%s:%s" host localname)))
6326 6506
6327(defun tramp-method-out-of-band-p (multi-method method user host) 6507(defun tramp-method-out-of-band-p (multi-method method user host)
6328 "Return t if this is an out-of-band method, nil otherwise. 6508 "Return t if this is an out-of-band method, nil otherwise."
6329It is important to check for this condition, since it is not possible
6330to enter a password for the `tramp-copy-program'."
6331 (tramp-get-method-parameter 6509 (tramp-get-method-parameter
6332 multi-method 6510 multi-method
6333 (tramp-find-method multi-method method user host) 6511 (tramp-find-method multi-method method user host)
@@ -6502,7 +6680,10 @@ Invokes `password-read' if available, `read-passwd' else."
6502 (if (functionp 'password-read) 6680 (if (functionp 'password-read)
6503 (let* ((user (or tramp-current-user (user-login-name))) 6681 (let* ((user (or tramp-current-user (user-login-name)))
6504 (host (or tramp-current-host (system-name))) 6682 (host (or tramp-current-host (system-name)))
6505 (key (concat user "@" host)) 6683 (key (if (and (stringp user) (stringp host))
6684 (concat user "@" host)
6685 (concat "[" (mapconcat 'identity user "/") "]@["
6686 (mapconcat 'identity host "/") "]")))
6506 (password (apply #'password-read (list prompt key)))) 6687 (password (apply #'password-read (list prompt key))))
6507 (apply #'password-cache-add (list key password)) 6688 (apply #'password-cache-add (list key password))
6508 password) 6689 password)
@@ -6714,6 +6895,8 @@ Only works for Bourne-like shells."
6714 tramp-wrong-passwd-regexp 6895 tramp-wrong-passwd-regexp
6715 tramp-yesno-prompt-regexp 6896 tramp-yesno-prompt-regexp
6716 tramp-yn-prompt-regexp 6897 tramp-yn-prompt-regexp
6898 tramp-terminal-prompt-regexp
6899 tramp-out-of-band-prompt-regexp
6717 tramp-temp-name-prefix 6900 tramp-temp-name-prefix
6718 tramp-file-name-structure 6901 tramp-file-name-structure
6719 tramp-file-name-regexp 6902 tramp-file-name-regexp
@@ -6725,10 +6908,15 @@ Only works for Bourne-like shells."
6725 tramp-end-of-output 6908 tramp-end-of-output
6726 tramp-coding-commands 6909 tramp-coding-commands
6727 tramp-actions-before-shell 6910 tramp-actions-before-shell
6911 tramp-actions-copy-out-of-band
6728 tramp-multi-actions 6912 tramp-multi-actions
6729 tramp-terminal-type 6913 tramp-terminal-type
6730 tramp-shell-prompt-pattern 6914 tramp-shell-prompt-pattern
6731 tramp-chunksize 6915 tramp-chunksize
6916 ,(when (boundp 'tramp-backup-directory-alist)
6917 'tramp-backup-directory-alist)
6918 ,(when (boundp 'tramp-bkup-backup-directory-info)
6919 'tramp-bkup-backup-directory-info)
6732 6920
6733 ;; Non-tramp variables of interest 6921 ;; Non-tramp variables of interest
6734 shell-prompt-pattern 6922 shell-prompt-pattern
@@ -6737,6 +6925,14 @@ Only works for Bourne-like shells."
6737 backup-by-copying-when-mismatch 6925 backup-by-copying-when-mismatch
6738 ,(when (boundp 'backup-by-copying-when-privileged-mismatch) 6926 ,(when (boundp 'backup-by-copying-when-privileged-mismatch)
6739 'backup-by-copying-when-privileged-mismatch) 6927 'backup-by-copying-when-privileged-mismatch)
6928 ,(when (boundp 'password-cache)
6929 'password-cache)
6930 ,(when (boundp 'password-cache-expiry)
6931 'password-cache-expiry)
6932 ,(when (boundp 'backup-directory-alist)
6933 'backup-directory-alist)
6934 ,(when (boundp 'bkup-backup-directory-info)
6935 'bkup-backup-directory-info)
6740 file-name-handler-alist) 6936 file-name-handler-alist)
6741 nil ; pre-hook 6937 nil ; pre-hook
6742 nil ; post-hook 6938 nil ; post-hook
@@ -6799,7 +6995,6 @@ report.
6799;; * Rewrite `tramp-shell-quote-argument' to abstain from using 6995;; * Rewrite `tramp-shell-quote-argument' to abstain from using
6800;; `shell-quote-argument'. 6996;; `shell-quote-argument'.
6801;; * Completion gets confused when you leave out the method name. 6997;; * Completion gets confused when you leave out the method name.
6802;; * Support `dired-compress-file' filename handler.
6803;; * In Emacs 21, `insert-directory' shows total number of bytes used 6998;; * In Emacs 21, `insert-directory' shows total number of bytes used
6804;; by the files in that directory. Add this here. 6999;; by the files in that directory. Add this here.
6805;; * Avoid screen blanking when hitting `g' in dired. (Eli Tziperman) 7000;; * Avoid screen blanking when hitting `g' in dired. (Eli Tziperman)
@@ -6820,19 +7015,12 @@ report.
6820;; if it does show files when run locally. 7015;; if it does show files when run locally.
6821;; * Allow correction of passwords, if the remote end allows this. 7016;; * Allow correction of passwords, if the remote end allows this.
6822;; (Mark Hershberger) 7017;; (Mark Hershberger)
6823;; * Make sure permissions of tmp file are good.
6824;; (Nelson Minar <nelson@media.mit.edu>)
6825;; * Grok passwd prompts with scp? (David Winter
6826;; <winter@nevis1.nevis.columbia.edu>). Maybe just do `ssh -l user
6827;; host', then wait a while for the passwd or passphrase prompt. If
6828;; there is one, remember the passwd/phrase.
6829;; * How to deal with MULE in `insert-file-contents' and `write-region'? 7018;; * How to deal with MULE in `insert-file-contents' and `write-region'?
6830;; * Do asynchronous `shell-command's. 7019;; * Do asynchronous `shell-command's.
6831;; * Grok `append' parameter for `write-region'. 7020;; * Grok `append' parameter for `write-region'.
6832;; * Test remote ksh or bash for tilde expansion in `tramp-find-shell'? 7021;; * Test remote ksh or bash for tilde expansion in `tramp-find-shell'?
6833;; * abbreviate-file-name 7022;; * abbreviate-file-name
6834;; * grok ~ in tramp-remote-path (Henrik Holm <henrikh@tele.ntnu.no>) 7023;; * grok ~ in tramp-remote-path (Henrik Holm <henrikh@tele.ntnu.no>)
6835;; * `C' in dired gives error `not tramp file name'.
6836;; * Also allow to omit user names when doing multi-hop. Not sure yet 7024;; * Also allow to omit user names when doing multi-hop. Not sure yet
6837;; what the user names should default to, though. 7025;; what the user names should default to, though.
6838;; * better error checking. At least whenever we see something 7026;; * better error checking. At least whenever we see something
@@ -6848,9 +7036,7 @@ report.
6848;; (Francesco Potort,Al(B) 7036;; (Francesco Potort,Al(B)
6849;; * Should we set PATH ourselves or should we rely on the remote end 7037;; * Should we set PATH ourselves or should we rely on the remote end
6850;; to do it? 7038;; to do it?
6851;; * Do the autoconf thing.
6852;; * Make it work for XEmacs 20, which is missing `with-timeout'. 7039;; * Make it work for XEmacs 20, which is missing `with-timeout'.
6853;; * Allow non-Unix remote systems. (More a long-term thing.)
6854;; * Make it work for different encodings, and for different file name 7040;; * Make it work for different encodings, and for different file name
6855;; encodings, too. (Daniel Pittman) 7041;; encodings, too. (Daniel Pittman)
6856;; * Change applicable functions to pass a struct tramp-file-name rather 7042;; * Change applicable functions to pass a struct tramp-file-name rather
@@ -6865,13 +7051,6 @@ report.
6865;; * When editing a remote CVS controlled file as a different user, VC 7051;; * When editing a remote CVS controlled file as a different user, VC
6866;; gets confused about the file locking status. Try to find out why 7052;; gets confused about the file locking status. Try to find out why
6867;; the workaround doesn't work. 7053;; the workaround doesn't work.
6868;; * When user is running ssh-agent, it would be useful to add the
6869;; passwords typed by the user to that agent. This way, the next time
6870;; round, the users don't have to type all this in again.
6871;; This would be especially useful for start-process, I think.
6872;; An easy way to implement start-process is to open a second shell
6873;; connection which is inconvenient if the user has to reenter
6874;; passwords.
6875;; * Change `copy-file' to grok the case where the filename handler 7054;; * Change `copy-file' to grok the case where the filename handler
6876;; for the source and the target file are different. Right now, 7055;; for the source and the target file are different. Right now,
6877;; it looks at the source file and then calls that handler, if 7056;; it looks at the source file and then calls that handler, if
@@ -6895,17 +7074,10 @@ report.
6895 7074
6896;; Functions for file-name-handler-alist: 7075;; Functions for file-name-handler-alist:
6897;; diff-latest-backup-file -- in diff.el 7076;; diff-latest-backup-file -- in diff.el
6898;; dired-compress-file
6899;; dired-uncache -- this will be needed when we do insert-directory caching 7077;; dired-uncache -- this will be needed when we do insert-directory caching
6900;; file-name-as-directory -- use primitive? 7078;; file-name-as-directory -- use primitive?
6901;; file-name-directory -- use primitive?
6902;; file-name-nondirectory -- use primitive?
6903;; file-name-sans-versions -- use primitive? 7079;; file-name-sans-versions -- use primitive?
6904;; file-newer-than-file-p
6905;; find-backup-file-name
6906;; get-file-buffer -- use primitive 7080;; get-file-buffer -- use primitive
6907;; load
6908;; unhandled-file-name-directory
6909;; vc-registered 7081;; vc-registered
6910 7082
6911;;; arch-tag: 3a21a994-182b-48fa-b0cd-c1d9fede424a 7083;;; arch-tag: 3a21a994-182b-48fa-b0cd-c1d9fede424a