Mercurial > emacs
comparison lisp/net/netrc.el @ 110306:838fb634d1b0
Merge changes made in Gnus trunk.
gnus-sum.el: Avoid calling a hook function per summary line;
Call `gnus-summary-highlight-line' directly from all places that used to call it indirectly.
netrc.el (netrc-credentials): New conveniency function.
gnus-start.el (gnus-read-active-file-1): If gnus-agent isn't set, then do request scans from the backends.
author | Katsumi Yamaoka <yamaoka@jpl.org> |
---|---|
date | Sat, 11 Sep 2010 00:36:27 +0000 |
parents | 5b9f64b04a04 |
children | f2e111723c3a |
comparison
equal
deleted
inserted
replaced
110305:b10051866f51 | 110306:838fb634d1b0 |
---|---|
52 | 52 |
53 (defgroup netrc nil | 53 (defgroup netrc nil |
54 "Netrc configuration." | 54 "Netrc configuration." |
55 :group 'comm) | 55 :group 'comm) |
56 | 56 |
57 (defcustom netrc-file "~/.authinfo" | |
58 "File where user credentials are stored." | |
59 :type 'file | |
60 :group 'netrc) | |
61 | |
57 (defvar netrc-services-file "/etc/services" | 62 (defvar netrc-services-file "/etc/services" |
58 "The name of the services file.") | 63 "The name of the services file.") |
59 | 64 |
60 (defun netrc-parse (file) | 65 (defun netrc-parse (&optional file) |
61 (interactive "fFile to Parse: ") | 66 (interactive "fFile to Parse: ") |
62 "Parse FILE and return a list of all entries in the file." | 67 "Parse FILE and return a list of all entries in the file." |
68 (unless file | |
69 (setq file netrc-file)) | |
63 (if (listp file) | 70 (if (listp file) |
64 file | 71 file |
65 (when (file-exists-p file) | 72 (when (file-exists-p file) |
66 (with-temp-buffer | 73 (with-temp-buffer |
67 (let ((tokens '("machine" "default" "login" | 74 (let ((tokens '("machine" "default" "login" |
219 (while (and (setq service (pop services)) | 226 (while (and (setq service (pop services)) |
220 (not (and (string= name (car service)) | 227 (not (and (string= name (car service)) |
221 (eq type (car (cddr service))))))) | 228 (eq type (car (cddr service))))))) |
222 (cadr service))) | 229 (cadr service))) |
223 | 230 |
231 (defun netrc-credentials (machine &rest ports) | |
232 "Return a user name/password pair. | |
233 Port specifications will be prioritised in the order they are | |
234 listed in the PORTS list." | |
235 (let ((list (netrc-parse)) | |
236 found) | |
237 (while (and ports | |
238 (not found)) | |
239 (setq found (netrc-machine list machine (pop ports)))) | |
240 (when found | |
241 (list (cdr (assoc "login" found)) | |
242 (cdr (assoc "password" found)))))) | |
243 | |
224 (provide 'netrc) | 244 (provide 'netrc) |
225 | 245 |
226 ;;; netrc.el ends here | 246 ;;; netrc.el ends here |