changeset 82324:5399c02bfd07

* 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.
author Michael Albinus <michael.albinus@gmx.de>
date Tue, 07 Aug 2007 20:30:20 +0000
parents 3892324d724a
children c9f47b4c81d5
files lisp/ChangeLog lisp/net/tramp-cache.el lisp/net/tramp.el lisp/net/trampver.el
diffstat 4 files changed, 73 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Tue Aug 07 20:10:15 2007 +0000
+++ b/lisp/ChangeLog	Tue Aug 07 20:30:20 2007 +0000
@@ -1,3 +1,24 @@
+2007-08-07  Michael Albinus  <michael.albinus@gmx.de>
+
+	* net/tramp.el (tramp-wrong-passwd-regexp): Make the regexp more
+	global matching.
+	(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.
+
+2007-08-07  Nic Ferrier  <nferrier@tapsellferrier.co.uk>  (tiny change)
+
+	* net/tramp.el (tramp-handle-process-file): Fix bug inserting
+	resulting output.
+
 2007-08-07  Sam Steingold  <sds@gnu.org>
 
 	* progmodes/compile.el (compilation-start): Pass nil as startfile
@@ -295,21 +316,21 @@
 
 2007-07-29  Michael Albinus  <michael.albinus@gmx.de>
 
-	* tramp.el:
-	* tramp-uu.el:
-	* trampver.el: Use utf-8 encoding with coding cookie.
-
-	* tramp-cache.el:
-	* tramp-fish.el:
-	* tramp-ftp.el:
-	* tramp-gw.el:
-	* tramp-smb.el: Remove coding cookie.
-
-	* tramp.el (tramp-handle-verify-visited-file-modtime):
+	* net/tramp.el:
+	* net/tramp-uu.el:
+	* net/trampver.el: Use utf-8 encoding with coding cookie.
+
+	* net/tramp-cache.el:
+	* net/tramp-fish.el:
+	* net/tramp-ftp.el:
+	* net/tramp-gw.el:
+	* net/tramp-smb.el: Remove coding cookie.
+
+	* net/tramp.el (tramp-handle-verify-visited-file-modtime):
 	Flush buffer file-name's file property.
 	(tramp-handle-file-remote-p): The first parameter is FILENAME.
 
-	* trampver.el: Update release number.
+	* net/trampver.el: Update release number.
 
 2007-07-29  Juri Linkov  <juri@jurta.org>
 
@@ -863,9 +884,9 @@
 
 	Sync with Tramp 2.1.10.
 
-	* tramp.el (tramp-get-ls-command): Fyx typo.
-
-	* trampver.el: Update release number.
+	* net/tramp.el (tramp-get-ls-command): Fyx typo.
+
+	* net/trampver.el: Update release number.
 
 2007-07-22  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
 
--- a/lisp/net/tramp-cache.el	Tue Aug 07 20:10:15 2007 +0000
+++ b/lisp/net/tramp-cache.el	Tue Aug 07 20:30:20 2007 +0000
@@ -290,9 +290,8 @@
      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)
--- a/lisp/net/tramp.el	Tue Aug 07 20:10:15 2007 +0000
+++ b/lisp/net/tramp.el	Tue Aug 07 20:30:20 2007 +0000
@@ -1027,7 +1027,7 @@
 			"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 @@
 	      (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 @@
   (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 @@
       (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 @@
 	 ((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 @@
     (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 @@
 ;; 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 @@
       ;; 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 @@
       (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)))
--- a/lisp/net/trampver.el	Tue Aug 07 20:10:15 2007 +0000
+++ b/lisp/net/trampver.el	Tue Aug 07 20:30:20 2007 +0000
@@ -4,7 +4,7 @@
 
 ;; Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
 
-;; Author: Kai Großjohann <kai.grossjohann@gmx.net>
+;; Author: Kai Großjohann <kai.grossjohann@gmx.net>
 ;; Keywords: comm, processes
 
 ;; This file is part of GNU Emacs.