mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-27 07:37:33 +00:00
Move :pin out of macro expansion phase
This commit is contained in:
parent
ed2e85e4a7
commit
308e4e3f2c
@ -419,23 +419,23 @@ manually updated package."
|
|||||||
(let ((archive-symbol (if (symbolp archive) archive (intern archive)))
|
(let ((archive-symbol (if (symbolp archive) archive (intern archive)))
|
||||||
(archive-name (if (stringp archive) archive (symbol-name archive))))
|
(archive-name (if (stringp archive) archive (symbol-name archive))))
|
||||||
(if (use-package--archive-exists-p archive-symbol)
|
(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."
|
(error "Archive '%s' requested for package '%s' is not available."
|
||||||
archive-name package))
|
archive-name package))
|
||||||
(package-initialize t)))
|
(package-initialize t)))
|
||||||
|
|
||||||
(defun use-package-handler/:pin (name keyword archive-name rest state)
|
(defun use-package-handler/:pin (name keyword archive-name rest state)
|
||||||
(let ((body (use-package-process-keywords name rest state)))
|
(let ((body (use-package-process-keywords name rest state))
|
||||||
;; This happens at macro expansion time, not when the expanded code is
|
(pin-form (if archive-name
|
||||||
;; compiled or evaluated.
|
`(use-package-pin-package ',name ,archive-name))))
|
||||||
(if (null archive-name)
|
;; We want to avoid pinning packages when the `use-package'
|
||||||
body
|
;; macro is being macro-expanded by elisp completion (see
|
||||||
(use-package-pin-package name archive-name)
|
;; `lisp--local-variables'), but still do pin packages when
|
||||||
(use-package-concat
|
;; byte-compiling to avoid requiring `package' at runtime.
|
||||||
body
|
(if (bound-and-true-p byte-compile-current-file)
|
||||||
`((push '(,(use-package-as-symbol name) . ,archive-name)
|
(eval pin-form) ; Eval when byte-compiling,
|
||||||
package-pinned-packages)
|
(push pin-form body)) ; or else wait until runtime.
|
||||||
t)))))
|
body))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;;
|
;;
|
||||||
|
Loading…
Reference in New Issue
Block a user