diff options
author | John Wiegley <johnw@newartisans.com> | 2014-12-16 13:29:02 -0600 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2014-12-16 13:29:02 -0600 |
commit | 18f04bfb99223b7b9a3ec8278fdd13afb1d973ef (patch) | |
tree | 328cee83aec5599f9f9f6469a7c619c388e27ad3 /lisp/use-package/use-package.el | |
parent | 6570447a05fc080693efb9db4dc8565a40c38b01 (diff) | |
parent | fe7fe61528008cf9bcfb5633c845d06da9c582bc (diff) | |
download | emacs-18f04bfb99223b7b9a3ec8278fdd13afb1d973ef.tar.gz emacs-18f04bfb99223b7b9a3ec8278fdd13afb1d973ef.tar.bz2 emacs-18f04bfb99223b7b9a3ec8278fdd13afb1d973ef.zip |
Merge pull request from peterhoeg/master
Support for pinning package to archive
GitHub-reference: https://github.com/jwiegley/use-package/issues/136
Diffstat (limited to 'lisp/use-package/use-package.el')
-rw-r--r-- | lisp/use-package/use-package.el | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lisp/use-package/use-package.el b/lisp/use-package/use-package.el index bc2dec27380..570044970ea 100644 --- a/lisp/use-package/use-package.el +++ b/lisp/use-package/use-package.el @@ -139,6 +139,13 @@ Return nil when the queue is empty." (cancel-timer use-package-idle-timer) (setq use-package-idle-timer nil)))) +(defun use-package-pin-package (package archive) + "Pin PACKAGE to ARCHIVE." + (unless (boundp 'package-pinned-packages) + (setq package-pinned-packages '())) + (add-to-list 'package-pinned-packages (cons package archive)) + (package-initialize t)) + (defun use-package-ensure-elpa (package) (when (not (package-installed-p package)) (package-install package))) @@ -162,6 +169,7 @@ Return nil when the queue is empty." :interpreter :load-path :mode + :pin :pre-init :pre-load :requires @@ -270,7 +278,8 @@ For full documentation. please see commentary. priority (lower priorities run first). Default priority is 5; forms with the same priority are run in the order in which they are evaluated. -:ensure loads package using package.el if necessary." +:ensure loads package using package.el if necessary. +:pin pin package to archive." (use-package-validate-keywords args) ; error if any bad keyword, ignore result (let* ((commands (use-package-plist-get args :commands t t)) (pre-init-body (use-package-plist-get args :pre-init)) @@ -291,6 +300,7 @@ For full documentation. please see commentary. (if (stringp interpreter) (cons interpreter name) interpreter)) (predicate (use-package-plist-get args :if)) (pkg-load-path (use-package-plist-get args :load-path t t)) + (archive-name (use-package-plist-get args :pin)) (defines-eval (if (null defines) nil (if (listp defines) @@ -309,6 +319,9 @@ For full documentation. please see commentary. ;; force this immediately -- one off cost (unless (use-package-plist-get args :disabled) + (when archive-name + (use-package-pin-package name archive-name)) + (let* ((ensure (use-package-plist-get args :ensure)) (package-name (or (and (eq ensure t) |