diff options
| author | Michael Albinus | 2007-08-22 05:47:42 +0000 |
|---|---|---|
| committer | Michael Albinus | 2007-08-22 05:47:42 +0000 |
| commit | f84638eb6b84ccb7200cd1fdfd8cabfca90e4f7a (patch) | |
| tree | 982646be0617a51997d3ec3e0e1a21b2b33e99db | |
| parent | 45196e0ba7b0392033ccc9172e7481970ce39d8d (diff) | |
| download | emacs-f84638eb6b84ccb7200cd1fdfd8cabfca90e4f7a.tar.gz emacs-f84638eb6b84ccb7200cd1fdfd8cabfca90e4f7a.zip | |
* net/tramp.el (top): Require cl.el, when `copy-tree' is not available
otherwise.
(tramp-get-remote-path): New defun. Replace occurences of
`tramp-default-remote-path' by this function.
(tramp-set-remote-path): Move most of the code to
`tramp-get-remote-path'.
(tramp-get-ls-command, tramp-get-remote-id): Don't check for not
existing directories, this is done already in
`tramp-get-remote-path'.
| -rw-r--r-- | lisp/ChangeLog | 12 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 136 | ||||
| -rw-r--r-- | lisp/net/trampver.el | 2 |
3 files changed, 74 insertions, 76 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 93822965fa7..2b6fde4a231 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,15 @@ | |||
| 1 | 2007-08-22 Michael Albinus <michael.albinus@gmx.de> | ||
| 2 | |||
| 3 | * net/tramp.el (top): Require cl.el, when `copy-tree' is not available | ||
| 4 | otherwise. | ||
| 5 | (tramp-get-remote-path): New defun. Replace occurences of | ||
| 6 | `tramp-default-remote-path' by this function. | ||
| 7 | (tramp-set-remote-path): Move most of the code to | ||
| 8 | `tramp-get-remote-path'. | ||
| 9 | (tramp-get-ls-command, tramp-get-remote-id): Don't check for not | ||
| 10 | existing directories, this is done already in | ||
| 11 | `tramp-get-remote-path'. | ||
| 12 | |||
| 1 | 2007-08-22 Paul Pogonyshev <pogonyshev@gmx.net> | 13 | 2007-08-22 Paul Pogonyshev <pogonyshev@gmx.net> |
| 2 | 14 | ||
| 3 | * image-file.el (image-file-name-extensions): Add "svg". | 15 | * image-file.el (image-file-name-extensions): Add "svg". |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 1070d61cba6..9f326800f0e 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -88,6 +88,11 @@ | |||
| 88 | (require 'shell) | 88 | (require 'shell) |
| 89 | (require 'advice) | 89 | (require 'advice) |
| 90 | 90 | ||
| 91 | ;; `copy-tree' is part of subr.el since Emacs 22. | ||
| 92 | (eval-when-compile | ||
| 93 | (unless (functionp 'copy-tree) | ||
| 94 | (require 'cl))) | ||
| 95 | |||
| 91 | ;; Requiring 'tramp-cache results in an endless loop. | 96 | ;; Requiring 'tramp-cache results in an endless loop. |
| 92 | (autoload 'tramp-get-file-property "tramp-cache") | 97 | (autoload 'tramp-get-file-property "tramp-cache") |
| 93 | (autoload 'tramp-set-file-property "tramp-cache") | 98 | (autoload 'tramp-set-file-property "tramp-cache") |
| @@ -3467,7 +3472,7 @@ beginning of local filename are not substituted." | |||
| 3467 | (defun tramp-handle-executable-find (command) | 3472 | (defun tramp-handle-executable-find (command) |
| 3468 | "Like `executable-find' for Tramp files." | 3473 | "Like `executable-find' for Tramp files." |
| 3469 | (with-parsed-tramp-file-name default-directory nil | 3474 | (with-parsed-tramp-file-name default-directory nil |
| 3470 | (tramp-find-executable v command tramp-remote-path t))) | 3475 | (tramp-find-executable v command (tramp-get-remote-path v) t))) |
| 3471 | 3476 | ||
| 3472 | ;; We use BUFFER also as connection buffer during setup. Because of | 3477 | ;; We use BUFFER also as connection buffer during setup. Because of |
| 3473 | ;; this, its original contents must be saved, and restored once | 3478 | ;; this, its original contents must be saved, and restored once |
| @@ -5099,53 +5104,9 @@ I.e., for each directory in `tramp-remote-path', it is tested | |||
| 5099 | whether it exists and if so, it is added to the environment | 5104 | whether it exists and if so, it is added to the environment |
| 5100 | variable PATH." | 5105 | variable PATH." |
| 5101 | (tramp-message vec 5 (format "Setting $PATH environment variable")) | 5106 | (tramp-message vec 5 (format "Setting $PATH environment variable")) |
| 5102 | 5107 | (tramp-send-command | |
| 5103 | (with-current-buffer (tramp-get-connection-buffer vec) | 5108 | vec (format "PATH=%s; export PATH" |
| 5104 | (set (make-local-variable 'tramp-remote-path) | 5109 | (mapconcat 'identity (tramp-get-remote-path vec) ":")))) |
| 5105 | (copy-tree tramp-remote-path)) | ||
| 5106 | (let* ((elt (memq 'tramp-default-remote-path tramp-remote-path)) | ||
| 5107 | (tramp-default-remote-path | ||
| 5108 | (with-connection-property vec "default-remote-path" | ||
| 5109 | (when elt | ||
| 5110 | (condition-case nil | ||
| 5111 | (symbol-name | ||
| 5112 | (tramp-send-command-and-read vec "getconf PATH")) | ||
| 5113 | ;; Default if "getconf" is not available. | ||
| 5114 | (error | ||
| 5115 | (tramp-message | ||
| 5116 | vec 3 | ||
| 5117 | "`getconf PATH' not successful, using default value \"%s\"." | ||
| 5118 | "/bin:/usr/bin") | ||
| 5119 | "/bin:/usr/bin")))))) | ||
| 5120 | (when elt | ||
| 5121 | ;; Replace place holder `tramp-default-remote-path'. | ||
| 5122 | (setcdr elt | ||
| 5123 | (append | ||
| 5124 | (tramp-split-string tramp-default-remote-path ":") | ||
| 5125 | (cdr elt))) | ||
| 5126 | (setq tramp-remote-path | ||
| 5127 | (delq 'tramp-default-remote-path tramp-remote-path)))) | ||
| 5128 | |||
| 5129 | ;; Check for existence of directories. | ||
| 5130 | (setq tramp-remote-path | ||
| 5131 | (delq | ||
| 5132 | nil | ||
| 5133 | (mapcar | ||
| 5134 | (lambda (x) | ||
| 5135 | (and | ||
| 5136 | (with-connection-property vec x | ||
| 5137 | (file-directory-p | ||
| 5138 | (tramp-make-tramp-file-name | ||
| 5139 | (tramp-file-name-method vec) | ||
| 5140 | (tramp-file-name-user vec) | ||
| 5141 | (tramp-file-name-host vec) | ||
| 5142 | x))) | ||
| 5143 | x)) | ||
| 5144 | tramp-remote-path))) | ||
| 5145 | (tramp-send-command | ||
| 5146 | vec | ||
| 5147 | (format "PATH=%s; export PATH" | ||
| 5148 | (mapconcat 'identity tramp-remote-path ":"))))) | ||
| 5149 | 5110 | ||
| 5150 | ;; -- communication with external shell -- | 5111 | ;; -- communication with external shell -- |
| 5151 | 5112 | ||
| @@ -5210,8 +5171,10 @@ file exists and nonzero exit status otherwise." | |||
| 5210 | (cond | 5171 | (cond |
| 5211 | ((string-match "^~root$" (buffer-string)) | 5172 | ((string-match "^~root$" (buffer-string)) |
| 5212 | (setq shell | 5173 | (setq shell |
| 5213 | (or (tramp-find-executable vec "bash" tramp-remote-path t) | 5174 | (or (tramp-find-executable |
| 5214 | (tramp-find-executable vec "ksh" tramp-remote-path t))) | 5175 | vec "bash" (tramp-get-remote-path vec) t) |
| 5176 | (tramp-find-executable | ||
| 5177 | vec "ksh" (tramp-get-remote-path vec) t))) | ||
| 5215 | (unless shell | 5178 | (unless shell |
| 5216 | (tramp-error | 5179 | (tramp-error |
| 5217 | vec 'file-error | 5180 | vec 'file-error |
| @@ -6553,6 +6516,46 @@ necessary only. This function will be used in file name completion." | |||
| 6553 | 6516 | ||
| 6554 | ;; Variables local to connection. | 6517 | ;; Variables local to connection. |
| 6555 | 6518 | ||
| 6519 | (defun tramp-get-remote-path (vec) | ||
| 6520 | (with-connection-property vec "remote-path" | ||
| 6521 | (let* ((remote-path (copy-tree tramp-remote-path)) | ||
| 6522 | (elt (memq 'tramp-default-remote-path remote-path)) | ||
| 6523 | (default-remote-path | ||
| 6524 | (when elt | ||
| 6525 | (condition-case nil | ||
| 6526 | (symbol-name | ||
| 6527 | (tramp-send-command-and-read vec "getconf PATH")) | ||
| 6528 | ;; Default if "getconf" is not available. | ||
| 6529 | (error | ||
| 6530 | (tramp-message | ||
| 6531 | vec 3 | ||
| 6532 | "`getconf PATH' not successful, using default value \"%s\"." | ||
| 6533 | "/bin:/usr/bin") | ||
| 6534 | "/bin:/usr/bin"))))) | ||
| 6535 | (when elt | ||
| 6536 | ;; Replace place holder `tramp-default-remote-path'. | ||
| 6537 | (setcdr elt | ||
| 6538 | (append | ||
| 6539 | (tramp-split-string default-remote-path ":") | ||
| 6540 | (cdr elt))) | ||
| 6541 | (setq remote-path (delq 'tramp-default-remote-path remote-path))) | ||
| 6542 | |||
| 6543 | ;; Remove non-existing directories. | ||
| 6544 | (delq | ||
| 6545 | nil | ||
| 6546 | (mapcar | ||
| 6547 | (lambda (x) | ||
| 6548 | (and | ||
| 6549 | (with-connection-property vec x | ||
| 6550 | (file-directory-p | ||
| 6551 | (tramp-make-tramp-file-name | ||
| 6552 | (tramp-file-name-method vec) | ||
| 6553 | (tramp-file-name-user vec) | ||
| 6554 | (tramp-file-name-host vec) | ||
| 6555 | x))) | ||
| 6556 | x)) | ||
| 6557 | remote-path))))) | ||
| 6558 | |||
| 6556 | (defun tramp-get-ls-command (vec) | 6559 | (defun tramp-get-ls-command (vec) |
| 6557 | (with-connection-property vec "ls" | 6560 | (with-connection-property vec "ls" |
| 6558 | (with-current-buffer (tramp-get-buffer vec) | 6561 | (with-current-buffer (tramp-get-buffer vec) |
| @@ -6560,7 +6563,7 @@ necessary only. This function will be used in file name completion." | |||
| 6560 | (or | 6563 | (or |
| 6561 | (catch 'ls-found | 6564 | (catch 'ls-found |
| 6562 | (dolist (cmd '("ls" "gnuls" "gls")) | 6565 | (dolist (cmd '("ls" "gnuls" "gls")) |
| 6563 | (let ((dl tramp-remote-path) | 6566 | (let ((dl (tramp-get-remote-path vec)) |
| 6564 | result) | 6567 | result) |
| 6565 | (while | 6568 | (while |
| 6566 | (and | 6569 | (and |
| @@ -6571,13 +6574,6 @@ necessary only. This function will be used in file name completion." | |||
| 6571 | (when (zerop (tramp-send-command-and-check | 6574 | (when (zerop (tramp-send-command-and-check |
| 6572 | vec (format "%s -lnd /" result))) | 6575 | vec (format "%s -lnd /" result))) |
| 6573 | (throw 'ls-found result)) | 6576 | (throw 'ls-found result)) |
| 6574 | ;; Remove unneeded directories from path. | ||
| 6575 | (while | ||
| 6576 | (and | ||
| 6577 | dl | ||
| 6578 | (not | ||
| 6579 | (string-equal result (expand-file-name cmd (car dl))))) | ||
| 6580 | (setq dl (cdr dl))) | ||
| 6581 | (setq dl (cdr dl)))))) | 6577 | (setq dl (cdr dl)))))) |
| 6582 | (tramp-error vec 'file-error "Couldn't find a proper `ls' command"))))) | 6578 | (tramp-error vec 'file-error "Couldn't find a proper `ls' command"))))) |
| 6583 | 6579 | ||
| @@ -6587,7 +6583,7 @@ necessary only. This function will be used in file name completion." | |||
| 6587 | (tramp-message vec 5 "Finding a suitable `test' command") | 6583 | (tramp-message vec 5 "Finding a suitable `test' command") |
| 6588 | (if (zerop (tramp-send-command-and-check vec "test 0")) | 6584 | (if (zerop (tramp-send-command-and-check vec "test 0")) |
| 6589 | "test" | 6585 | "test" |
| 6590 | (tramp-find-executable vec "test" tramp-remote-path))))) | 6586 | (tramp-find-executable vec "test" (tramp-get-remote-path vec)))))) |
| 6591 | 6587 | ||
| 6592 | (defun tramp-get-test-nt-command (vec) | 6588 | (defun tramp-get-test-nt-command (vec) |
| 6593 | ;; Does `test A -nt B' work? Use abominable `find' construct if it | 6589 | ;; Does `test A -nt B' work? Use abominable `find' construct if it |
| @@ -6621,20 +6617,21 @@ necessary only. This function will be used in file name completion." | |||
| 6621 | (with-connection-property vec "ln" | 6617 | (with-connection-property vec "ln" |
| 6622 | (with-current-buffer (tramp-get-buffer vec) | 6618 | (with-current-buffer (tramp-get-buffer vec) |
| 6623 | (tramp-message vec 5 "Finding a suitable `ln' command") | 6619 | (tramp-message vec 5 "Finding a suitable `ln' command") |
| 6624 | (tramp-find-executable vec "ln" tramp-remote-path)))) | 6620 | (tramp-find-executable vec "ln" (tramp-get-remote-path vec))))) |
| 6625 | 6621 | ||
| 6626 | (defun tramp-get-remote-perl (vec) | 6622 | (defun tramp-get-remote-perl (vec) |
| 6627 | (with-connection-property vec "perl" | 6623 | (with-connection-property vec "perl" |
| 6628 | (with-current-buffer (tramp-get-buffer vec) | 6624 | (with-current-buffer (tramp-get-buffer vec) |
| 6629 | (tramp-message vec 5 "Finding a suitable `perl' command") | 6625 | (tramp-message vec 5 "Finding a suitable `perl' command") |
| 6630 | (or (tramp-find-executable vec "perl5" tramp-remote-path) | 6626 | (or (tramp-find-executable vec "perl5" (tramp-get-remote-path vec)) |
| 6631 | (tramp-find-executable vec "perl" tramp-remote-path))))) | 6627 | (tramp-find-executable vec "perl" (tramp-get-remote-path vec)))))) |
| 6632 | 6628 | ||
| 6633 | (defun tramp-get-remote-stat (vec) | 6629 | (defun tramp-get-remote-stat (vec) |
| 6634 | (with-connection-property vec "stat" | 6630 | (with-connection-property vec "stat" |
| 6635 | (with-current-buffer (tramp-get-buffer vec) | 6631 | (with-current-buffer (tramp-get-buffer vec) |
| 6636 | (tramp-message vec 5 "Finding a suitable `stat' command") | 6632 | (tramp-message vec 5 "Finding a suitable `stat' command") |
| 6637 | (let ((result (tramp-find-executable vec "stat" tramp-remote-path)) | 6633 | (let ((result (tramp-find-executable |
| 6634 | vec "stat" (tramp-get-remote-path vec))) | ||
| 6638 | tmp) | 6635 | tmp) |
| 6639 | ;; Check whether stat(1) returns usable syntax. | 6636 | ;; Check whether stat(1) returns usable syntax. |
| 6640 | (when result | 6637 | (when result |
| @@ -6656,7 +6653,7 @@ necessary only. This function will be used in file name completion." | |||
| 6656 | (tramp-message vec 5 "Finding POSIX `id' command") | 6653 | (tramp-message vec 5 "Finding POSIX `id' command") |
| 6657 | (or | 6654 | (or |
| 6658 | (catch 'id-found | 6655 | (catch 'id-found |
| 6659 | (let ((dl tramp-remote-path) | 6656 | (let ((dl (tramp-get-remote-path vec)) |
| 6660 | result) | 6657 | result) |
| 6661 | (while | 6658 | (while |
| 6662 | (and | 6659 | (and |
| @@ -6667,15 +6664,6 @@ necessary only. This function will be used in file name completion." | |||
| 6667 | (when (zerop (tramp-send-command-and-check | 6664 | (when (zerop (tramp-send-command-and-check |
| 6668 | vec (format "%s -u" result))) | 6665 | vec (format "%s -u" result))) |
| 6669 | (throw 'id-found result)) | 6666 | (throw 'id-found result)) |
| 6670 | ;; Remove unneeded directories from path. | ||
| 6671 | (while | ||
| 6672 | (and | ||
| 6673 | dl | ||
| 6674 | (not | ||
| 6675 | (string-equal | ||
| 6676 | result | ||
| 6677 | (concat (file-name-as-directory (car dl)) "id")))) | ||
| 6678 | (setq dl (cdr dl))) | ||
| 6679 | (setq dl (cdr dl))))) | 6667 | (setq dl (cdr dl))))) |
| 6680 | (tramp-error vec 'file-error "Couldn't find a POSIX `id' command"))))) | 6668 | (tramp-error vec 'file-error "Couldn't find a POSIX `id' command"))))) |
| 6681 | 6669 | ||
| @@ -7055,7 +7043,6 @@ Only works for Bourne-like shells." | |||
| 7055 | tramp-default-user-alist | 7043 | tramp-default-user-alist |
| 7056 | tramp-rsh-end-of-line | 7044 | tramp-rsh-end-of-line |
| 7057 | tramp-default-password-end-of-line | 7045 | tramp-default-password-end-of-line |
| 7058 | tramp-remote-path | ||
| 7059 | tramp-login-prompt-regexp | 7046 | tramp-login-prompt-regexp |
| 7060 | ;; Mask non-7bit characters | 7047 | ;; Mask non-7bit characters |
| 7061 | (tramp-password-prompt-regexp . tramp-reporter-dump-variable) | 7048 | (tramp-password-prompt-regexp . tramp-reporter-dump-variable) |
| @@ -7370,7 +7357,6 @@ please ensure that the buffers are attached to your email.\n\n") | |||
| 7370 | ;; * Grok `append' parameter for `write-region'. | 7357 | ;; * Grok `append' parameter for `write-region'. |
| 7371 | ;; * Test remote ksh or bash for tilde expansion in `tramp-find-shell'? | 7358 | ;; * Test remote ksh or bash for tilde expansion in `tramp-find-shell'? |
| 7372 | ;; * abbreviate-file-name | 7359 | ;; * abbreviate-file-name |
| 7373 | ;; * grok ~ in tramp-remote-path (Henrik Holm <henrikh@tele.ntnu.no>) | ||
| 7374 | ;; * better error checking. At least whenever we see something | 7360 | ;; * better error checking. At least whenever we see something |
| 7375 | ;; strange when doing zerop, we should kill the process and start | 7361 | ;; strange when doing zerop, we should kill the process and start |
| 7376 | ;; again. (Greg Stark) | 7362 | ;; again. (Greg Stark) |
diff --git a/lisp/net/trampver.el b/lisp/net/trampver.el index f10f08e1031..6e48c3c7f47 100644 --- a/lisp/net/trampver.el +++ b/lisp/net/trampver.el | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | ;; Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. | 5 | ;; Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. |
| 6 | 6 | ||
| 7 | ;; Author: Kai Großjohann <kai.grossjohann@gmx.net> | 7 | ;; Author: Kai Großjohann <kai.grossjohann@gmx.net> |
| 8 | ;; Keywords: comm, processes | 8 | ;; Keywords: comm, processes |
| 9 | 9 | ||
| 10 | ;; This file is part of GNU Emacs. | 10 | ;; This file is part of GNU Emacs. |