Mercurial > emacs
changeset 47578:6e910ba94c42
Version 2.0.22 released.
(tramp-parse-rhosts, tramp-parse-shosts)
(tramp-parse-hosts, tramp-parse-passwd): Apply `push' but
`add-to-list' for performance reasons.
(tramp-get-completion-user-host): Return `nil' in case both `user'
and 'host' are empty (not necessarily `nil'.
(tramp-parse-netrc, tramp-parse-netrc-group): New functions.
(tramp-user-regexp): " \t" are not user regexp characters.
(tramp-completion-handle-file-name-all-completions): Remove
Ange-FTP cmpletion. It has a bug not handling the "/ftp:" prefix
completely, and it returns local completions as well.
(tramp-completion-function-alist-ftp): New constant.
(tramp-completion-function-alist): Add completion function for
"ftp".
From Michael Albinus <Michael.Albinus@alcatel.de>.
author | Kai Großjohann <kgrossjo@eu.uu.net> |
---|---|
date | Sun, 22 Sep 2002 17:39:18 +0000 |
parents | 20336ef6b20a |
children | d5e1e2adcb67 |
files | lisp/ChangeLog lisp/net/tramp.el man/tramp.texi |
diffstat | 3 files changed, 81 insertions(+), 50 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Sun Sep 22 13:55:14 2002 +0000 +++ b/lisp/ChangeLog Sun Sep 22 17:39:18 2002 +0000 @@ -1,3 +1,21 @@ +2002-09-22 Kai Gro,b_(Bjohann <grossjoh@ls6.informatik.uni-dortmund.de> + + * net/tramp.el: Version 2.0.22 released. + (tramp-parse-rhosts, tramp-parse-shosts) + (tramp-parse-hosts, tramp-parse-passwd): Apply `push' but + `add-to-list' for performance reasons. + (tramp-get-completion-user-host): Return `nil' in case both `user' + and 'host' are empty (not necessarily `nil'. + (tramp-parse-netrc, tramp-parse-netrc-group): New functions. + (tramp-user-regexp): " \t" are not user regexp characters. + (tramp-completion-handle-file-name-all-completions): Remove + Ange-FTP cmpletion. It has a bug not handling the "/ftp:" prefix + completely, and it returns local completions as well. + (tramp-completion-function-alist-ftp): New constant. + (tramp-completion-function-alist): Add completion function for + "ftp". + From Michael Albinus <Michael.Albinus@alcatel.de>. + 2002-09-22 Kai Gro,b_(Bjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE> * net/tramp.el: Version 2.0.21 released.
--- a/lisp/net/tramp.el Sun Sep 22 13:55:14 2002 +0000 +++ b/lisp/net/tramp.el Sun Sep 22 17:39:18 2002 +0000 @@ -72,7 +72,7 @@ ;; In the Tramp CVS repository, the version numer is auto-frobbed from ;; the Makefile, so you should edit the top-level Makefile to change ;; the version number. -(defconst tramp-version "2.0.21" +(defconst tramp-version "2.0.22" "This version of tramp.") (defconst tramp-bug-report-address "tramp-devel@mail.freesoftware.fsf.org" @@ -656,7 +656,7 @@ (unless (memq system-type '(windows-nt)) '((tramp-parse-rhosts "/etc/hosts.equiv") (tramp-parse-rhosts "~/.rhosts"))) - "Default list of (FUNNCTION FILE) pairs to be examined for rsh methods." + "Default list of (FUNCTION FILE) pairs to be examined for rsh methods." ) ;; Default values for non-Unices seeked @@ -668,21 +668,28 @@ (tramp-parse-rhosts "~/.rhosts") (tramp-parse-rhosts "~/.shosts") (tramp-parse-shosts "~/.ssh/known_hosts"))) - "Default list of (FUNNCTION FILE) pairs to be examined for ssh methods." + "Default list of (FUNCTION FILE) pairs to be examined for ssh methods." ) ;; Default values for non-Unices seeked (defconst tramp-completion-function-alist-telnet (unless (memq system-type '(windows-nt)) '((tramp-parse-hosts "/etc/hosts"))) - "Default list of (FUNNCTION FILE) pairs to be examined for telnet methods." + "Default list of (FUNCTION FILE) pairs to be examined for telnet methods." ) ;; Default values for non-Unices seeked (defconst tramp-completion-function-alist-su (unless (memq system-type '(windows-nt)) '((tramp-parse-passwd "/etc/passwd"))) - "Default list of (FUNNCTION FILE) pairs to be examined for su methods." + "Default list of (FUNCTION FILE) pairs to be examined for su methods." +) + +;; Default values for non-Unices seeked +(defconst tramp-completion-function-alist-ftp + (unless (memq system-type '(windows-nt)) + '((tramp-parse-netrc "~/.netrc"))) + "Default list of (FUNCTION FILE) pairs to be examined for ftp methods." ) (defcustom tramp-completion-function-alist @@ -708,6 +715,7 @@ (cons "krlogin" tramp-completion-function-alist-rsh) (cons "plink" tramp-completion-function-alist-ssh) (cons "pscp" tramp-completion-function-alist-ssh) + (cons "ftp" tramp-completion-function-alist-ftp) (cons "fcp" nil) ) "*Alist of methods for remote files. @@ -720,9 +728,7 @@ * `tramp-parse-shosts' for \"ssh_known_hosts\" like files, * `tramp-parse-hosts' for \"/etc/hosts\" like files, and * `tramp-parse-passwd' for \"/etc/passwd\" like files. - -A FUNCTION parsing \".netrc\" file syntax doesn't exist in TRAMP. This -task is delegated to ange-ftp; its customization should be used instead. + * `tramp-parse-netrc ' for \".netrc\" like files. FUNCTION can also see a customer defined function. For more details see the info pages." @@ -934,7 +940,7 @@ :type 'regexp) (defcustom tramp-user-regexp - "[^:@/]*" + "[^:@/ \t]*" "*Regexp matching user names." :group 'tramp :type 'regexp) @@ -3611,10 +3617,6 @@ (let* ((fullname (concat directory filename)) - ;; prepare ange-ftp fix - (fix-ange-ftp-string - (concat tramp-ftp-method tramp-postfix-single-method-format)) - (fix-ange-ftp (string-match (concat "^" fix-ange-ftp-string) filename)) ;; local files (result (if (tramp-completion-mode fullname) @@ -3658,25 +3660,7 @@ ;; Possible methods (setq result - (append result (tramp-get-completion-methods m)))) - - ;; Ange-ftp completions. - ;; Filename might have the form "ftp:xxx". Ange-ftp isn't able to - ;; handle the prefix "ftp:" correctly in - ;; `ange-ftp-file-name-all-completions'; it simply calls - ;;`(all-completions file (ange-ftp-generate-root-prefixes))'. - ;; So we must wrap around. - (when (tramp-ange-ftp-file-name-p nil m) - (setq result (append result - (mapcar - '(lambda (x) (if fix-ange-ftp (concat fix-ange-ftp-string x) x)) - (catch 'tramp-forward-to-ange-ftp - (tramp-invoke-ange-ftp - 'file-name-all-completions - (if fix-ange-ftp - (substring filename (length fix-ange-ftp-string)) - filename) - directory))))))) + (append result (tramp-get-completion-methods m))))) (setq v (delq car v)))) @@ -3852,13 +3836,13 @@ (t (setq user nil host nil))) - (when (or user host) + (unless (zerop (+ (length user) (length host))) ;; we must remove leading "/". (substring (tramp-make-tramp-file-name nil method user host nil) 1))) (defun tramp-parse-rhosts (filename) "Return a list of (user host) tuples allowed to access. -Either user or host may be nil" +Either user or host may be nil." (let (res) (when (file-exists-p filename) @@ -3866,7 +3850,7 @@ (insert-file-contents filename) (goto-char (point-min)) (while (not (eobp)) - (add-to-list 'res (tramp-parse-rhosts-group))))) + (push (tramp-parse-rhosts-group) res)))) res)) ;; Taken from gnus/netrc.el @@ -3878,7 +3862,7 @@ (defun tramp-parse-rhosts-group () "Return a (user host) tuple allowed to access. -Either user or host may be nil" +Either user or host may be nil." (let ((result) (regexp @@ -3903,7 +3887,7 @@ (insert-file-contents filename) (goto-char (point-min)) (while (not (eobp)) - (add-to-list 'res (tramp-parse-shosts-group))))) + (push (tramp-parse-shosts-group) res)))) res)) (defun tramp-parse-shosts-group () @@ -3932,7 +3916,7 @@ (insert-file-contents filename) (goto-char (point-min)) (while (not (eobp)) - (add-to-list 'res (tramp-parse-hosts-group))))) + (push (tramp-parse-hosts-group) res)))) res)) (defun tramp-parse-hosts-group () @@ -3964,12 +3948,12 @@ (insert-file-contents filename) (goto-char (point-min)) (while (not (eobp)) - (add-to-list 'res (tramp-parse-passwd-group))))) + (push (tramp-parse-passwd-group) res)))) res))) (defun tramp-parse-passwd-group () "Return a (user host) tuple allowed to access. -User is always nil." +Host is always \"localhost\"." (let ((result) (regexp (concat "^\\(" tramp-user-regexp "\\):"))) @@ -3981,6 +3965,36 @@ (forward-line 1) result)) +(defun tramp-parse-netrc (filename) + "Return a list of (user host) tuples allowed to access. +User may be nil." + + (let (res) + (when (file-exists-p filename) + (with-temp-buffer + (insert-file-contents filename) + (goto-char (point-min)) + (while (not (eobp)) + (push (tramp-parse-netrc-group) res)))) + res)) + +(defun tramp-parse-netrc-group () + "Return a (user host) tuple allowed to access. +User may be nil." + + (let ((result) + (regexp + (concat + "^[ \t]*machine[ \t]+" "\\(" tramp-host-regexp "\\)" + "\\([ \t]+login[ \t]+" "\\(" tramp-user-regexp "\\)" "\\)?"))) + + (narrow-to-region (point) (tramp-point-at-eol)) + (when (re-search-forward regexp nil t) + (setq result (list (match-string 3) (match-string 1)))) + (widen) + (forward-line 1) + result)) + (defun tramp-completion-handle-expand-file-name (name &optional dir) "Like `expand-file-name' for tramp files." (let ((fullname (concat (or dir default-directory) name))) @@ -6461,7 +6475,7 @@ ;; without ":". Hmm. Worth a bug report? ;; ** Acknowledge port numbers. ;; ** Extend `tramp-get-completion-su' for NIS and shadow passwords. -;; ** Unify `tramp-parse-{rhosts,shosts,hosts,passwd}'. +;; ** Unify `tramp-parse-{rhosts,shosts,hosts,passwd,netrc}'. ;; Code is nearly identical. ;; ** Decide whiche files to take for searching user/host names depending on ;; operating system (windows-nt) in `tramp-completion-function-alist'.
--- a/man/tramp.texi Sun Sep 22 13:55:14 2002 +0000 +++ b/man/tramp.texi Sun Sep 22 17:39:18 2002 +0000 @@ -12,7 +12,7 @@ @c Makefile, so you should edit the top-level Makefile to change @c the version number. @macro trampver{} -2.0.21 +2.0.22 @end macro @c Entries for @command{install-info} to use @@ -1317,16 +1317,15 @@ @item @code{tramp-parse-passwd} @findex tramp-parse-passwd -Finally a method which parses @file{/etc/passwd} like files. -Obviously, it can return user names only. +A function which parses @file{/etc/passwd} like files. Obviously, it +can return user names only. + +@item @code{tramp-parse-netrc} +@findex tramp-parse-netrc + +Finally, a function which parses @file{~/.netrc} like files. @end table -@ifset emacs -A function which parses @file{~/.netrc"} file syntax doesn't exist in -@tramp{}, because this task is delegated to -@value{ftp-package-name}. Its customization should be used instead. -@end ifset - If you want to keep your own data in a file, with your own structure, you might provide such a function as well. This function must meet the following conventions: