Mercurial > emacs
comparison lisp/net/tramp.el @ 87648:7ae99e295dfd
* vc-git.el (vc-git--call): Apply `process-file' instead of
`call-process'.
* net/tramp.el (tramp-remote-process-environment): Add "LC_CTYPE=C".
Reported by Pete Forman <pete.forman@westerngeco.com>.
(tramp-perl-encode, tramp-perl-decode): Update copyrights.
(tramp-handle-process-file): Handle the case where DESTINATION is
a consp with t as car.
(tramp-wait-for-output): We shall remove exactly what has been
find by the search.
author | Michael Albinus <michael.albinus@gmx.de> |
---|---|
date | Tue, 08 Jan 2008 20:07:21 +0000 |
parents | 8b57223acf6b |
children | 107ccd98fa12 |
comparison
equal
deleted
inserted
replaced
87647:b04073873562 | 87648:7ae99e295dfd |
---|---|
1 ;;; tramp.el --- Transparent Remote Access, Multiple Protocol | 1 ;;; tramp.el --- Transparent Remote Access, Multiple Protocol |
2 ;;; -*- mode: Emacs-Lisp; coding: utf-8; -*- | 2 ;;; -*- mode: Emacs-Lisp; coding: utf-8; -*- |
3 | 3 |
4 ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, | 4 ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, |
5 ;; 2005, 2006, 2007 Free Software Foundation, Inc. | 5 ;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc. |
6 | 6 |
7 ;; (copyright statements below in code to be updated with the above notice) | 7 ;; (copyright statements below in code to be updated with the above notice) |
8 | 8 |
9 ;; Author: Kai Großjohann <kai.grossjohann@gmx.net> | 9 ;; Author: Kai Großjohann <kai.grossjohann@gmx.net> |
10 ;; Michael Albinus <michael.albinus@gmx.de> | 10 ;; Michael Albinus <michael.albinus@gmx.de> |
110 (when (featurep 'tramp-uu) | 110 (when (featurep 'tramp-uu) |
111 (unload-feature 'tramp-uu 'force)))) | 111 (unload-feature 'tramp-uu 'force)))) |
112 | 112 |
113 (autoload 'uudecode-decode-region "uudecode") | 113 (autoload 'uudecode-decode-region "uudecode") |
114 | 114 |
115 ;; The following Tramp packages must be loaded after Tramp, because | 115 ;; The following Tramp packages must be loaded after tramp.el, because |
116 ;; they require Tramp as well. | 116 ;; they require it as well. |
117 (eval-after-load "tramp" | 117 (eval-after-load "tramp" |
118 '(dolist | 118 '(dolist |
119 (feature | 119 (feature |
120 (list | 120 (list |
121 | 121 |
122 ;; Tramp commands. | 122 ;; Tramp interactive commands. |
123 'tramp-cmds | 123 'tramp-cmds |
124 | 124 |
125 ;; Load foreign FTP method. | 125 ;; Load foreign FTP method. |
126 (if (featurep 'xemacs) 'tramp-efs 'tramp-ftp) | 126 (if (featurep 'xemacs) 'tramp-efs 'tramp-ftp) |
127 | 127 |
889 :type 'string) | 889 :type 'string) |
890 | 890 |
891 ;; "getconf PATH" yields: | 891 ;; "getconf PATH" yields: |
892 ;; HP-UX: /usr/bin:/usr/ccs/bin:/opt/ansic/bin:/opt/langtools/bin:/opt/fortran/bin | 892 ;; HP-UX: /usr/bin:/usr/ccs/bin:/opt/ansic/bin:/opt/langtools/bin:/opt/fortran/bin |
893 ;; Solaris: /usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/SUNWspro/bin | 893 ;; Solaris: /usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/SUNWspro/bin |
894 ;; Linux (Debian, Suse): /bin:/usr/bin | 894 ;; GNU/Linux (Debian, Suse): /bin:/usr/bin |
895 ;; FreeBSD: /usr/bin:/bin:/usr/sbin:/sbin: - beware trailing ":"! | 895 ;; FreeBSD: /usr/bin:/bin:/usr/sbin:/sbin: - beware trailing ":"! |
896 (defcustom tramp-remote-path | 896 (defcustom tramp-remote-path |
897 '(tramp-default-remote-path "/usr/sbin" "/usr/local/bin" | 897 '(tramp-default-remote-path "/usr/sbin" "/usr/local/bin" |
898 "/local/bin" "/local/freeware/bin" "/local/gnu/bin" | 898 "/local/bin" "/local/freeware/bin" "/local/gnu/bin" |
899 "/usr/freeware/bin" "/usr/pkg/bin" "/usr/contrib/bin") | 899 "/usr/freeware/bin" "/usr/pkg/bin" "/usr/contrib/bin") |
912 :type '(repeat (choice | 912 :type '(repeat (choice |
913 (const :tag "Default Directories" tramp-default-remote-path) | 913 (const :tag "Default Directories" tramp-default-remote-path) |
914 (string :tag "Directory")))) | 914 (string :tag "Directory")))) |
915 | 915 |
916 (defcustom tramp-remote-process-environment | 916 (defcustom tramp-remote-process-environment |
917 `("HISTFILE=$HOME/.tramp_history" "HISTSIZE=1" "LC_TIME=C" | 917 `("HISTFILE=$HOME/.tramp_history" "HISTSIZE=1" "LC_CTYPE=C" "LC_TIME=C" |
918 ,(concat "TERM=" tramp-terminal-type) | 918 ,(concat "TERM=" tramp-terminal-type) |
919 "CDPATH=" "HISTORY=" "MAIL=" "MAILCHECK=" "MAILPATH=" | 919 "CDPATH=" "HISTORY=" "MAIL=" "MAILCHECK=" "MAILPATH=" |
920 "autocorrect=" "correct=") | 920 "autocorrect=" "correct=") |
921 | 921 |
922 "*List of environment variables to be set on the remote host. | 922 "*List of environment variables to be set on the remote host. |
1593 on the remote host.") | 1593 on the remote host.") |
1594 | 1594 |
1595 (defconst tramp-perl-encode | 1595 (defconst tramp-perl-encode |
1596 "%s -e ' | 1596 "%s -e ' |
1597 # This script is contributed by Juanma Barranquero <lektu@terra.es>. | 1597 # This script is contributed by Juanma Barranquero <lektu@terra.es>. |
1598 # Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 | 1598 # Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 |
1599 # Free Software Foundation, Inc. | 1599 # Free Software Foundation, Inc. |
1600 use strict; | 1600 use strict; |
1601 | 1601 |
1602 my %%trans = do { | 1602 my %%trans = do { |
1603 my $i = 0; | 1603 my $i = 0; |
1635 This string is passed to `format', so percent characters need to be doubled.") | 1635 This string is passed to `format', so percent characters need to be doubled.") |
1636 | 1636 |
1637 (defconst tramp-perl-decode | 1637 (defconst tramp-perl-decode |
1638 "%s -e ' | 1638 "%s -e ' |
1639 # This script is contributed by Juanma Barranquero <lektu@terra.es>. | 1639 # This script is contributed by Juanma Barranquero <lektu@terra.es>. |
1640 # Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 | 1640 # Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 |
1641 # Free Software Foundation, Inc. | 1641 # Free Software Foundation, Inc. |
1642 use strict; | 1642 use strict; |
1643 | 1643 |
1644 my %%trans = do { | 1644 my %%trans = do { |
1645 my $i = 0; | 1645 my $i = 0; |
1774 '((identity . tramp-sh-file-name-handler)) | 1774 '((identity . tramp-sh-file-name-handler)) |
1775 "Alist of elements (FUNCTION . HANDLER) for foreign methods handled specially. | 1775 "Alist of elements (FUNCTION . HANDLER) for foreign methods handled specially. |
1776 If (FUNCTION FILENAME) returns non-nil, then all I/O on that file is done by | 1776 If (FUNCTION FILENAME) returns non-nil, then all I/O on that file is done by |
1777 calling HANDLER.") | 1777 calling HANDLER.") |
1778 | 1778 |
1779 ;;; Internal functions which must come first. | 1779 ;;; Internal functions which must come first: |
1780 | 1780 |
1781 (defsubst tramp-debug-message (vec fmt-string &rest args) | 1781 (defsubst tramp-debug-message (vec fmt-string &rest args) |
1782 "Append message to debug buffer. | 1782 "Append message to debug buffer. |
1783 Message is formatted with FMT-STRING as control string and the remaining | 1783 Message is formatted with FMT-STRING as control string and the remaining |
1784 ARGS to actually emit the message (if applicable)." | 1784 ARGS to actually emit the message (if applicable)." |
2042 `(tramp-parse-connection-properties ,method) | 2042 `(tramp-parse-connection-properties ,method) |
2043 ;; The method related defaults. | 2043 ;; The method related defaults. |
2044 (cdr (assoc method tramp-completion-function-alist)))) | 2044 (cdr (assoc method tramp-completion-function-alist)))) |
2045 | 2045 |
2046 | 2046 |
2047 ;;; Fontification of `read-file-name'. | 2047 ;;; Fontification of `read-file-name': |
2048 | 2048 |
2049 ;; rfn-eshadow.el is part of Emacs 22. Its is autoloaded. | 2049 ;; rfn-eshadow.el is part of Emacs 22. It is autoloaded. |
2050 (defvar tramp-rfn-eshadow-overlay) | 2050 (defvar tramp-rfn-eshadow-overlay) |
2051 (make-variable-buffer-local 'tramp-rfn-eshadow-overlay) | 2051 (make-variable-buffer-local 'tramp-rfn-eshadow-overlay) |
2052 | 2052 |
2053 (defun tramp-rfn-eshadow-setup-minibuffer () | 2053 (defun tramp-rfn-eshadow-setup-minibuffer () |
2054 "Set up a minibuffer for `file-name-shadow-mode'. | 2054 "Set up a minibuffer for `file-name-shadow-mode'. |
3607 | 3607 |
3608 '(minibuffer-electric-separator | 3608 '(minibuffer-electric-separator |
3609 minibuffer-electric-tilde))) | 3609 minibuffer-electric-tilde))) |
3610 | 3610 |
3611 | 3611 |
3612 ;;; Remote commands. | 3612 ;;; Remote commands: |
3613 | 3613 |
3614 (defun tramp-handle-executable-find (command) | 3614 (defun tramp-handle-executable-find (command) |
3615 "Like `executable-find' for Tramp files." | 3615 "Like `executable-find' for Tramp files." |
3616 (with-parsed-tramp-file-name default-directory nil | 3616 (with-parsed-tramp-file-name default-directory nil |
3617 (tramp-find-executable v command (tramp-get-remote-path v) t))) | 3617 (tramp-find-executable v command (tramp-get-remote-path v) t))) |
3691 ;; output | 3691 ;; output |
3692 (cond | 3692 (cond |
3693 ((bufferp (car destination)) | 3693 ((bufferp (car destination)) |
3694 (setq outbuf (car destination))) | 3694 (setq outbuf (car destination))) |
3695 ((stringp (car destination)) | 3695 ((stringp (car destination)) |
3696 (setq outbuf (get-buffer-create (car destination))))) | 3696 (setq outbuf (get-buffer-create (car destination)))) |
3697 ((car destination) | |
3698 (setq outbuf (current-buffer)))) | |
3697 ;; stderr | 3699 ;; stderr |
3698 (cond | 3700 (cond |
3699 ((stringp (cadr destination)) | 3701 ((stringp (cadr destination)) |
3700 (setcar (cdr destination) (expand-file-name (cadr destination))) | 3702 (setcar (cdr destination) (expand-file-name (cadr destination))) |
3701 (if (tramp-equal-remote default-directory (cadr destination)) | 3703 (if (tramp-equal-remote default-directory (cadr destination)) |
4537 file-name-handler-alist) | 4539 file-name-handler-alist) |
4538 file-name-handler-alist)))) | 4540 file-name-handler-alist)))) |
4539 | 4541 |
4540 (add-hook 'tramp-unload-hook 'tramp-unload-file-name-handlers) | 4542 (add-hook 'tramp-unload-hook 'tramp-unload-file-name-handlers) |
4541 | 4543 |
4542 ;;; File name handler functions for completion mode. | 4544 ;;; File name handler functions for completion mode: |
4543 | 4545 |
4544 (defvar tramp-completion-mode nil | 4546 (defvar tramp-completion-mode nil |
4545 "If non-nil, external packages signal that they are in file name completion. | 4547 "If non-nil, external packages signal that they are in file name completion. |
4546 | 4548 |
4547 This is necessary, because Tramp uses a heuristic depending on last | 4549 This is necessary, because Tramp uses a heuristic depending on last |
6243 (unless nooutput (tramp-wait-for-output p)))) | 6245 (unless nooutput (tramp-wait-for-output p)))) |
6244 | 6246 |
6245 (defun tramp-wait-for-output (proc &optional timeout) | 6247 (defun tramp-wait-for-output (proc &optional timeout) |
6246 "Wait for output from remote rsh command." | 6248 "Wait for output from remote rsh command." |
6247 (with-current-buffer (process-buffer proc) | 6249 (with-current-buffer (process-buffer proc) |
6248 (let ((found | 6250 ;; Initially, `tramp-end-of-output' is "$ ". There might be |
6249 (tramp-wait-for-regexp | 6251 ;; leading escape sequences, which must be ignored. |
6250 proc timeout | 6252 (let* ((regexp (format "^[^$\n]*%s\r?$" (regexp-quote tramp-end-of-output))) |
6251 ;; Initially, `tramp-end-of-output' is "$ ". There might | 6253 (found (tramp-wait-for-regexp proc timeout regexp))) |
6252 ;; be leading escape sequences, which must be ignored. | |
6253 (format "^[^$\n]*%s\r?$" (regexp-quote tramp-end-of-output))))) | |
6254 (if found | 6254 (if found |
6255 (let (buffer-read-only) | 6255 (let (buffer-read-only) |
6256 (goto-char (point-max)) | 6256 (goto-char (point-max)) |
6257 (forward-line -2) | 6257 (re-search-backward regexp nil t) |
6258 (delete-region (point) (point-max))) | 6258 (delete-region (point) (point-max))) |
6259 (if timeout | 6259 (if timeout |
6260 (tramp-error | 6260 (tramp-error |
6261 proc 'file-error | 6261 proc 'file-error |
6262 "[[Remote prompt `%s' not found in %d secs]]" | 6262 "[[Remote prompt `%s' not found in %d secs]]" |