Function: auth-source-secrets-listify-pattern
auth-source-secrets-listify-pattern is a byte-compiled function
defined in auth-source.el.gz.
Signature
(auth-source-secrets-listify-pattern PATTERN)
Documentation
Convert a PATTERN with lists to a list of string patterns.
auth-source patterns can have values of the form :foo ("bar"
"qux"), which means to match any secret with :foo equal to
"bar" or :foo equal to "qux". The secrets backend supports
only string values for patterns, so this routine returns a list
of patterns that is equivalent to the single original PATTERN
when interpreted such that if a secret matches any pattern in the
list, it matches the original PATTERN.
Source Code
;; Defined in /usr/src/emacs/lisp/auth-source.el.gz
;;; Backend specific parsing: Secrets API backend
(defun auth-source-secrets-listify-pattern (pattern)
"Convert a PATTERN with lists to a list of string patterns.
auth-source patterns can have values of the form :foo (\"bar\"
\"qux\"), which means to match any secret with :foo equal to
\"bar\" or :foo equal to \"qux\". The secrets backend supports
only string values for patterns, so this routine returns a list
of patterns that is equivalent to the single original PATTERN
when interpreted such that if a secret matches any pattern in the
list, it matches the original PATTERN."
(if (null pattern)
'(nil)
(let* ((key (pop pattern))
(value (pop pattern))
(tails (auth-source-secrets-listify-pattern pattern))
(heads (if (stringp value)
(list (list key value))
(mapcar (lambda (v) (list key v)) value))))
(cl-loop for h in heads
nconc (cl-loop for tl in tails collect (append h tl))))))