Mercurial > emacs
comparison lisp/net/tramp.el @ 80000:24a171b96a66
* net/tramp.el (tramp-handle-make-auto-save-file-name)
(tramp-completion-dissect-file-name, tramp-find-executable): Use
`mapc' instead of `mapcar'.
(tramp-open-connection-setup-interactive-shell): Send only single
prompt setting commands, in order to avoid double-prompt.
author | Michael Albinus <michael.albinus@gmx.de> |
---|---|
date | Sat, 02 Feb 2008 10:46:08 +0000 |
parents | 6888fd3398e8 |
children | 1b9faa405c59 |
comparison
equal
deleted
inserted
replaced
79999:6f8ec526965f | 80000:24a171b96a66 |
---|---|
3983 (let ((tramp-auto-save-directory tramp-auto-save-directory)) | 3983 (let ((tramp-auto-save-directory tramp-auto-save-directory)) |
3984 ;; File name must be unique. This is ensured with Emacs 22 (see | 3984 ;; File name must be unique. This is ensured with Emacs 22 (see |
3985 ;; UNIQUIFY element of `auto-save-file-name-transforms'); but for | 3985 ;; UNIQUIFY element of `auto-save-file-name-transforms'); but for |
3986 ;; all other cases we must do it ourselves. | 3986 ;; all other cases we must do it ourselves. |
3987 (when (boundp 'auto-save-file-name-transforms) | 3987 (when (boundp 'auto-save-file-name-transforms) |
3988 (mapcar | 3988 (mapc |
3989 '(lambda (x) | 3989 '(lambda (x) |
3990 (when (and (string-match (car x) buffer-file-name) | 3990 (when (and (string-match (car x) buffer-file-name) |
3991 (not (car (cddr x)))) | 3991 (not (car (cddr x)))) |
3992 (setq tramp-auto-save-directory | 3992 (setq tramp-auto-save-directory |
3993 (or tramp-auto-save-directory | 3993 (or tramp-auto-save-directory |
4766 "\\(" tramp-method-regexp "\\)" tramp-postfix-single-method-regexp | 4766 "\\(" tramp-method-regexp "\\)" tramp-postfix-single-method-regexp |
4767 "\\(" tramp-user-regexp "\\)" tramp-postfix-user-regexp | 4767 "\\(" tramp-user-regexp "\\)" tramp-postfix-user-regexp |
4768 "\\(" tramp-host-regexp x-nil "\\)$") | 4768 "\\(" tramp-host-regexp x-nil "\\)$") |
4769 1 2 3 nil))) | 4769 1 2 3 nil))) |
4770 | 4770 |
4771 (mapcar (lambda (regexp) | 4771 (mapc |
4772 (add-to-list 'result | 4772 (lambda (regexp) |
4773 (tramp-completion-dissect-file-name1 regexp name))) | 4773 (add-to-list 'result (tramp-completion-dissect-file-name1 regexp name))) |
4774 (list | 4774 (list |
4775 tramp-completion-file-name-structure1 | 4775 tramp-completion-file-name-structure1 |
4776 tramp-completion-file-name-structure2 | 4776 tramp-completion-file-name-structure2 |
4777 tramp-completion-file-name-structure3 | 4777 tramp-completion-file-name-structure3 |
4778 tramp-completion-file-name-structure4 | 4778 tramp-completion-file-name-structure4 |
4779 tramp-completion-file-name-structure5 | 4779 tramp-completion-file-name-structure5 |
4780 tramp-completion-file-name-structure6 | 4780 tramp-completion-file-name-structure6 |
4781 tramp-completion-file-name-structure7 | 4781 tramp-completion-file-name-structure7 |
4782 tramp-file-name-structure)) | 4782 tramp-file-name-structure)) |
4783 | 4783 |
4784 (delq nil result))) | 4784 (delq nil result))) |
4785 | 4785 |
4786 (defun tramp-completion-dissect-file-name1 (structure name) | 4786 (defun tramp-completion-dissect-file-name1 (structure name) |
4787 "Returns a `tramp-file-name' structure matching STRUCTURE. | 4787 "Returns a `tramp-file-name' structure matching STRUCTURE. |
5262 (format (concat "while read d; " | 5262 (format (concat "while read d; " |
5263 "do if test -x $d/%s -a -f $d/%s; " | 5263 "do if test -x $d/%s -a -f $d/%s; " |
5264 "then echo tramp_executable $d/%s; " | 5264 "then echo tramp_executable $d/%s; " |
5265 "break; fi; done <<'EOF'") | 5265 "break; fi; done <<'EOF'") |
5266 progname progname progname)) | 5266 progname progname progname)) |
5267 (mapcar (lambda (d) | 5267 (mapc (lambda (d) |
5268 (tramp-send-command multi-method method user host d)) | 5268 (tramp-send-command multi-method method user host d)) |
5269 dirlist) | 5269 dirlist) |
5270 (tramp-send-command multi-method method user host "EOF") | 5270 (tramp-send-command multi-method method user host "EOF") |
5271 (tramp-wait-for-output) | 5271 (tramp-wait-for-output) |
5272 (goto-char (point-max)) | 5272 (goto-char (point-max)) |
5273 (when (search-backward "tramp_executable " nil t) | 5273 (when (search-backward "tramp_executable " nil t) |
5274 (skip-chars-forward "^ ") | 5274 (skip-chars-forward "^ ") |
6254 ;; Douglas Gray Stephens <DGrayStephens@slb.com> says that we must | 6254 ;; Douglas Gray Stephens <DGrayStephens@slb.com> says that we must |
6255 ;; use "\n" here, not tramp-rsh-end-of-line. We also manually frob | 6255 ;; use "\n" here, not tramp-rsh-end-of-line. We also manually frob |
6256 ;; the last time we sent a command, to avoid tramp-send-command to send | 6256 ;; the last time we sent a command, to avoid tramp-send-command to send |
6257 ;; "echo are you awake". | 6257 ;; "echo are you awake". |
6258 (setq tramp-last-cmd-time (current-time)) | 6258 (setq tramp-last-cmd-time (current-time)) |
6259 (tramp-send-command-internal multi-method method user host | |
6260 "PROMPT_COMMAND=''") | |
6261 (erase-buffer) | |
6262 (tramp-send-command-internal multi-method method user host | |
6263 "PS2=''") | |
6264 (erase-buffer) | |
6265 (tramp-send-command-internal multi-method method user host | |
6266 "PS3=''") | |
6267 (erase-buffer) | |
6259 (tramp-send-command | 6268 (tramp-send-command |
6260 multi-method method user host | 6269 multi-method method user host |
6261 (format "PROMPT_COMMAND=''; PS1='%s%s%s'; PS2=''; PS3=''" | 6270 (format "PS1='%s%s%s'" |
6262 tramp-rsh-end-of-line | 6271 tramp-rsh-end-of-line |
6263 tramp-end-of-output | 6272 tramp-end-of-output |
6264 tramp-rsh-end-of-line)) | 6273 tramp-rsh-end-of-line)) |
6265 (tramp-wait-for-output)) | 6274 (tramp-wait-for-output)) |
6266 | 6275 |