summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2007-11-07 20:41:15 +0000
committerMichael Albinus <michael.albinus@gmx.de>2007-11-07 20:41:15 +0000
commitb08104a01d188359cad1244e25f76b84956a3e75 (patch)
tree91849c8676f177ced7d026f318043d952c180174
parent855aae38de972893598dfb09d29555be496ced31 (diff)
downloademacs-b08104a01d188359cad1244e25f76b84956a3e75.tar.gz
emacs-b08104a01d188359cad1244e25f76b84956a3e75.tar.bz2
emacs-b08104a01d188359cad1244e25f76b84956a3e75.zip
* 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.
-rw-r--r--lisp/ChangeLog21
-rw-r--r--lisp/net/tramp-cache.el9
-rw-r--r--lisp/net/tramp-cmds.el2
-rw-r--r--lisp/net/tramp-ftp.el7
-rw-r--r--lisp/net/tramp-smb.el13
-rw-r--r--lisp/net/tramp.el16
6 files changed, 52 insertions, 16 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ba0db896abf..11cf35c54ed 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -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.
diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el
index 7f8d376452f..b28c20263f4 100644
--- a/lisp/net/tramp-cache.el
+++ b/lisp/net/tramp-cache.el
@@ -217,7 +217,7 @@ function is intended to run also as process sentinel."
(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 @@ function is intended to run also as process sentinel."
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 @@ function is intended to run also as process sentinel."
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)
diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el
index 415d45f922d..7cf2bf3d923 100644
--- a/lisp/net/tramp-cmds.el
+++ b/lisp/net/tramp-cmds.el
@@ -66,7 +66,7 @@ When called interactively, a Tramp connection has to be selected."
(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
diff --git a/lisp/net/tramp-ftp.el b/lisp/net/tramp-ftp.el
index 85416d308d3..a8b6bca44f2 100644
--- a/lisp/net/tramp-ftp.el
+++ b/lisp/net/tramp-ftp.el
@@ -143,10 +143,13 @@ pass to the OPERATION."
;; 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
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index c6c064daaf6..706042060f6 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -563,7 +563,14 @@ PRESERVE-UID-GID is completely ignored."
(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 @@ Catches errors for shares like \"C$/\", which are common in Microsoft Windows."
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 @@ Returns nil if an error message has appeared."
;; * 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
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index cf6a0b160b9..a207171a4a1 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -3561,8 +3561,8 @@ beginning of local filename are not substituted."
;; 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 @@ file exists and nonzero exit status otherwise."
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 @@ process to set up. VEC specifies the connection."
(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 @@ process to set up. VEC specifies the connection."
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