Function: use-package-normalize--vc-arg
use-package-normalize--vc-arg is a byte-compiled function defined in
use-package-core.el.gz.
Signature
(use-package-normalize--vc-arg ARG)
Documentation
Normalize possible arguments to the :vc keyword.
ARG is a cons-cell of approximately the form that
package-vc-selected-packages accepts, plus an additional :rev
keyword. If :rev is not given, it defaults to :last-release.
Returns a list (NAME SPEC REV), where (NAME . SPEC) is compliant
with package-vc-selected-packages and REV is a (possibly nil,
indicating the latest commit) revision.
Source Code
;; Defined in /usr/src/emacs/lisp/use-package/use-package-core.el.gz
(defun use-package-normalize--vc-arg (arg)
"Normalize possible arguments to the `:vc' keyword.
ARG is a cons-cell of approximately the form that
`package-vc-selected-packages' accepts, plus an additional `:rev'
keyword. If `:rev' is not given, it defaults to `:last-release'.
Returns a list (NAME SPEC REV), where (NAME . SPEC) is compliant
with `package-vc-selected-packages' and REV is a (possibly nil,
indicating the latest commit) revision."
(cl-flet* ((ensure-string (s)
(if (and s (stringp s)) s (symbol-name s)))
(ensure-symbol (s)
(if (and s (stringp s)) (intern s) s))
(normalize (k v)
(pcase k
(:rev (pcase v
('nil (if use-package-vc-prefer-newest nil :last-release))
(:last-release :last-release)
(:newest nil)
(_ (ensure-string v))))
(:vc-backend (ensure-symbol v))
(:ignored-files (if (listp v) v (list v)))
(_ (ensure-string v)))))
(pcase-let* ((`(,name . ,opts) arg))
(if (stringp opts) ; (NAME . VERSION-STRING) ?
(list name opts)
(let ((opts (use-package-split-when
(lambda (el)
(seq-contains-p use-package-vc-valid-keywords el))
opts)))
;; Error handling
(cl-loop for (k . _) in opts
if (not (member k use-package-vc-valid-keywords))
do (use-package-error
(format "Keyword :vc received unknown argument: %s. Supported keywords are: %s"
k use-package-vc-valid-keywords)))
;; Actual normalization
(list name
(cl-loop for (k . v) in opts
if (not (eq k :rev))
nconc (list k (normalize k (if (length= v 1) (car v) v))))
(normalize :rev (car (alist-get :rev opts)))))))))