diff options
| author | Michael Albinus | 2008-07-23 19:17:55 +0000 |
|---|---|---|
| committer | Michael Albinus | 2008-07-23 19:17:55 +0000 |
| commit | 2296b54d601490849ce3555ea033ca906c29eda7 (patch) | |
| tree | 218a7c541c7a9251db19cc6c145c7d4bba7779c7 | |
| parent | 49e3189d6a931a1f3e25f354b1a9f843b7b43b67 (diff) | |
| download | emacs-2296b54d601490849ce3555ea033ca906c29eda7.tar.gz emacs-2296b54d601490849ce3555ea033ca906c29eda7.zip | |
* net/tramp.el (tramp-methods): Add "-q" for "scp", "scp1",
"scp2", "ssh", "ssh1", "ssh2", "scpc", "scpx", "sshx".
(tramp-temp-buffer-name): New defconst.
(tramp-handle-start-file-process): Use it. Apply "exec", for the
command. No trailing prompt.
(tramp-process-sentinel): Remove temporary buffer, if existing.
Don't handle trailing prompt.
(tramp-open-connection-setup-interactive-shell): Use
`tramp-temp-buffer-name'.
| -rw-r--r-- | lisp/ChangeLog | 12 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 61 |
2 files changed, 44 insertions, 29 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2b026879524..ba139b20f56 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,15 @@ | |||
| 1 | 2008-07-23 Michael Albinus <michael.albinus@gmx.de> | ||
| 2 | |||
| 3 | * net/tramp.el (tramp-methods): Add "-q" for "scp", "scp1", | ||
| 4 | "scp2", "ssh", "ssh1", "ssh2", "scpc", "scpx", "sshx". | ||
| 5 | (tramp-temp-buffer-name): New defconst. | ||
| 6 | (tramp-handle-start-file-process): Use it. Apply "exec", for the | ||
| 7 | command. No trailing prompt. | ||
| 8 | (tramp-process-sentinel): Remove temporary buffer, if existing. | ||
| 9 | Don't handle trailing prompt. | ||
| 10 | (tramp-open-connection-setup-interactive-shell): Use | ||
| 11 | `tramp-temp-buffer-name'. | ||
| 12 | |||
| 1 | 2008-07-23 Chong Yidong <cyd@stupidchicken.com> | 13 | 2008-07-23 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 14 | ||
| 3 | * shell.el (shell-dynamic-complete-functions): Use | 15 | * shell.el (shell-dynamic-complete-functions): Use |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 5431290da52..b7792b0e90f 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -282,7 +282,7 @@ files conditionalize this setup based on the TERM environment variable." | |||
| 282 | (tramp-copy-keep-date t) | 282 | (tramp-copy-keep-date t) |
| 283 | (tramp-password-end-of-line nil)) | 283 | (tramp-password-end-of-line nil)) |
| 284 | ("scp" (tramp-login-program "ssh") | 284 | ("scp" (tramp-login-program "ssh") |
| 285 | (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") | 285 | (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") ("-q") |
| 286 | ("-e" "none"))) | 286 | ("-e" "none"))) |
| 287 | (tramp-remote-sh "/bin/sh") | 287 | (tramp-remote-sh "/bin/sh") |
| 288 | (tramp-copy-program "scp") | 288 | (tramp-copy-program "scp") |
| @@ -295,7 +295,7 @@ files conditionalize this setup based on the TERM environment variable." | |||
| 295 | ("-o" "StrictHostKeyChecking=no"))) | 295 | ("-o" "StrictHostKeyChecking=no"))) |
| 296 | (tramp-default-port 22)) | 296 | (tramp-default-port 22)) |
| 297 | ("scp1" (tramp-login-program "ssh") | 297 | ("scp1" (tramp-login-program "ssh") |
| 298 | (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") | 298 | (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") ("-q") |
| 299 | ("-1" "-e" "none"))) | 299 | ("-1" "-e" "none"))) |
| 300 | (tramp-remote-sh "/bin/sh") | 300 | (tramp-remote-sh "/bin/sh") |
| 301 | (tramp-copy-program "scp") | 301 | (tramp-copy-program "scp") |
| @@ -309,7 +309,7 @@ files conditionalize this setup based on the TERM environment variable." | |||
| 309 | ("-o" "StrictHostKeyChecking=no"))) | 309 | ("-o" "StrictHostKeyChecking=no"))) |
| 310 | (tramp-default-port 22)) | 310 | (tramp-default-port 22)) |
| 311 | ("scp2" (tramp-login-program "ssh") | 311 | ("scp2" (tramp-login-program "ssh") |
| 312 | (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") | 312 | (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") ("-q") |
| 313 | ("-2" "-e" "none"))) | 313 | ("-2" "-e" "none"))) |
| 314 | (tramp-remote-sh "/bin/sh") | 314 | (tramp-remote-sh "/bin/sh") |
| 315 | (tramp-copy-program "scp") | 315 | (tramp-copy-program "scp") |
| @@ -371,7 +371,7 @@ files conditionalize this setup based on the TERM environment variable." | |||
| 371 | (tramp-copy-keep-date nil) | 371 | (tramp-copy-keep-date nil) |
| 372 | (tramp-password-end-of-line nil)) | 372 | (tramp-password-end-of-line nil)) |
| 373 | ("ssh" (tramp-login-program "ssh") | 373 | ("ssh" (tramp-login-program "ssh") |
| 374 | (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") | 374 | (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") ("-q") |
| 375 | ("-e" "none"))) | 375 | ("-e" "none"))) |
| 376 | (tramp-remote-sh "/bin/sh") | 376 | (tramp-remote-sh "/bin/sh") |
| 377 | (tramp-copy-program nil) | 377 | (tramp-copy-program nil) |
| @@ -384,7 +384,7 @@ files conditionalize this setup based on the TERM environment variable." | |||
| 384 | ("-o" "StrictHostKeyChecking=no"))) | 384 | ("-o" "StrictHostKeyChecking=no"))) |
| 385 | (tramp-default-port 22)) | 385 | (tramp-default-port 22)) |
| 386 | ("ssh1" (tramp-login-program "ssh") | 386 | ("ssh1" (tramp-login-program "ssh") |
| 387 | (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") | 387 | (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") ("-q") |
| 388 | ("-1" "-e" "none"))) | 388 | ("-1" "-e" "none"))) |
| 389 | (tramp-remote-sh "/bin/sh") | 389 | (tramp-remote-sh "/bin/sh") |
| 390 | (tramp-copy-program nil) | 390 | (tramp-copy-program nil) |
| @@ -397,7 +397,7 @@ files conditionalize this setup based on the TERM environment variable." | |||
| 397 | ("-o" "StrictHostKeyChecking=no"))) | 397 | ("-o" "StrictHostKeyChecking=no"))) |
| 398 | (tramp-default-port 22)) | 398 | (tramp-default-port 22)) |
| 399 | ("ssh2" (tramp-login-program "ssh") | 399 | ("ssh2" (tramp-login-program "ssh") |
| 400 | (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") | 400 | (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") ("-q") |
| 401 | ("-2" "-e" "none"))) | 401 | ("-2" "-e" "none"))) |
| 402 | (tramp-remote-sh "/bin/sh") | 402 | (tramp-remote-sh "/bin/sh") |
| 403 | (tramp-copy-program nil) | 403 | (tramp-copy-program nil) |
| @@ -459,7 +459,7 @@ files conditionalize this setup based on the TERM environment variable." | |||
| 459 | (tramp-copy-keep-date nil) | 459 | (tramp-copy-keep-date nil) |
| 460 | (tramp-password-end-of-line nil)) | 460 | (tramp-password-end-of-line nil)) |
| 461 | ("scpc" (tramp-login-program "ssh") | 461 | ("scpc" (tramp-login-program "ssh") |
| 462 | (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") | 462 | (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") ("-q") |
| 463 | ("-o" "ControlPath=%t.%%r@%%h:%%p") | 463 | ("-o" "ControlPath=%t.%%r@%%h:%%p") |
| 464 | ("-o" "ControlMaster=yes") | 464 | ("-o" "ControlMaster=yes") |
| 465 | ("-e" "none"))) | 465 | ("-e" "none"))) |
| @@ -476,7 +476,7 @@ files conditionalize this setup based on the TERM environment variable." | |||
| 476 | ("-o" "StrictHostKeyChecking=no"))) | 476 | ("-o" "StrictHostKeyChecking=no"))) |
| 477 | (tramp-default-port 22)) | 477 | (tramp-default-port 22)) |
| 478 | ("scpx" (tramp-login-program "ssh") | 478 | ("scpx" (tramp-login-program "ssh") |
| 479 | (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") | 479 | (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") ("-q") |
| 480 | ("-e" "none" "-t" "-t" "/bin/sh"))) | 480 | ("-e" "none" "-t" "-t" "/bin/sh"))) |
| 481 | (tramp-remote-sh "/bin/sh") | 481 | (tramp-remote-sh "/bin/sh") |
| 482 | (tramp-copy-program "scp") | 482 | (tramp-copy-program "scp") |
| @@ -489,7 +489,7 @@ files conditionalize this setup based on the TERM environment variable." | |||
| 489 | ("-o" "StrictHostKeyChecking=no"))) | 489 | ("-o" "StrictHostKeyChecking=no"))) |
| 490 | (tramp-default-port 22)) | 490 | (tramp-default-port 22)) |
| 491 | ("sshx" (tramp-login-program "ssh") | 491 | ("sshx" (tramp-login-program "ssh") |
| 492 | (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") | 492 | (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p") ("-q") |
| 493 | ("-e" "none" "-t" "-t" "/bin/sh"))) | 493 | ("-e" "none" "-t" "-t" "/bin/sh"))) |
| 494 | (tramp-remote-sh "/bin/sh") | 494 | (tramp-remote-sh "/bin/sh") |
| 495 | (tramp-copy-program nil) | 495 | (tramp-copy-program nil) |
| @@ -1076,6 +1076,10 @@ part, though." | |||
| 1076 | :group 'tramp | 1076 | :group 'tramp |
| 1077 | :type 'string) | 1077 | :type 'string) |
| 1078 | 1078 | ||
| 1079 | (defconst tramp-temp-buffer-name " *tramp temp*" | ||
| 1080 | "Buffer name for a temporary buffer. | ||
| 1081 | It shall be used in combination with `generate-new-buffer-name'.") | ||
| 1082 | |||
| 1079 | (defcustom tramp-sh-extra-args '(("/bash\\'" . "-norc -noprofile")) | 1083 | (defcustom tramp-sh-extra-args '(("/bash\\'" . "-norc -noprofile")) |
| 1080 | "*Alist specifying extra arguments to pass to the remote shell. | 1084 | "*Alist specifying extra arguments to pass to the remote shell. |
| 1081 | Entries are (REGEXP . ARGS) where REGEXP is a regular expression | 1085 | Entries are (REGEXP . ARGS) where REGEXP is a regular expression |
| @@ -3674,12 +3678,13 @@ beginning of local filename are not substituted." | |||
| 3674 | (with-parsed-tramp-file-name default-directory nil | 3678 | (with-parsed-tramp-file-name default-directory nil |
| 3675 | (unwind-protect | 3679 | (unwind-protect |
| 3676 | (progn | 3680 | (progn |
| 3681 | (unless buffer | ||
| 3682 | ;; BUFFER can be nil. We use a temporary buffer, which is | ||
| 3683 | ;; killed in `tramp-process-sentinel'. | ||
| 3684 | (setq buffer (generate-new-buffer tramp-temp-buffer-name))) | ||
| 3677 | ;; Set the new process properties. | 3685 | ;; Set the new process properties. |
| 3678 | (tramp-set-connection-property v "process-name" name) | 3686 | (tramp-set-connection-property v "process-name" name) |
| 3679 | (tramp-set-connection-property | 3687 | (tramp-set-connection-property v "process-buffer" buffer) |
| 3680 | v "process-buffer" | ||
| 3681 | ;; BUFFER can be nil. | ||
| 3682 | (get-buffer-create (or buffer (current-buffer)))) | ||
| 3683 | ;; Activate narrowing in order to save BUFFER contents. | 3688 | ;; Activate narrowing in order to save BUFFER contents. |
| 3684 | ;; Clear also the modification time; otherwise we might be | 3689 | ;; Clear also the modification time; otherwise we might be |
| 3685 | ;; interrupted by `verify-visited-file-modtime'. | 3690 | ;; interrupted by `verify-visited-file-modtime'. |
| @@ -3693,10 +3698,9 @@ beginning of local filename are not substituted." | |||
| 3693 | ;; Send the command. | 3698 | ;; Send the command. |
| 3694 | (tramp-send-command | 3699 | (tramp-send-command |
| 3695 | v | 3700 | v |
| 3696 | (format "%s; echo %s; exit" | 3701 | (format "exec %s" |
| 3697 | (mapconcat 'tramp-shell-quote-argument | 3702 | (mapconcat 'tramp-shell-quote-argument |
| 3698 | (cons program args) " ") | 3703 | (cons program args) " ")) |
| 3699 | (tramp-shell-quote-argument tramp-end-of-output)) | ||
| 3700 | nil t) ; nooutput | 3704 | nil t) ; nooutput |
| 3701 | ;; Return process. | 3705 | ;; Return process. |
| 3702 | (tramp-get-connection-process v)) | 3706 | (tramp-get-connection-process v)) |
| @@ -5747,18 +5751,11 @@ seconds. If not, it produces an error message with the given ERROR-ARGS." | |||
| 5747 | "Process sentinel for Tramp processes." | 5751 | "Process sentinel for Tramp processes." |
| 5748 | (when (memq (process-status proc) '(stop exit signal)) | 5752 | (when (memq (process-status proc) '(stop exit signal)) |
| 5749 | (tramp-flush-connection-property proc) | 5753 | (tramp-flush-connection-property proc) |
| 5750 | ;; The "Connection closed" and "exit" messages disturb the output | 5754 | ;; Asynchronous processes might have a temporary buffer. Kill it. |
| 5751 | ;; for asynchronous processes. That's why we have echoed the | ||
| 5752 | ;; Tramp prompt at the end. Trailing messages can be removed. | ||
| 5753 | (let ((buf (process-buffer proc))) | 5755 | (let ((buf (process-buffer proc))) |
| 5754 | (when (buffer-live-p buf) | 5756 | (when (and (buffer-live-p buf) |
| 5755 | (with-current-buffer buf | 5757 | (string-match tramp-temp-buffer-name (buffer-name buf))) |
| 5756 | (goto-char (point-max)) | 5758 | (kill-buffer buf))))) |
| 5757 | (re-search-backward | ||
| 5758 | (mapconcat 'identity (split-string tramp-end-of-output "\n") | ||
| 5759 | "\r?\n") | ||
| 5760 | (line-beginning-position -8) t) | ||
| 5761 | (delete-region (point) (point-max))))))) | ||
| 5762 | 5759 | ||
| 5763 | (defun tramp-open-connection-setup-interactive-shell (proc vec) | 5760 | (defun tramp-open-connection-setup-interactive-shell (proc vec) |
| 5764 | "Set up an interactive shell. | 5761 | "Set up an interactive shell. |
| @@ -5857,7 +5854,8 @@ process to set up. VEC specifies the connection." | |||
| 5857 | (when (and (stringp old-uname) (not (string-equal old-uname new-uname))) | 5854 | (when (and (stringp old-uname) (not (string-equal old-uname new-uname))) |
| 5858 | (with-current-buffer (tramp-get-debug-buffer vec) | 5855 | (with-current-buffer (tramp-get-debug-buffer vec) |
| 5859 | ;; Keep the debug buffer | 5856 | ;; Keep the debug buffer |
| 5860 | (rename-buffer " *temp*" 'unique) | 5857 | (rename-buffer |
| 5858 | (generate-new-buffer-name tramp-temp-buffer-name) 'unique) | ||
| 5861 | (funcall (symbol-function 'tramp-cleanup-connection) vec) | 5859 | (funcall (symbol-function 'tramp-cleanup-connection) vec) |
| 5862 | (if (= (point-min) (point-max)) | 5860 | (if (= (point-min) (point-max)) |
| 5863 | (kill-buffer nil) | 5861 | (kill-buffer nil) |
| @@ -6351,7 +6349,7 @@ connection if a previous connection has died for some reason." | |||
| 6351 | l-host (match-string 1 l-host))) | 6349 | l-host (match-string 1 l-host))) |
| 6352 | 6350 | ||
| 6353 | ;; Set variables for computing the prompt for reading | 6351 | ;; Set variables for computing the prompt for reading |
| 6354 | ;; password. They can also be derived from a gatewy. | 6352 | ;; password. They can also be derived from a gateway. |
| 6355 | (setq tramp-current-method (or g-method l-method) | 6353 | (setq tramp-current-method (or g-method l-method) |
| 6356 | tramp-current-user (or g-user l-user) | 6354 | tramp-current-user (or g-user l-user) |
| 6357 | tramp-current-host (or g-host l-host)) | 6355 | tramp-current-host (or g-host l-host)) |
| @@ -7533,6 +7531,11 @@ Only works for Bourne-like shells." | |||
| 7533 | ;; detects that the process "has died". (David Reitter) | 7531 | ;; detects that the process "has died". (David Reitter) |
| 7534 | ;; * How can I interrupt the remote process with a signal | 7532 | ;; * How can I interrupt the remote process with a signal |
| 7535 | ;; (interrupt-process seems not to work)? (Markus Triska) | 7533 | ;; (interrupt-process seems not to work)? (Markus Triska) |
| 7534 | ;; * Avoid the local shell entirely for starting remote processes. If | ||
| 7535 | ;; so, I think even a signal, when delivered directly to the local | ||
| 7536 | ;; SSH instance, would correctly be propagated to the remote process | ||
| 7537 | ;; automatically; possibly SSH would have to be started with | ||
| 7538 | ;; "-t". (Markus Triska) | ||
| 7536 | 7539 | ||
| 7537 | ;; Functions for file-name-handler-alist: | 7540 | ;; Functions for file-name-handler-alist: |
| 7538 | ;; diff-latest-backup-file -- in diff.el | 7541 | ;; diff-latest-backup-file -- in diff.el |