diff options
author | John Wiegley <johnw@newartisans.com> | 2017-12-04 15:39:31 -0800 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2017-12-04 15:39:31 -0800 |
commit | 62d33b2143018e5ad23f0f34c84250c950f0d71b (patch) | |
tree | 3d6995c9006bfa7f999a671261b158e557b40810 /lisp/use-package/use-package-ensure.el | |
parent | e34fdb580a73d3e79e14cbc3b32d9219f30cdc2f (diff) | |
download | emacs-62d33b2143018e5ad23f0f34c84250c950f0d71b.tar.gz emacs-62d33b2143018e5ad23f0f34c84250c950f0d71b.tar.bz2 emacs-62d33b2143018e5ad23f0f34c84250c950f0d71b.zip |
Support :ensure (pkg :pin archive)
Fixes https://github.com/jwiegley/use-package/issues/506
Diffstat (limited to 'lisp/use-package/use-package-ensure.el')
-rw-r--r-- | lisp/use-package/use-package-ensure.el | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/lisp/use-package/use-package-ensure.el b/lisp/use-package/use-package-ensure.el index 2ed34e4071e..083350edf9e 100644 --- a/lisp/use-package/use-package-ensure.el +++ b/lisp/use-package/use-package-ensure.el @@ -137,15 +137,17 @@ manually updated package." t (use-package-only-one (symbol-name keyword) args #'(lambda (label arg) - (cond - ((symbolp arg) - (list arg)) - ((and (listp arg) (cl-every #'symbolp arg)) - arg) - (t - (use-package-error - (concat ":ensure wants an optional package name " - "(an unquoted symbol name)")))))))) + (pcase arg + ((pred symbolp) + (list arg)) + (`(,(and pkg (pred symbolp)) + :pin ,(and repo (or (pred stringp) + (pred symbolp)))) + (list (cons pkg repo))) + (_ + (use-package-error + (concat ":ensure wants an optional package name " + "(an unquoted symbol name), or (<symbol> :pin <string>)")))))))) (defun use-package-ensure-elpa (name args state &optional no-refresh) (dolist (ensure args) @@ -154,6 +156,9 @@ manually updated package." ensure))) (when package (require 'package) + (when (consp package) + (use-package-pin-package (car package) (cdr package)) + (setq package (car package))) (unless (package-installed-p package) (condition-case-unless-debug err (progn |