Commit b08104a0 authored by Michael Albinus's avatar Michael Albinus
Browse files

* 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.
parent 855aae38
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.
......
......@@ -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)
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment