(auth-source-netrc-create): Don't query the bits that we already know.
authorLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Wed, 22 Jun 2011 14:47:24 +0000 (16:47 +0200)
committerLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Wed, 22 Jun 2011 14:47:24 +0000 (16:47 +0200)
lisp/ChangeLog
lisp/auth-source.el

index 3ce932f..ad0255a 100644 (file)
@@ -1,3 +1,10 @@
+2011-06-22  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * auth-source.el (auth-source-netrc-create): Don't query the bits that
+       we already know.
+       (auth-source-forget-all-cached): Clear auth-source-netrc-cache, too.
+       (auth-source-netrc-create): Don't prompt for the stuff we already know.
+
 2011-06-21  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
        * auth-source.el (auth-source-netrc-create): Don't print all tokens in
index e0da445..daa3983 100644 (file)
@@ -723,7 +723,8 @@ Returns the deleted entries."
         when (string-match (concat "^" auth-source-magic)
                            (symbol-name sym))
         ;; remove that key
-        do (password-cache-remove (symbol-name sym))))
+        do (password-cache-remove (symbol-name sym)))
+  (setq auth-source-netrc-cache nil))
 
 (defun auth-source-remember (spec found)
   "Remember FOUND search results for SPEC."
@@ -1154,6 +1155,9 @@ See `auth-source-search' for details on SPEC."
          ;; we know (because of an assertion in auth-source-search) that the
          ;; :create parameter is either t or a list (which includes nil)
          (create-extra (if (eq t create) nil create))
+        (current-data (car (auth-source-search :max 1
+                                               :host host
+                                               :port port)))
          (required (append base-required create-extra))
          (file (oref backend source))
          (add "")
@@ -1188,7 +1192,9 @@ See `auth-source-search' for details on SPEC."
     (dolist (r required)
       (let* ((data (aget valist r))
              ;; take the first element if the data is a list
-             (data (auth-source-netrc-element-or-first data))
+             (data (or (auth-source-netrc-element-or-first data)
+                      (plist-get current-data
+                                 (intern (format ":%s" r) obarray))))
              ;; this is the default to be offered
              (given-default (aget auth-source-creation-defaults r))
              ;; the default supplementals are simple: