emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r103423: Merge changes made in Gnus t


From: Katsumi Yamaoka
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r103423: Merge changes made in Gnus trunk.
Date: Fri, 25 Feb 2011 23:52:19 +0000
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 103423
author: Teodor Zlatanov <address@hidden>
committer: Katsumi Yamaoka <address@hidden>
branch nick: trunk
timestamp: Fri 2011-02-25 23:52:19 +0000
message:
  Merge changes made in Gnus trunk.
  
  auth-source.el (auth-source-search): Cache empty result sets.
  password-cache.el (password-in-cache-p): Convenience function to check if a 
key is in the cache, even if the value is nil.
modified:
  lisp/ChangeLog
  lisp/gnus/ChangeLog
  lisp/gnus/auth-source.el
  lisp/password-cache.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-02-25 18:30:00 +0000
+++ b/lisp/ChangeLog    2011-02-25 23:52:19 +0000
@@ -1,3 +1,8 @@
+2011-02-25  Teodor Zlatanov  <address@hidden>
+
+       * password-cache.el (password-in-cache-p): Convenience function to
+       check if a key is in the cache, even if the value is nil.
+
 2011-02-25  Jambunathan K  <address@hidden>
 
        * emacs-lisp/package-x.el (package--archive-contents-from-url)

=== modified file 'lisp/gnus/ChangeLog'
--- a/lisp/gnus/ChangeLog       2011-02-25 12:53:00 +0000
+++ b/lisp/gnus/ChangeLog       2011-02-25 23:52:19 +0000
@@ -1,5 +1,7 @@
 2011-02-25  Teodor Zlatanov  <address@hidden>
 
+       * auth-source.el (auth-source-search): Cache empty result sets.
+
        * auth-source.el (auth-source-save-behavior): New variable to replace
        `auth-source-never-create'.
        (auth-source-netrc-create): Use it.

=== modified file 'lisp/gnus/auth-source.el'
--- a/lisp/gnus/auth-source.el  2011-02-25 12:53:00 +0000
+++ b/lisp/gnus/auth-source.el  2011-02-25 23:52:19 +0000
@@ -524,10 +524,13 @@
          (keys (loop for i below (length spec) by 2
                      unless (memq (nth i spec) ignored-keys)
                      collect (nth i spec)))
+         (cached (auth-source-remembered-p spec))
+         ;; note that we may have cached results but found is still nil
+         ;; (there were no results from the search)
          (found (auth-source-recall spec))
          filtered-backends accessor-key backend)
 
-    (if (and found auth-source-do-cache)
+    (if (and cached auth-source-do-cache)
         (auth-source-do-debug
          "auth-source-search: found %d CACHED results matching %S"
          (length found) spec)
@@ -580,7 +583,8 @@
          "auth-source-search: CREATED %d results (max %d) matching %S"
          (length found) max spec))
 
-      (when (and found auth-source-do-cache)
+      ;; note we remember the lack of result too, if it's applicable
+      (when auth-source-do-cache
         (auth-source-remember spec found)))
 
       found))
@@ -654,6 +658,11 @@
   (password-read-from-cache
    (concat auth-source-magic (format "%S" spec))))
 
+(defun auth-source-remembered-p (spec)
+  "Check if SPEC is remembered."
+  (password-in-cache-p
+   (concat auth-source-magic (format "%S" spec))))
+
 (defun auth-source-forget (spec)
   "Forget any cached data matching SPEC exactly.
 
@@ -664,7 +673,10 @@
 ;;; (loop for sym being the symbols of password-data when (string-match 
(concat "^" auth-source-magic) (symbol-name sym)) collect (symbol-name sym))
 
 ;;; (auth-source-remember '(:host "wedd") '(4 5 6))
+;;; (auth-source-remembered-p '(:host "wedd"))
 ;;; (auth-source-remember '(:host "xedd") '(1 2 3))
+;;; (auth-source-remembered-p '(:host "xedd"))
+;;; (auth-source-remembered-p '(:host "zedd"))
 ;;; (auth-source-recall '(:host "xedd"))
 ;;; (auth-source-recall '(:host t))
 ;;; (auth-source-forget+ :host t)

=== modified file 'lisp/password-cache.el'
--- a/lisp/password-cache.el    2011-02-13 00:25:29 +0000
+++ b/lisp/password-cache.el    2011-02-25 23:52:19 +0000
@@ -76,6 +76,12 @@
        key
        (symbol-value (intern-soft key password-data))))
 
+(defun password-in-cache-p (key)
+  "Check if KEY is in the cache."
+  (and password-cache
+       key
+       (intern-soft key password-data)))
+
 (defun password-read (prompt &optional key)
   "Read password, for use with KEY, from user, or from cache if wanted.
 KEY indicate the purpose of the password, so the cache can


reply via email to

[Prev in Thread] Current Thread [Next in Thread]