From b61f6c9ac01b189c89bfba80885b6222746d6bc5 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Thu, 8 Nov 2018 12:21:48 +0100 Subject: [PATCH] Get rid of own netrc parsing implementation in Tramp * lisp/net/tramp.el (tramp-parse-netrc): Reimplement, using `netrc-parse'. (tramp-parse-netrc-group): Remove. --- lisp/net/tramp.el | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 34489b12422..4ee69d71986 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -60,6 +60,7 @@ ;; Pacify byte-compiler. (require 'cl-lib) +(declare-function netrc-parse "netrc") (defvar auto-save-file-name-transforms) (defvar eshell-path-env) (defvar ls-lisp-use-insert-directory-program) @@ -2970,20 +2971,11 @@ Host is always \"localhost\"." (defun tramp-parse-netrc (filename) "Return a list of (user host) tuples allowed to access. User may be nil." - (tramp-parse-file filename 'tramp-parse-netrc-group)) - -(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 "\\)" "\\)?"))) - (when (re-search-forward regexp (point-at-eol) t) - (setq result (list (match-string 3) (match-string 1)))) - (forward-line 1) - result)) + (mapcar + (lambda (item) + (and (assoc "machine" item) + `(,(cdr (assoc "login" item)) ,(cdr (assoc "machine" item))))) + (netrc-parse filename))) ;;;###tramp-autoload (defun tramp-parse-putty (registry-or-dirname) -- 2.39.5