Mercurial > emacs
comparison lisp/net/netrc.el @ 87454:0cbc451989a7
Merge from gnus--devo--0
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-967
author | Miles Bader <miles@gnu.org> |
---|---|
date | Fri, 28 Dec 2007 22:26:31 +0000 |
parents | d549ccffa35b |
children | 107ccd98fa12 56a72e2bd635 |
comparison
equal
deleted
inserted
replaced
87453:cdd30283527d | 87454:0cbc451989a7 |
---|---|
33 | 33 |
34 ;;; | 34 ;;; |
35 ;;; .netrc and .authinfo rc parsing | 35 ;;; .netrc and .authinfo rc parsing |
36 ;;; | 36 ;;; |
37 | 37 |
38 ;; use encrypt if loaded (encrypt-file-alist has to be set as well) | |
39 (eval-and-compile | |
40 (autoload 'encrypt-find-model "encrypt") | |
41 (autoload 'encrypt-insert-file-contents "encrypt")) | |
38 (defalias 'netrc-point-at-eol | 42 (defalias 'netrc-point-at-eol |
39 (if (fboundp 'point-at-eol) | 43 (if (fboundp 'point-at-eol) |
40 'point-at-eol | 44 'point-at-eol |
41 'line-end-position)) | 45 'line-end-position)) |
46 (eval-when-compile | |
47 (defvar encrypt-file-alist) | |
48 ;; This is unnecessary in the compiled version as it is a macro. | |
49 (if (fboundp 'bound-and-true-p) | |
50 (defalias 'netrc-bound-and-true-p 'bound-and-true-p) | |
51 (defmacro netrc-bound-and-true-p (var) | |
52 "Return the value of symbol VAR if it is bound, else nil." | |
53 `(and (boundp (quote ,var)) ,var)))) | |
42 | 54 |
43 (defgroup netrc nil | 55 (defgroup netrc nil |
44 "Netrc configuration." | 56 "Netrc configuration." |
45 :group 'comm) | 57 :group 'comm) |
46 | 58 |
53 (when (file-exists-p file) | 65 (when (file-exists-p file) |
54 (with-temp-buffer | 66 (with-temp-buffer |
55 (let ((tokens '("machine" "default" "login" | 67 (let ((tokens '("machine" "default" "login" |
56 "password" "account" "macdef" "force" | 68 "password" "account" "macdef" "force" |
57 "port")) | 69 "port")) |
70 (encryption-model (when (netrc-bound-and-true-p encrypt-file-alist) | |
71 (encrypt-find-model file))) | |
58 alist elem result pair) | 72 alist elem result pair) |
59 (insert-file-contents file) | 73 (if encryption-model |
74 (encrypt-insert-file-contents file encryption-model) | |
75 (insert-file-contents file)) | |
60 (goto-char (point-min)) | 76 (goto-char (point-min)) |
61 ;; Go through the file, line by line. | 77 ;; Go through the file, line by line. |
62 (while (not (eobp)) | 78 (while (not (eobp)) |
63 (narrow-to-region (point) (point-at-eol)) | 79 (narrow-to-region (point) (point-at-eol)) |
64 ;; For each line, get the tokens and values. | 80 ;; For each line, get the tokens and values. |