mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-05-31 01:32:00 -07:00
Improve auth-source-backend-parse
* lisp/auth-source.el (auth-source-backend-parse): Use `run-hook-wrapped'. Suggested by Augusto Stoffel <arstoffel@gmail.com>. Transform a warning into a debug message.
This commit is contained in:
parent
8f31ccbf82
commit
1754015c60
1 changed files with 9 additions and 14 deletions
|
|
@ -361,23 +361,18 @@ soon as a function returns non-nil.")
|
|||
(defun auth-source-backend-parse (entry)
|
||||
"Create an `auth-source-backend' from an ENTRY in `auth-sources'."
|
||||
|
||||
(let* ((auth-source-backend-parser-functions
|
||||
;; The functions shall drop backends of type `ignore', in
|
||||
;; order to let the hook continue.
|
||||
(mapcar
|
||||
(lambda (fun)
|
||||
`(lambda (entry)
|
||||
(and-let* ((result (funcall ',fun entry))
|
||||
((not (eq (slot-value result 'type) 'ignore)))
|
||||
result))))
|
||||
auth-source-backend-parser-functions))
|
||||
(backend
|
||||
(run-hook-with-args-until-success
|
||||
'auth-source-backend-parser-functions entry)))
|
||||
(let* ((backend
|
||||
(run-hook-wrapped
|
||||
'auth-source-backend-parser-functions
|
||||
(lambda (fun entry)
|
||||
(when-let* ((result (funcall fun entry))
|
||||
(_ (not (eq (slot-value result 'type) 'ignore))))
|
||||
result))
|
||||
entry)))
|
||||
|
||||
(unless backend
|
||||
;; none of the parsers worked
|
||||
(auth-source-do-warn
|
||||
(auth-source-do-debug
|
||||
"auth-source-backend-parse: invalid backend spec: %S" entry)
|
||||
(setq backend (make-instance 'auth-source-backend
|
||||
:source ""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue