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 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.
(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
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)
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)
(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
;; 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
(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)))
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))
;; * 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
;; 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 "/"))))
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
(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))
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