changeset 85962:7f134b676a0c

* net/tramp.el (tramp-handle-substitute-in-file-name): Don't expand the remote connection identification. (tramp-find-shell, tramp-open-connection-setup-interactive-shell): Set also $PS2 and $PS3 when setting $PS1. Check for shell echoing before calling stty. * net/tramp-cache.el (tramp-cache-print) (tramp-dump-connection-properties): Fix docstring. (tramp-list-connections): Renamed from `tramp-cache-list-connections'. * net/tramp-cmds.el (tramp-cleanup-connection): Apply it. * net/tramp-ftp.el (tramp-ftp-file-name-handler): Don't expand the remote connection identification when setting connection property. * net/tramp-smb.el (tramp-smb-handle-substitute-in-file-name): "//" substitutes only in the local filename part.
author Michael Albinus <michael.albinus@gmx.de>
date Wed, 07 Nov 2007 20:41:15 +0000
parents 0fb6a3d219ce
children cc352b20c778
files lisp/ChangeLog lisp/net/tramp-cache.el lisp/net/tramp-cmds.el lisp/net/tramp-ftp.el lisp/net/tramp-smb.el lisp/net/tramp.el
diffstat 6 files changed, 52 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Wed Nov 07 13:08:20 2007 +0000
+++ b/lisp/ChangeLog	Wed Nov 07 20:41:15 2007 +0000
@@ -1,3 +1,24 @@
+2007-11-07  Michael Albinus  <michael.albinus@gmx.de>
+
+	* net/tramp.el (tramp-handle-substitute-in-file-name): Don't
+	expand the remote connection identification.
+	(tramp-find-shell, tramp-open-connection-setup-interactive-shell):
+	Set also $PS2 and $PS3 when setting $PS1.  Check for shell echoing
+	before calling stty.
+
+	* net/tramp-cache.el (tramp-cache-print)
+	(tramp-dump-connection-properties): Fix docstring.
+	(tramp-list-connections): Renamed from
+	`tramp-cache-list-connections'.
+
+	* net/tramp-cmds.el (tramp-cleanup-connection): Apply it.
+
+	* net/tramp-ftp.el (tramp-ftp-file-name-handler): Don't expand the
+	remote connection identification when setting connection property.
+
+	* net/tramp-smb.el (tramp-smb-handle-substitute-in-file-name):
+	"//" substitutes only in the local filename part.
+
 2007-11-07  David Hansen  <david.hansen@gmx.net>
 
 	* eshell/em-glob.el (eshell-extended-glob): Sort matches.
--- a/lisp/net/tramp-cache.el	Wed Nov 07 13:08:20 2007 +0000
+++ b/lisp/net/tramp-cache.el	Wed Nov 07 20:41:15 2007 +0000
@@ -217,7 +217,7 @@
   (remhash key tramp-cache-data))
 
 (defun tramp-cache-print (table)
-  "Prints hash table TABLE."
+  "Print hash table TABLE."
   (when (hash-table-p table)
     (let (result)
       (maphash
@@ -236,8 +236,8 @@
        table)
       result)))
 
-(defun tramp-cache-list-connections ()
-  "Return a list of all known connection vectors."
+(defun tramp-list-connections ()
+  "Return a list of all known connection vectors according to `tramp-cache'."
     (let (result)
       (maphash
        '(lambda (key value)
@@ -247,8 +247,7 @@
       result))
 
 (defun tramp-dump-connection-properties ()
-"Writes persistent connection properties into file
-`tramp-persistency-file-name'."
+  "Write persistent connection properties into file `tramp-persistency-file-name'."
   ;; We shouldn't fail, otherwise (X)Emacs might not be able to be closed.
   (condition-case nil
       (when (and (hash-table-p tramp-cache-data)
--- a/lisp/net/tramp-cmds.el	Wed Nov 07 13:08:20 2007 +0000
+++ b/lisp/net/tramp-cmds.el	Wed Nov 07 20:41:15 2007 +0000
@@ -66,7 +66,7 @@
 	       (tramp-file-name-user x)
 	       (tramp-file-name-host x)
 	       (tramp-file-name-localname x)))
-	    (tramp-cache-list-connections)))
+	    (tramp-list-connections)))
 	  name)
 
       (when connections
--- a/lisp/net/tramp-ftp.el	Wed Nov 07 13:08:20 2007 +0000
+++ b/lisp/net/tramp-ftp.el	Wed Nov 07 20:41:15 2007 +0000
@@ -143,10 +143,13 @@
        ;; cannot disable the file-name-handler this case.  We set the
        ;; connection property "started" in order to put the remote
        ;; location into the cache, which is helpful for further
-       ;; completion.
+       ;; completion.  We don't use `with-parsed-tramp-file-name',
+       ;; because this returns another user but the one declared in
+       ;; "~/.netrc".
        ((memq operation '(file-directory-p file-exists-p))
 	(if (apply 'ange-ftp-hook-function operation args)
-	    (with-parsed-tramp-file-name (car args) nil
+	    (let ((v (tramp-dissect-file-name (car args) t)))
+	      (aset v 0 tramp-ftp-method)
 	      (tramp-set-connection-property v "started" t))
 	  nil))
        ;; If the second argument of `copy-file' or `rename-file' is a
--- a/lisp/net/tramp-smb.el	Wed Nov 07 13:08:20 2007 +0000
+++ b/lisp/net/tramp-smb.el	Wed Nov 07 20:41:15 2007 +0000
@@ -563,7 +563,14 @@
 
 (defun tramp-smb-handle-substitute-in-file-name (filename)
   "Like `handle-substitute-in-file-name' for Tramp files.
-Catches errors for shares like \"C$/\", which are common in Microsoft Windows."
+\"//\" substitutes only in the local filename part.  Catches
+errors for shares like \"C$/\", which are common in Microsoft Windows."
+  (with-parsed-tramp-file-name filename nil
+    ;; Ignore in LOCALNAME everything before "//".
+    (when (and (stringp localname) (string-match ".+?/\\(/\\|~\\)" localname))
+      (setq filename
+	    (concat (file-remote-p filename)
+		    (replace-match "\\1" nil nil localname)))))
   (condition-case nil
       (tramp-run-real-handler 'substitute-in-file-name (list filename))
     (error filename)))
@@ -583,7 +590,7 @@
 				filename))
 	(tramp-error v 'file-error "File not overwritten")))
     ;; We must also flush the cache of the directory, because
-    ;; file-attributes reads the values from there.
+    ;; `file-attributes' reads the values from there.
     (tramp-flush-file-property v (file-name-directory localname))
     (tramp-flush-file-property v localname)
     (let ((file (tramp-smb-get-localname localname t))
@@ -1005,8 +1012,6 @@
 ;; * Return more comprehensive file permission string.  Think whether it is
 ;;   possible to implement `set-file-modes'.
 ;; * Handle links (FILENAME.LNK).
-;; * Maybe local tmp files should have the same extension like the original
-;;   files.  Strange behaviour with jka-compr otherwise?
 ;; * Try to remove the inclusion of dummy "" directory.  Seems to be at
 ;;   several places, especially in `tramp-smb-handle-insert-directory'.
 ;; * (RMS) Use unwind-protect to clean up the state so as to make the state
--- a/lisp/net/tramp.el	Wed Nov 07 13:08:20 2007 +0000
+++ b/lisp/net/tramp.el	Wed Nov 07 20:41:15 2007 +0000
@@ -3561,8 +3561,8 @@
       ;; Ignore in LOCALNAME everything before "//" or "/~".
       (when (and (stringp localname) (string-match ".+?/\\(/\\|~\\)" localname))
 	(setq filename
-	      (tramp-make-tramp-file-name
-	       method user host (replace-match "\\1" nil nil localname)))
+	      (concat (file-remote-p filename)
+		      (replace-match "\\1" nil nil localname)))
 	;; "/m:h:~" does not work for completion.  We use "/m:h:~/".
 	(when (string-match "~$" filename)
 	  (setq filename (concat filename "/"))))
@@ -5338,7 +5338,9 @@
 	   vec 5 "Starting remote shell `%s' for tilde expansion..." shell)
 	  (let ((tramp-end-of-output "$ "))
 	    (tramp-send-command
-	     vec (format "PROMPT_COMMAND='' PS1='$ ' exec %s" shell) t))
+	     vec
+	     (format "PROMPT_COMMAND='' PS1='$ ' PS2='' PS3='' exec %s" shell)
+	     t))
 	  (tramp-message vec 5 "Setting remote shell prompt...")
 	  ;; Douglas Gray Stephens <DGrayStephens@slb.com> says that we
 	  ;; must use "\n" here, not tramp-rsh-end-of-line.  Kai left the
@@ -5618,7 +5620,7 @@
     (tramp-send-command
      vec
      (format
-      "exec env 'ENV=' 'PROMPT_COMMAND=' 'PS1=$ ' %s"
+      "exec env 'ENV=' 'PROMPT_COMMAND=' 'PS1=$ ' PS2='' PS3='' %s"
       (tramp-get-method-parameter
        (tramp-file-name-method vec) 'tramp-remote-sh))
      t))
@@ -5632,6 +5634,12 @@
            tramp-end-of-output
 	   tramp-rsh-end-of-line)
    t)
+  ;; If the connection buffer is not empty, the remote shell is
+  ;; echoing, and the prompt has been detected through the echoed
+  ;; command.  We must reread for the real prompt.
+  (with-current-buffer (process-buffer proc)
+    (when (> (point-max) (point-min)) (tramp-wait-for-output proc)))
+  ;; Disable echo.
   (tramp-message vec 5 "Setting up remote shell environment")
   (tramp-send-command vec "stty -inlcr -echo kill '^U' erase '^H'" t)
   ;; Check whether the echo has really been disabled.  Some