Changes committed gnus/lisp (ChangeLog mail-source.el)
"Ted Zlatanov" <[email protected]>
| Newsgroups | gmane.emacs.gnus.commits |
|---|---|
| Message-ID | <[email protected]> |
Modified: ChangeLog mail-source.el mail-source.el (mail-source-set-1, mail-source-bind): Moved auth-source code out of the macro to clean it up and fix bugs. Index: ChangeLog diff -u gnus/lisp/ChangeLog:7.1839 gnus/lisp/ChangeLog:7.1840 --- ChangeLog:7.1839 Sat Apr 26 14:54:20 2008 +++ ChangeLog Mon Apr 28 18:44:02 2008 @@ -1,3 +1,8 @@ +2008-04-28 Teodor Zlatanov <[email protected]> + + * mail-source.el (mail-source-set-1, mail-source-bind): Moved + auth-source code out of the macro to clean it up and fix bugs. + 2008-04-26 Teodor Zlatanov <[email protected]> * gnus-registry.el (gnus-registry-split-fancy-with-parent): Don't split Index: mail-source.el diff -u gnus/lisp/mail-source.el:7.35 gnus/lisp/mail-source.el:7.36 --- mail-source.el:7.35 Sat Apr 26 14:54:20 2008 +++ mail-source.el Mon Apr 28 18:44:02 2008 @@ -451,27 +451,7 @@ the `mail-source-keyword-map' variable." `(let* ,(mail-source-bind-1 (car type-source)) (mail-source-set-1 ,(cadr type-source)) - (let ((user - (or - (auth-source-user-or-password - "login" - ;; this is "host" in auth-sources - (if (boundp 'server) (symbol-value 'server) "") - ',(car type-source)) - (when (boundp 'user) (symbol-value 'user)))) - (password - (or - (auth-source-user-or-password - "password" - ;; this is "host" in auth-sources - (if (boundp 'server) (symbol-value 'server) "") - ',(car type-source)) - (when (boundp 'user) (symbol-value 'user))))) - (unless user - (unintern 'user)) - (unless password - (unintern 'password)) - ,@body))) + ,@body)) (put 'mail-source-bind 'lisp-indent-function 1) (put 'mail-source-bind 'edebug-form-spec '(sexp body)) @@ -479,14 +459,37 @@ (defun mail-source-set-1 (source) (let* ((type (pop source)) (defaults (cdr (assq type mail-source-keyword-map))) - default value keyword) + default value keyword user-auth pass-auth) (while (setq default (pop defaults)) ;; for each default :SYMBOL, set SYMBOL to the plist value for :SYMBOL ;; using `mail-source-value' to evaluate the plist value (set (mail-source-strip-keyword (setq keyword (car default))) - (if (setq value (plist-get source keyword)) - (mail-source-value value) - (mail-source-value (cadr default))))))) + ;; note the following reasons for this structure: + ;; 1) the auth-sources user and password override everything + ;; 2) it avoids macros, so it's cleaner + ;; 3) it falls through to the mail-sources and then default values + (cond + ((and + (eq keyword :user) + (setq user-auth + (auth-source-user-or-password + "login" + ;; this is "host" in auth-sources + (if (boundp 'server) (symbol-value 'server) "") + type))) + user-auth) + ((and + (eq keyword :password) + (setq pass-auth + (auth-source-user-or-password + "password" + ;; this is "host" in auth-sources + (if (boundp 'server) (symbol-value 'server) "") + type))) + pass-auth) + (t (if (setq value (plist-get source keyword)) + (mail-source-value value) + (mail-source-value (cadr default))))))))) (eval-and-compile (defun mail-source-bind-common-1 ()