From 25df073421a6fae8f197015f78df06a750a77603 Mon Sep 17 00:00:00 2001 From: Teodor Zlatanov Date: Tue, 18 Dec 2007 20:29:33 +0000 Subject: [PATCH] * netrc.el: Autoload encrypt when encrypt-file-alist is set. (netrc-parse): Use encrypt-file-alist to determine if encrypt-find-model or encrypt-insert-file-contents should be used. * encrypt.el: Clarify documentation. Load password-cache or password, whichever one is found first, instead of autoloading. --- lisp/ChangeLog | 9 +++++++++ lisp/encrypt.el | 7 +++++-- lisp/netrc.el | 10 +++++++++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 40e6af52f..016f301ca 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2007-12-19 Teodor Zlatanov + + * netrc.el: Autoload encrypt when encrypt-file-alist is set. + (netrc-parse): Use encrypt-file-alist to determine if + encrypt-find-model or encrypt-insert-file-contents should be used. + + * encrypt.el: Clarify documentation. Load password-cache or + password, whichever one is found first, instead of autoloading. + 2007-12-17 Katsumi Yamaoka * gnus-art.el (gnus-article-browse-html-parts): Add message header and diff --git a/lisp/encrypt.el b/lisp/encrypt.el index 1fb54a280..9225eed52 100644 --- a/lisp/encrypt.el +++ b/lisp/encrypt.el @@ -29,11 +29,12 @@ ;;; particular aspect. ;;; Use in Gnus like this: +;;; (require 'encrypt) ;;; (setq ;;; nnimap-authinfo-file "~/.authinfo.enc" ;;; nntp-authinfo-file "~/.authinfo.enc" ;;; smtpmail-auth-credentials "~/.authinfo.enc" -;;; ;; using the AES256 cipher, feel free to use your own favorite +;;; ;; GnuPG using the AES256 cipher, feel free to use your own favorite ;;; encrypt-file-alist (quote (("~/.authinfo.enc" (gpg "AES256")))) ;;; password-cache-expiry 600) @@ -53,7 +54,9 @@ ;; autoload password (eval-and-compile - (autoload 'password-read "password")) + (if (locate-library "password-cache") + (require 'password-cache) + (require 'password))) (defgroup encrypt '((password-cache custom-variable) (password-cache-expiry custom-variable)) diff --git a/lisp/netrc.el b/lisp/netrc.el index d7de10a10..a41ced27b 100644 --- a/lisp/netrc.el +++ b/lisp/netrc.el @@ -34,6 +34,10 @@ ;;; .netrc and .authinfo rc parsing ;;; +;; use encrypt if loaded (encrypt-file-alist has to be set as well) +(eval-and-compile + (autoload 'encrypt-find-model "encrypt") + (autoload 'encrypt-insert-file-contents "encrypt")) (defalias 'netrc-point-at-eol (if (fboundp 'point-at-eol) 'point-at-eol @@ -54,8 +58,12 @@ (let ((tokens '("machine" "default" "login" "password" "account" "macdef" "force" "port")) + (encryption-model (when (bound-and-true-p encrypt-file-alist) + (encrypt-find-model file))) alist elem result pair) - (insert-file-contents file) + (if encryption-model + (encrypt-insert-file-contents file encryption-model) + (insert-file-contents file)) (goto-char (point-min)) ;; Go through the file, line by line. (while (not (eobp)) -- 2.25.1