comparison lisp/net/netrc.el @ 91302:56a72e2bd635

Merge from emacs--devo--0 Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-306
author Miles Bader <miles@gnu.org>
date Sat, 29 Dec 2007 02:39:17 +0000
parents 53108e6cea98 0cbc451989a7
children 606f2d163a64
comparison
equal deleted inserted replaced
91301:7774e5860c70 91302:56a72e2bd635
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.