summaryrefslogtreecommitdiff
path: root/lisp/use-package
diff options
context:
space:
mode:
authorIvan Goncharov <kovrik0@gmail.com>2016-01-06 11:15:22 +1300
committerIvan Goncharov <kovrik0@gmail.com>2016-01-06 11:15:22 +1300
commit308e4e3f2cac8868b79ee181433c776fc029434a (patch)
tree7c8b6d79ab8a72dbc87fb773b882fc088ffbb723 /lisp/use-package
parented2e85e4a74e760ca4d4219f2b37628ca5fce9f7 (diff)
downloademacs-308e4e3f2cac8868b79ee181433c776fc029434a.tar.gz
emacs-308e4e3f2cac8868b79ee181433c776fc029434a.tar.bz2
emacs-308e4e3f2cac8868b79ee181433c776fc029434a.zip
Move :pin out of macro expansion phase
Diffstat (limited to 'lisp/use-package')
-rw-r--r--lisp/use-package/use-package.el24
1 files changed, 12 insertions, 12 deletions
diff --git a/lisp/use-package/use-package.el b/lisp/use-package/use-package.el
index b88749d357b..d5226e3a9d3 100644
--- a/lisp/use-package/use-package.el
+++ b/lisp/use-package/use-package.el
@@ -419,23 +419,23 @@ manually updated package."
(let ((archive-symbol (if (symbolp archive) archive (intern archive)))
(archive-name (if (stringp archive) archive (symbol-name archive))))
(if (use-package--archive-exists-p archive-symbol)
- (push (cons package archive-name) package-pinned-packages)
+ (add-to-list 'package-pinned-packages (cons package archive-name) t)
(error "Archive '%s' requested for package '%s' is not available."
archive-name package))
(package-initialize t)))
(defun use-package-handler/:pin (name keyword archive-name rest state)
- (let ((body (use-package-process-keywords name rest state)))
- ;; This happens at macro expansion time, not when the expanded code is
- ;; compiled or evaluated.
- (if (null archive-name)
- body
- (use-package-pin-package name archive-name)
- (use-package-concat
- body
- `((push '(,(use-package-as-symbol name) . ,archive-name)
- package-pinned-packages)
- t)))))
+ (let ((body (use-package-process-keywords name rest state))
+ (pin-form (if archive-name
+ `(use-package-pin-package ',name ,archive-name))))
+ ;; We want to avoid pinning packages when the `use-package'
+ ;; macro is being macro-expanded by elisp completion (see
+ ;; `lisp--local-variables'), but still do pin packages when
+ ;; byte-compiling to avoid requiring `package' at runtime.
+ (if (bound-and-true-p byte-compile-current-file)
+ (eval pin-form) ; Eval when byte-compiling,
+ (push pin-form body)) ; or else wait until runtime.
+ body))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;