mirror of
https://github.com/masscollaborationlabs/emacs.git
synced 2025-07-05 03:39:38 +00:00
Install packages when byte-compiling (fix by @npostavs)
This commit is contained in:
parent
b1f442c15b
commit
d9f37b4f0c
1 changed files with 13 additions and 6 deletions
|
@ -463,12 +463,19 @@ manually updated package."
|
|||
(use-package-ensure-elpa package t)))))
|
||||
|
||||
(defun use-package-handler/:ensure (name keyword ensure rest state)
|
||||
(let ((body (use-package-process-keywords name rest state)))
|
||||
`((let ((package-name (or (and (eq ',ensure t) (use-package-as-symbol ',name)) ',ensure)))
|
||||
(when package-name
|
||||
(require 'package)
|
||||
(use-package-ensure-elpa package-name)))
|
||||
,@body)))
|
||||
(let* ((body (use-package-process-keywords name rest state))
|
||||
(package-name (or (and (eq ensure t) (use-package-as-symbol name)) ensure))
|
||||
(ensure-form (if package-name
|
||||
`(progn (require 'package)
|
||||
(use-package-ensure-elpa ',package-name)))))
|
||||
;; We want to avoid installing packages when the `use-package'
|
||||
;; macro is being macro-expanded by elisp completion (see
|
||||
;; `lisp--local-variables'), but still do install packages when
|
||||
;; byte-compiling to avoid requiring `package' at runtime.
|
||||
(if (bound-and-true-p byte-compile-current-file)
|
||||
(eval ensure-form) ; Eval when byte-compiling,
|
||||
(push ensure-form body)) ; or else wait until runtime.
|
||||
body))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue