[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/net/tramp.el
From: |
Michael Albinus |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/net/tramp.el |
Date: |
Sat, 14 May 2005 11:39:15 -0400 |
Index: emacs/lisp/net/tramp.el
diff -c emacs/lisp/net/tramp.el:1.64 emacs/lisp/net/tramp.el:1.65
*** emacs/lisp/net/tramp.el:1.64 Sun Mar 20 20:00:20 2005
--- emacs/lisp/net/tramp.el Sat May 14 15:39:15 2005
***************
*** 1352,1358 ****
;; Chunked sending kluge. We set this to 500 for black-listed constellations
;; known to have a bug in `process-send-string'; some ssh connections appear
! ;; to drop bytes when data is sent too quickly.
(defcustom tramp-chunksize
(when (and (not (featurep 'xemacs))
(memq system-type '(hpux)))
--- 1352,1360 ----
;; Chunked sending kluge. We set this to 500 for black-listed constellations
;; known to have a bug in `process-send-string'; some ssh connections appear
! ;; to drop bytes when data is sent too quickly. There is also a connection
! ;; buffer local variable, which is computed depending on remote host
properties
! ;; when `tramp-chunksize' is zero or nil.
(defcustom tramp-chunksize
(when (and (not (featurep 'xemacs))
(memq system-type '(hpux)))
***************
*** 3231,3237 ****
(mapconcat #'tramp-shell-quote-argument (cons program arguments) " "))
(tramp-wait-for-output))
(unless discard
! (insert-buffer (tramp-get-buffer multi-method method user host)))
(save-excursion
(prog1
(tramp-send-command-and-check multi-method method user host nil)
--- 3233,3245 ----
(mapconcat #'tramp-shell-quote-argument (cons program arguments) " "))
(tramp-wait-for-output))
(unless discard
! ;; We cannot use `insert-buffer' because the tramp buffer
! ;; changes its contents before insertion due to calling
! ;; `expand-file' and alike.
! (insert
! (with-current-buffer
! (tramp-get-buffer multi-method method user host)
! (buffer-string))))
(save-excursion
(prog1
(tramp-send-command-and-check multi-method method user host nil)
***************
*** 3360,3367 ****
switches
(if wildcard
localname
! (tramp-shell-quote-argument
! (file-name-nondirectory localname))))))
(sit-for 1) ;needed for rsh but not ssh?
(tramp-wait-for-output))
;; The following let-binding is used by code that's commented
--- 3368,3377 ----
switches
(if wildcard
localname
! (if (zerop (length (file-name-nondirectory localname)))
! ""
! (tramp-shell-quote-argument
! (file-name-nondirectory localname)))))))
(sit-for 1) ;needed for rsh but not ssh?
(tramp-wait-for-output))
;; The following let-binding is used by code that's commented
***************
*** 3369,3376 ****
;; that the commented-out code is really not needed. Commenting-out
;; happened on 2003-03-13.
(let ((old-pos (point)))
! (insert-buffer-substring
! (tramp-get-buffer multi-method method user host))
;; On XEmacs, we want to call (exchange-point-and-mark t), but
;; that doesn't exist on Emacs, so we use this workaround instead.
;; Since zmacs-region-stays doesn't exist in Emacs, this ought to
--- 3379,3391 ----
;; that the commented-out code is really not needed. Commenting-out
;; happened on 2003-03-13.
(let ((old-pos (point)))
! ;; We cannot use `insert-buffer' because the tramp buffer
! ;; changes its contents before insertion due to calling
! ;; `expand-file' and alike.
! (insert
! (with-current-buffer
! (tramp-get-buffer multi-method method user host)
! (buffer-string)))
;; On XEmacs, we want to call (exchange-point-and-mark t), but
;; that doesn't exist on Emacs, so we use this workaround instead.
;; Since zmacs-region-stays doesn't exist in Emacs, this ought to
***************
*** 3561,3567 ****
(unless asynchronous
(tramp-wait-for-output)))
(unless asynchronous
! (insert-buffer (tramp-get-buffer multi-method method user host)))
(when error-buffer
(save-excursion
(unless (bufferp error-buffer)
--- 3576,3588 ----
(unless asynchronous
(tramp-wait-for-output)))
(unless asynchronous
! ;; We cannot use `insert-buffer' because the tramp buffer
! ;; changes its contents before insertion due to calling
! ;; `expand-file' and alike.
! (insert
! (with-current-buffer
! (tramp-get-buffer multi-method method user host)
! (buffer-string))))
(when error-buffer
(save-excursion
(unless (bufferp error-buffer)
***************
*** 3571,3577 ****
"cat /tmp/tramp.$$.err")
(tramp-wait-for-output)
(set-buffer error-buffer)
! (insert-buffer (tramp-get-buffer multi-method method user host))
(tramp-send-command-and-check
multi-method method user host "rm -f /tmp/tramp.$$.err")))
(save-excursion
--- 3592,3602 ----
"cat /tmp/tramp.$$.err")
(tramp-wait-for-output)
(set-buffer error-buffer)
! ;; Same comment as above
! (insert
! (with-current-buffer
! (tramp-get-buffer multi-method method user host)
! (buffer-string)))
(tramp-send-command-and-check
multi-method method user host "rm -f /tmp/tramp.$$.err")))
(save-excursion
***************
*** 4834,4839 ****
--- 4859,4867 ----
(defun tramp-set-auto-save ()
(when (and (buffer-file-name)
(tramp-tramp-file-p (buffer-file-name))
+ ;; ange-ftp has its own auto-save mechanism
+ (eq (tramp-find-foreign-file-name-handler (buffer-file-name))
+ 'tramp-sh-file-name-handler)
auto-save-default)
(auto-save-mode 1)))
(add-hook 'find-file-hooks 'tramp-set-auto-save t)
***************
*** 5417,5423 ****
method))
(when multi-method
(error "Cannot multi-connect using telnet connection method"))
! (tramp-pre-connection multi-method method user host)
(tramp-message 7 "Opening connection for address@hidden using %s..."
(or user (user-login-name)) host method)
(let ((process-environment (copy-sequence process-environment)))
--- 5445,5451 ----
method))
(when multi-method
(error "Cannot multi-connect using telnet connection method"))
! (tramp-pre-connection multi-method method user host tramp-chunksize)
(tramp-message 7 "Opening connection for address@hidden using %s..."
(or user (user-login-name)) host method)
(let ((process-environment (copy-sequence process-environment)))
***************
*** 5475,5481 ****
(save-match-data
(when multi-method
(error "Cannot multi-connect using rsh connection method"))
! (tramp-pre-connection multi-method method user host)
(if (and user (not (string= user "")))
(tramp-message 7 "Opening connection for address@hidden using %s..."
user host method)
--- 5503,5509 ----
(save-match-data
(when multi-method
(error "Cannot multi-connect using rsh connection method"))
! (tramp-pre-connection multi-method method user host tramp-chunksize)
(if (and user (not (string= user "")))
(tramp-message 7 "Opening connection for address@hidden using %s..."
user host method)
***************
*** 5544,5550 ****
(error
"Cannot connect to different host `%s' with `su' connection method"
host))
! (tramp-pre-connection multi-method method user host)
(tramp-message 7 "Opening connection for `%s' using `%s'..."
(or user "<root>") method)
(let ((process-environment (copy-sequence process-environment)))
--- 5572,5578 ----
(error
"Cannot connect to different host `%s' with `su' connection method"
host))
! (tramp-pre-connection multi-method method user host tramp-chunksize)
(tramp-message 7 "Opening connection for `%s' using `%s'..."
(or user "<root>") method)
(let ((process-environment (copy-sequence process-environment)))
***************
*** 5609,5615 ****
(unless (and (= (length method) (length user))
(= (length method) (length host)))
(error "Arrays METHOD, USER, HOST must have equal length"))
! (tramp-pre-connection multi-method method user host)
(tramp-message 7 "Opening `%s' connection..." multi-method)
(let ((process-environment (copy-sequence process-environment)))
(setenv "TERM" tramp-terminal-type)
--- 5637,5643 ----
(unless (and (= (length method) (length user))
(= (length method) (length host)))
(error "Arrays METHOD, USER, HOST must have equal length"))
! (tramp-pre-connection multi-method method user host tramp-chunksize)
(tramp-message 7 "Opening `%s' connection..." multi-method)
(let ((process-environment (copy-sequence process-environment)))
(setenv "TERM" tramp-terminal-type)
***************
*** 5810,5816 ****
;; HHH: Not Changed. This might handle the case where USER is not
;; given in the "File name" very poorly. Then, the local
;; variable tramp-current-user will be set to nil.
! (defun tramp-pre-connection (multi-method method user host)
"Do some setup before actually logging in.
METHOD, USER and HOST specify the connection."
(set-buffer (tramp-get-buffer multi-method method user host))
--- 5838,5844 ----
;; HHH: Not Changed. This might handle the case where USER is not
;; given in the "File name" very poorly. Then, the local
;; variable tramp-current-user will be set to nil.
! (defun tramp-pre-connection (multi-method method user host chunksize)
"Do some setup before actually logging in.
METHOD, USER and HOST specify the connection."
(set-buffer (tramp-get-buffer multi-method method user host))
***************
*** 5818,5823 ****
--- 5846,5852 ----
(set (make-local-variable 'tramp-current-method) method)
(set (make-local-variable 'tramp-current-user) user)
(set (make-local-variable 'tramp-current-host) host)
+ (set (make-local-variable 'tramp-chunksize) chunksize)
(set (make-local-variable 'inhibit-eol-conversion) nil)
(erase-buffer))
***************
*** 5869,5874 ****
--- 5898,5917 ----
(erase-buffer)
(tramp-send-command-internal multi-method method user host
"TERM=dumb; export TERM")
+ (erase-buffer)
+ ;; Check whether the remote host suffers from buggy `send-process-string'.
+ ;; This is known for FreeBSD (see comment in `send_process', file
process.c).
+ ;; I've tested sending 624 bytes successfully, sending 625 bytes failed.
+ ;; Emacs makes a hack when this host type is detected locally. It cannot
+ ;; handle remote hosts, though.
+ (when (or (not tramp-chunksize) (zerop tramp-chunksize))
+ (tramp-message 9 "Checking remote host type for `send-process-string'
bug")
+ (tramp-send-command-internal multi-method method user host
+ "(uname -sr) 2>/dev/null")
+ (goto-char (point-min))
+ (when (looking-at "FreeBSD")
+ (setq tramp-chunksize 500)))
+
;; Try to set up the coding system correctly.
;; CCC this can't be the right way to do it. Hm.
(save-excursion
***************
*** 6948,6954 ****
;; Permissions should be set always, because there might be an old
;; auto-saved file belonging to another original file. This could
;; be a security threat.
! (set-file-modes buffer-auto-save-file-name (file-modes bfn)))))
(unless (or (> emacs-major-version 21)
(and (featurep 'xemacs)
--- 6991,6998 ----
;; Permissions should be set always, because there might be an old
;; auto-saved file belonging to another original file. This could
;; be a security threat.
! (set-file-modes buffer-auto-save-file-name
! (or (file-modes bfn) ?\600)))))
(unless (or (> emacs-major-version 21)
(and (featurep 'xemacs)
***************
*** 7226,7232 ****
tramp-yesno-prompt-regexp
tramp-yn-prompt-regexp
tramp-terminal-prompt-regexp
- tramp-out-of-band-prompt-regexp
tramp-temp-name-prefix
tramp-file-name-structure
tramp-file-name-regexp
--- 7270,7275 ----
***************
*** 7286,7316 ****
(defun tramp-append-tramp-buffers ()
"Append Tramp buffers into the bug report."
! ;; We load mml.el from Gnus.
(if (featurep 'xemacs)
! (load "mml" 'noerror)
(require 'mml nil 'noerror))
(when (and
! ;; We don't want to add another dependency.
! (functionp 'mml-insert-empty-tag)
! ;; 2nd parameter since Emacs 22.
! (condition-case nil
! (list-buffers-noselect nil nil)
! (t nil)))
! (let ((buffer-list
! (delq nil
! (mapcar '(lambda (b)
! (when (string-match "^\\*\\(debug \\)?tramp/" (buffer-name b)) b))
! (buffer-list))))
! (curbuf (current-buffer)))
;; There is at least one Tramp buffer.
(when buffer-list
! (switch-to-buffer (list-buffers-noselect nil buffer-list))
(delete-other-windows)
(setq buffer-read-only nil)
! (goto-char (point-max))
(insert "
The buffer(s) above will be appended to this message. If you don't want
to append a buffer because it contains sensible data, or because the buffer
--- 7329,7372 ----
(defun tramp-append-tramp-buffers ()
"Append Tramp buffers into the bug report."
! ;; We load message.el and mml.el from Gnus.
(if (featurep 'xemacs)
! (progn
! (load "message" 'noerror)
! (load "mml" 'noerror))
! (require 'message nil 'noerror)
(require 'mml nil 'noerror))
+ (when (functionp 'message-mode)
+ (funcall 'message-mode))
+ (when (functionp 'mml-mode)
+ (funcall 'mml-mode t))
(when (and
! (eq major-mode 'message-mode)
! (boundp 'mml-mode)
! (symbol-value 'mml-mode))
!
! (let* ((tramp-buf-regexp "\\*\\(debug \\)?tramp/")
! (buffer-list
! (delq nil
! (mapcar '(lambda (b)
! (when (string-match tramp-buf-regexp (buffer-name b)) b))
! (buffer-list))))
! (curbuf (current-buffer)))
;; There is at least one Tramp buffer.
(when buffer-list
! (switch-to-buffer (list-buffers-noselect nil))
(delete-other-windows)
(setq buffer-read-only nil)
! (goto-char (point-min))
! (while (not (eobp))
! (if (re-search-forward tramp-buf-regexp (tramp-point-at-eol) t)
! (forward-line 1)
! (forward-line 0)
! (let ((start (point)))
! (forward-line 1)
! (kill-region start (point)))))
(insert "
The buffer(s) above will be appended to this message. If you don't want
to append a buffer because it contains sensible data, or because the buffer
- [Emacs-diffs] Changes to emacs/lisp/net/tramp.el,
Michael Albinus <=