aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/net
diff options
context:
space:
mode:
authorMichael Albinus <[email protected]>2007-08-07 20:30:20 +0000
committerMichael Albinus <[email protected]>2007-08-07 20:30:20 +0000
commit27e813fe4b976963ebc8851febc7902bbc869a51 (patch)
treeaa4bb68a123680fc31566ac50f20ad5926447062 /lisp/net
parentc94d5f81aaef23672bf1be040c9388f8fe9f88e5 (diff)
* net/tramp.el (tramp-wrong-passwd-regexp): Make the regexp more
global matching. (tramp-handle-process-file): Fix bug inserting resulting output. (tramp-handle-shell-command): Handle OUTPUT-BUFFER and ERROR-BUFFER more robust. Display output. (tramp-file-name-handler): Add a connection property when we found a foreign file name handler. This allows backends like ftp to profit also from usr/host name completion based on connection cache. (tramp-send-command-and-read): Search for trash after the regexp until eol only. In XEmacs, there is a problem with \n. * net/tramp-cache.el (top): Read persistent connection history when cache is empty.
Diffstat (limited to 'lisp/net')
-rw-r--r--lisp/net/tramp-cache.el5
-rw-r--r--lisp/net/tramp.el49
-rw-r--r--lisp/net/trampver.el2
3 files changed, 37 insertions, 19 deletions
diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el
index 79b0b53783..db08fe3b6d 100644
--- a/lisp/net/tramp-cache.el
+++ b/lisp/net/tramp-cache.el
@@ -290,9 +290,8 @@ history."
tramp-cache-data)
res))
-;; Read persistent connection history. Applied with
-;; `load-in-progress', because it shall be evaluated only once.
-(when load-in-progress
+;; Read persistent connection history.
+(when (zerop (hash-table-count tramp-cache-data))
(condition-case err
(with-temp-buffer
(insert-file-contents tramp-persistency-file-name)
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 5285b87313..1070d61cba 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1027,7 +1027,7 @@ The `sudo' program appears to insert a `^@' character into the prompt."
"Login incorrect"
"Login Incorrect"
"Connection refused"
- "Connection closed by foreign host."
+ "Connection closed"
"Sorry, try again."
"Name or service not known"
"Host key verification failed."
@@ -3581,8 +3581,11 @@ beginning of local filename are not substituted."
(tramp-send-command v command)
;; We should show the output anyway.
(when outbuf
- (with-current-buffer outbuf
- (insert-buffer-substring (tramp-get-connection-buffer v)))
+ (let ((output-string
+ (with-current-buffer (tramp-get-connection-buffer v)
+ (buffer-substring (point-min) (point-max)))))
+ (with-current-buffer outbuf
+ (insert output-string)))
(when display (display-buffer outbuf))))
;; When the user did interrupt, we should do it also.
(error
@@ -3614,12 +3617,20 @@ beginning of local filename are not substituted."
(let* ((asynchronous (string-match "[ \t]*&[ \t]*\\'" command))
(args (split-string (substring command 0 asynchronous) " "))
(output-buffer
- (or output-buffer
- (if asynchronous
- "*Async Shell Command*"
- "*Shell Command Output*")))
+ (cond
+ ((bufferp output-buffer) output-buffer)
+ ((stringp output-buffer) (get-buffer-create output-buffer))
+ (output-buffer (current-buffer))
+ (t (generate-new-buffer
+ (if asynchronous
+ "*Async Shell Command*"
+ "*Shell Command Output*")))))
+ (error-buffer
+ (cond
+ ((bufferp error-buffer) error-buffer)
+ ((stringp error-buffer) (get-buffer-create error-buffer))))
(buffer
- (if (and (not asynchronous) (bufferp error-buffer))
+ (if (and (not asynchronous) error-buffer)
(with-parsed-tramp-file-name default-directory nil
(list output-buffer (tramp-make-tramp-temp-file v)))
output-buffer)))
@@ -3637,7 +3648,10 @@ beginning of local filename are not substituted."
(when (listp buffer)
(with-current-buffer error-buffer
(insert-file-contents (cadr buffer)))
- (delete-file (cadr buffer))))))
+ (delete-file (buffer-file-name (cadr buffer))))
+ ;; There's some output, display it.
+ (when (with-current-buffer output-buffer (> (point-max) (point-min)))
+ (display-message-or-buffer output-buffer)))))
;; File Editing.
@@ -4177,8 +4191,12 @@ Falls back to normal file name handler if no tramp file name handler exists."
((and completion (zerop (length localname))
(memq operation '(file-name-as-directory)))
filename)
- ;; Call the backend function.
- (foreign (apply foreign operation args))
+ ;; Call the backend function. Set a connection property
+ ;; first, it will be reused for user/host name completion.
+ (foreign
+ (unless (zerop (length localname))
+ (tramp-set-connection-property v "started" nil))
+ (apply foreign operation args))
;; Nothing to do for us.
(t (tramp-run-real-handler operation args)))))))
@@ -6116,7 +6134,8 @@ In case there is no valid Lisp expression, it raises an error"
(condition-case nil
(prog1 (read (current-buffer))
;; Error handling.
- (when (re-search-forward "\\S-" nil t) (error)))
+ (when (re-search-forward "\\S-" (tramp-line-end-position) t)
+ (error)))
(error (tramp-error
vec 'file-error
"`%s' does not return a valid Lisp expression: `%s'"
@@ -6125,7 +6144,7 @@ In case there is no valid Lisp expression, it raises an error"
;; It seems that Tru64 Unix does not like it if long strings are sent
;; to it in one go. (This happens when sending the Perl
;; `file-attributes' implementation, for instance.) Therefore, we
-;; have this function which waits a bit at each line.
+;; have this function which sends the string in chunks.
(defun tramp-send-string (vec string)
"Send the STRING via connection VEC.
@@ -6143,7 +6162,7 @@ the remote host use line-endings as defined in the variable
;; Clean up the buffer. We cannot call `erase-buffer' because
;; narrowing might be in effect.
(let (buffer-read-only) (delete-region (point-min) (point-max)))
- ;; replace "\n" by `tramp-rsh-end-of-line'
+ ;; Replace "\n" by `tramp-rsh-end-of-line'.
(setq string
(mapconcat 'identity
(split-string string "\n")
@@ -6151,7 +6170,7 @@ the remote host use line-endings as defined in the variable
(unless (or (string= string "")
(string-equal (substring string -1) tramp-rsh-end-of-line))
(setq string (concat string tramp-rsh-end-of-line)))
- ;; send the string
+ ;; Send the string.
(if (and chunksize (not (zerop chunksize)))
(let ((pos 0)
(end (length string)))
diff --git a/lisp/net/trampver.el b/lisp/net/trampver.el
index f10f08e103..6e48c3c7f4 100644
--- a/lisp/net/trampver.el
+++ b/lisp/net/trampver.el
@@ -4,7 +4,7 @@
;; Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
-;; Author: Kai Großjohann <[email protected]>
+;; Author: Kai Gro�johann <[email protected]>
;; Keywords: comm, processes
;; This file is part of GNU Emacs.