[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r117025: lisp/gnus.auth-source.el (auth-source-searc
From: |
Katsumi Yamaoka |
Subject: |
[Emacs-diffs] trunk r117025: lisp/gnus.auth-source.el (auth-source-search): return boolean on :max 0 |
Date: |
Sun, 27 Apr 2014 22:08:49 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 117025
revision-id: address@hidden
parent: address@hidden
author: Teodor Zlatanov <address@hidden>
committer: Katsumi Yamaoka <address@hidden>
branch nick: trunk
timestamp: Sun 2014-04-27 22:08:43 +0000
message:
lisp/gnus.auth-source.el (auth-source-search): return boolean on :max 0
* lisp/gnus.auth-source.el (auth-source-search, auth-source-search-backends):
Treat :max 0 as an indicator that a boolean return is wanted, as
documented. Reported by Joe Bloggs.
modified:
lisp/gnus/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1433
lisp/gnus/auth-source.el
authsource.el-20091113204419-o5vbwnq5f7feedwu-8608
=== modified file 'lisp/gnus/ChangeLog'
--- a/lisp/gnus/ChangeLog 2014-04-20 22:35:24 +0000
+++ b/lisp/gnus/ChangeLog 2014-04-27 22:08:43 +0000
@@ -1,3 +1,9 @@
+2014-04-27 Teodor Zlatanov <address@hidden>
+
+ * auth-source.el (auth-source-search, auth-source-search-backends):
+ Treat :max 0 as an indicator that a boolean return is wanted, as
+ documented. Reported by Joe Bloggs.
+
2014-04-20 Katsumi Yamaoka <address@hidden>
* gnus-icalendar.el: Require gnus-art.
=== modified file 'lisp/gnus/auth-source.el'
--- a/lisp/gnus/auth-source.el 2014-03-23 23:13:36 +0000
+++ b/lisp/gnus/auth-source.el 2014-04-27 22:08:43 +0000
@@ -654,9 +654,11 @@
'secrets are the only ones supported right now.
:max N means to try to return at most N items (defaults to 1).
-When 0 the function will return just t or nil to indicate if any
-matches were found. More than N items may be returned, depending
-on the search and the backend.
+More than N items may be returned, depending on the search and
+the backend.
+
+When :max is 0 the function will return just t or nil to indicate
+if any matches were found.
:host (X Y Z) means to match only hosts X, Y, or Z according to
the match rules above. Defaults to t.
@@ -757,18 +759,22 @@
(when auth-source-do-cache
(auth-source-remember spec found)))
- found))
+ (if (zerop max)
+ (not (null found))
+ found)))
(defun auth-source-search-backends (backends spec max create delete require)
- (let (matches)
+ (let ((max (if (zerop max) 1 max)) ; stop with 1 match if we're asked for
zero
+ matches)
(dolist (backend backends)
- (when (> max (length matches)) ; when we need more matches...
+ (when (> max (length matches)) ; if we need more matches...
(let* ((bmatches (apply
(slot-value backend 'search-function)
:backend backend
:type (slot-value backend :type)
;; note we're overriding whatever the spec
- ;; has for :require, :create, and :delete
+ ;; has for :max, :require, :create, and :delete
+ :max max
:require require
:create create
:delete delete
@@ -783,6 +789,7 @@
(setq matches (append matches bmatches))))))
matches))
+;; (auth-source-search :max 0)
;; (auth-source-search :max 1)
;; (funcall (plist-get (nth 0 (auth-source-search :max 1)) :secret))
;; (auth-source-search :host "nonesuch" :type 'netrc :K 1)
@@ -1653,6 +1660,7 @@
;; (let ((auth-sources
'("macos-keychain-internet:/Users/tzz/Library/Keychains/login.keychain")))
(auth-source-search :max 1))
;; (let ((auth-sources '("macos-keychain-generic:Login"))) (auth-source-search
:max 1 :host "git.gnus.org"))
+;; (let ((auth-sources '("macos-keychain-generic:Login"))) (auth-source-search
:max 1))
(defun* auth-source-macos-keychain-search (&rest
spec
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r117025: lisp/gnus.auth-source.el (auth-source-search): return boolean on :max 0,
Katsumi Yamaoka <=