(mail-source-bind): Don't use user or password if they
authorTeodor Zlatanov <tzz@lifelogs.com>
Sat, 26 Apr 2008 12:47:15 +0000 (12:47 +0000)
committerTeodor Zlatanov <tzz@lifelogs.com>
Sat, 26 Apr 2008 12:47:15 +0000 (12:47 +0000)
are not bound.  Unintern them if they are nil.

lisp/ChangeLog
lisp/mail-source.el

index d87d5d0..8f3e3a1 100644 (file)
@@ -1,3 +1,8 @@
+2008-04-26  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       * mail-source.el (mail-source-bind): Don't use user or password if they
+       are not bound.  Unintern them if they are nil.
+
 2008-04-25  Teodor Zlatanov  <tzz@lifelogs.com>
 
        * mail-source.el: Load auth-source.el.
index d8633b7..65626b0 100644 (file)
@@ -451,18 +451,24 @@ The variables bound and their default values are described by
 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"
-                  server             ; this is "host" in auth-sources
-                  ',(car type-source))
-                 user))
-          (password (or
-                     (auth-source-user-or-password 
-                      "password"
-                      server         ; this is "host" in auth-sources
-                      ',(car type-source))
-                     password)))
+     (let ((user 
+           (or
+            (auth-source-user-or-password
+             "login"
+             server          ; this is "host" in auth-sources
+             ',(car type-source))
+            (when (boundp 'user) (symbol-value 'user))))
+          (password 
+           (or
+            (auth-source-user-or-password 
+             "password"
+             server          ; this is "host" in auth-sources
+             ',(car type-source))
+            (when (boundp 'user) (symbol-value 'user)))))
+       (unless user
+        (unintern 'user))
+       (unless password
+        (unintern 'password))
        ,@body)))
 
 (put 'mail-source-bind 'lisp-indent-function 1)