From f8f91c2ba836b2b2f9b7f9c3768e39d76a8895c9 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Sat, 4 Jun 2011 15:58:37 +0200 Subject: [PATCH] * net/tramp.el (tramp-set-completion-function, tramp-parse-rhosts) (tramp-parse-shosts, tramp-parse-sconfig, tramp-parse-shostkeys) (tramp-parse-hosts, tramp-parse-passwd, tramp-parse-netrc) (tramp-parse-putty): * net/tramp-sh.el (tramp-completion-function-alist-rsh) (tramp-completion-function-alist-ssh) (tramp-completion-function-alist-telnet) (tramp-completion-function-alist-su) (tramp-completion-function-alist-putty): Set `tramp-autoload' cookie. * net/tramp-ftp.el: * net/tramp-sh.el: * net/tramp-smb.el: Set `tramp-autoload' cookie, and eval after load "tramp.el" `tramp-set-completion-function'. --- lisp/ChangeLog | 18 +++++++++++++ lisp/net/tramp-ftp.el | 8 +++--- lisp/net/tramp-sh.el | 71 +++++++++++++++++++++++++++++++-------------------- lisp/net/tramp-smb.el | 8 +++--- lisp/net/tramp.el | 9 +++++++ 5 files changed, 80 insertions(+), 34 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2d42d38f834..75ab96c57a0 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,21 @@ +2011-06-04 Michael Albinus + + * net/tramp.el (tramp-set-completion-function, tramp-parse-rhosts) + (tramp-parse-shosts, tramp-parse-sconfig, tramp-parse-shostkeys) + (tramp-parse-hosts, tramp-parse-passwd, tramp-parse-netrc) + (tramp-parse-putty): + * net/tramp-sh.el (tramp-completion-function-alist-rsh) + (tramp-completion-function-alist-ssh) + (tramp-completion-function-alist-telnet) + (tramp-completion-function-alist-su) + (tramp-completion-function-alist-putty): Set `tramp-autoload' + cookie. + + * net/tramp-ftp.el: + * net/tramp-sh.el: + * net/tramp-smb.el: Set `tramp-autoload' cookie, and eval after + load "tramp.el" `tramp-set-completion-function'. + 2011-06-04 Stefan Monnier * shell.el: Require and use pcomplete. diff --git a/lisp/net/tramp-ftp.el b/lisp/net/tramp-ftp.el index d42a6f57ea9..71b3eacccea 100644 --- a/lisp/net/tramp-ftp.el +++ b/lisp/net/tramp-ftp.el @@ -113,9 +113,11 @@ present for backward compatibility." (list nil "\\`\\(anonymous\\|ftp\\)\\'" tramp-ftp-method))) ;; Add completion function for FTP method. -(tramp-set-completion-function - tramp-ftp-method - '((tramp-parse-netrc "~/.netrc"))) +;;;###tramp-autoload +(eval-after-load 'tramp + '(tramp-set-completion-function + tramp-ftp-method + '((tramp-parse-netrc "~/.netrc")))) ;; If there is URL syntax, `substitute-in-file-name' needs special ;; handling. diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index a25877abe90..4ac523a2a17 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -400,11 +400,13 @@ detected as prompt when being sent on echoing hosts, therefore.") "\\'") nil ,(user-login-name))) +;;;###tramp-autoload (defconst tramp-completion-function-alist-rsh '((tramp-parse-rhosts "/etc/hosts.equiv") (tramp-parse-rhosts "~/.rhosts")) "Default list of (FUNCTION FILE) pairs to be examined for rsh methods.") +;;;###tramp-autoload (defconst tramp-completion-function-alist-ssh '((tramp-parse-rhosts "/etc/hosts.equiv") (tramp-parse-rhosts "/etc/shosts.equiv") @@ -420,47 +422,60 @@ detected as prompt when being sent on echoing hosts, therefore.") (tramp-parse-sknownhosts "~/.ssh2/knownhosts")) "Default list of (FUNCTION FILE) pairs to be examined for ssh methods.") +;;;###tramp-autoload (defconst tramp-completion-function-alist-telnet '((tramp-parse-hosts "/etc/hosts")) "Default list of (FUNCTION FILE) pairs to be examined for telnet methods.") +;;;###tramp-autoload (defconst tramp-completion-function-alist-su '((tramp-parse-passwd "/etc/passwd")) "Default list of (FUNCTION FILE) pairs to be examined for su methods.") +;;;###tramp-autoload (defconst tramp-completion-function-alist-putty '((tramp-parse-putty "HKEY_CURRENT_USER\\Software\\SimonTatham\\PuTTY\\Sessions")) "Default list of (FUNCTION REGISTRY) pairs to be examined for putty methods.") -(tramp-set-completion-function "rcp" tramp-completion-function-alist-rsh) -(tramp-set-completion-function "remcp" tramp-completion-function-alist-rsh) -(tramp-set-completion-function "scp" tramp-completion-function-alist-ssh) -(tramp-set-completion-function "scp1" tramp-completion-function-alist-ssh) -(tramp-set-completion-function "scp2" tramp-completion-function-alist-ssh) -(tramp-set-completion-function "scpc" tramp-completion-function-alist-ssh) -(tramp-set-completion-function "scpx" tramp-completion-function-alist-ssh) -(tramp-set-completion-function "sftp" tramp-completion-function-alist-ssh) -(tramp-set-completion-function "rsync" tramp-completion-function-alist-ssh) -(tramp-set-completion-function "rsyncc" tramp-completion-function-alist-ssh) -(tramp-set-completion-function "rsh" tramp-completion-function-alist-rsh) -(tramp-set-completion-function "remsh" tramp-completion-function-alist-rsh) -(tramp-set-completion-function "ssh" tramp-completion-function-alist-ssh) -(tramp-set-completion-function "ssh1" tramp-completion-function-alist-ssh) -(tramp-set-completion-function "ssh2" tramp-completion-function-alist-ssh) -(tramp-set-completion-function "ssh1_old" tramp-completion-function-alist-ssh) -(tramp-set-completion-function "ssh2_old" tramp-completion-function-alist-ssh) -(tramp-set-completion-function "sshx" tramp-completion-function-alist-ssh) -(tramp-set-completion-function "telnet" tramp-completion-function-alist-telnet) -(tramp-set-completion-function "su" tramp-completion-function-alist-su) -(tramp-set-completion-function "sudo" tramp-completion-function-alist-su) -(tramp-set-completion-function "ksu" tramp-completion-function-alist-su) -(tramp-set-completion-function "krlogin" tramp-completion-function-alist-rsh) -(tramp-set-completion-function "plink" tramp-completion-function-alist-ssh) -(tramp-set-completion-function "plink1" tramp-completion-function-alist-ssh) -(tramp-set-completion-function "plinkx" tramp-completion-function-alist-putty) -(tramp-set-completion-function "pscp" tramp-completion-function-alist-ssh) -(tramp-set-completion-function "fcp" tramp-completion-function-alist-ssh) +;;;###tramp-autoload +(eval-after-load 'tramp + '(progn + (tramp-set-completion-function "rcp" tramp-completion-function-alist-rsh) + (tramp-set-completion-function "remcp" tramp-completion-function-alist-rsh) + (tramp-set-completion-function "scp" tramp-completion-function-alist-ssh) + (tramp-set-completion-function "scp1" tramp-completion-function-alist-ssh) + (tramp-set-completion-function "scp2" tramp-completion-function-alist-ssh) + (tramp-set-completion-function "scpc" tramp-completion-function-alist-ssh) + (tramp-set-completion-function "scpx" tramp-completion-function-alist-ssh) + (tramp-set-completion-function "sftp" tramp-completion-function-alist-ssh) + (tramp-set-completion-function "rsync" tramp-completion-function-alist-ssh) + (tramp-set-completion-function + "rsyncc" tramp-completion-function-alist-ssh) + (tramp-set-completion-function "rsh" tramp-completion-function-alist-rsh) + (tramp-set-completion-function "remsh" tramp-completion-function-alist-rsh) + (tramp-set-completion-function "ssh" tramp-completion-function-alist-ssh) + (tramp-set-completion-function "ssh1" tramp-completion-function-alist-ssh) + (tramp-set-completion-function "ssh2" tramp-completion-function-alist-ssh) + (tramp-set-completion-function + "ssh1_old" tramp-completion-function-alist-ssh) + (tramp-set-completion-function + "ssh2_old" tramp-completion-function-alist-ssh) + (tramp-set-completion-function "sshx" tramp-completion-function-alist-ssh) + (tramp-set-completion-function + "telnet" tramp-completion-function-alist-telnet) + (tramp-set-completion-function "su" tramp-completion-function-alist-su) + (tramp-set-completion-function "sudo" tramp-completion-function-alist-su) + (tramp-set-completion-function "ksu" tramp-completion-function-alist-su) + (tramp-set-completion-function + "krlogin" tramp-completion-function-alist-rsh) + (tramp-set-completion-function "plink" tramp-completion-function-alist-ssh) + (tramp-set-completion-function + "plink1" tramp-completion-function-alist-ssh) + (tramp-set-completion-function + "plinkx" tramp-completion-function-alist-putty) + (tramp-set-completion-function "pscp" tramp-completion-function-alist-ssh) + (tramp-set-completion-function "fcp" tramp-completion-function-alist-ssh))) ;; "getconf PATH" yields: ;; HP-UX: /usr/bin:/usr/ccs/bin:/opt/ansic/bin:/opt/langtools/bin:/opt/fortran/bin diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index a43e99c1206..eb456298c1a 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el @@ -53,9 +53,11 @@ `(,(concat "\\`" tramp-smb-method "\\'") nil nil)) ;; Add completion function for SMB method. -(tramp-set-completion-function - tramp-smb-method - '((tramp-parse-netrc "~/.netrc"))) +;;;###tramp-autoload +(eval-after-load 'tramp + '(tramp-set-completion-function + tramp-smb-method + '((tramp-parse-netrc "~/.netrc")))) (defcustom tramp-smb-program "smbclient" "*Name of SMB client to run." diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 178f057a66c..8f1095a0486 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -1500,6 +1500,7 @@ letter into the file name. This function removes it." ;;; Config Manipulation Functions: +;;;###tramp-autoload (defun tramp-set-completion-function (method function-list) "Sets the list of completion functions for METHOD. FUNCTION-LIST is a list of entries of the form (FUNCTION FILE). @@ -2366,6 +2367,7 @@ PARTIAL-USER must match USER, PARTIAL-HOST must match HOST." (unless (zerop (+ (length user) (length host))) (tramp-completion-make-tramp-file-name method user host nil))) +;;;###tramp-autoload (defun tramp-parse-rhosts (filename) "Return a list of (user host) tuples allowed to access. Either user or host may be nil." @@ -2396,6 +2398,7 @@ Either user or host may be nil." (forward-line 1) result)) +;;;###tramp-autoload (defun tramp-parse-shosts (filename) "Return a list of (user host) tuples allowed to access. User is always nil." @@ -2425,6 +2428,7 @@ User is always nil." (forward-line 1)) result)) +;;;###tramp-autoload (defun tramp-parse-sconfig (filename) "Return a list of (user host) tuples allowed to access. User is always nil." @@ -2454,6 +2458,7 @@ User is always nil." (forward-line 1)) result)) +;;;###tramp-autoload (defun tramp-parse-shostkeys (dirname) "Return a list of (user host) tuples allowed to access. User is always nil." @@ -2485,6 +2490,7 @@ User is always nil." (setq files (cdr files))) result)) +;;;###tramp-autoload (defun tramp-parse-hosts (filename) "Return a list of (user host) tuples allowed to access. User is always nil." @@ -2519,6 +2525,7 @@ User is always nil." ;; as default. Unfortunately, we have no information whether any user name ;; has been typed already. So we use `tramp-current-user' as indication, ;; assuming it is set in `tramp-completion-handle-file-name-all-completions'. +;;;###tramp-autoload (defun tramp-parse-passwd (filename) "Return a list of (user host) tuples allowed to access. Host is always \"localhost\"." @@ -2548,6 +2555,7 @@ Host is always \"localhost\"." (forward-line 1) result)) +;;;###tramp-autoload (defun tramp-parse-netrc (filename) "Return a list of (user host) tuples allowed to access. User may be nil." @@ -2578,6 +2586,7 @@ User may be nil." (forward-line 1) result)) +;;;###tramp-autoload (defun tramp-parse-putty (registry) "Return a list of (user host) tuples allowed to access. User is always nil." -- 2.11.4.GIT