I am using the following init file to download and load packages from melpa-stable in fresh Emacs installations:

(require 'package)
(add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/"))
(setq use-package-always-pin  "melpa-stable")

;; Download use-package
(unless (package-installed-p 'use-package)
  (package-install 'use-package))

;; Reduce load time
(eval-when-compile (require 'use-package))

;; Get packages
(use-package foo :ensure t)

;;... etc

I have two questions/problems.

First: (eval-when-compile (require 'use-package)) is suggested by github.com/jwiegley/use-package, to speed-up the init, but to me it gives the non-critical error:

Eager macro-expansion failure: (file-missing "Cannot open load file" "No such file or directory" "use-package")

Secondly, while use-package is proposes a safe approach to automatically install packages, the author does not tell how to do same with use-package itself. The test (package-installed-p 'use-package) works, but since it requires initialising all packages, I suspect it can slow-down the init, and wonder if there is a faster way.


It seems that after switching from https://stable.melpa.org/packages to https://melpa.org/packages the eager macro-expansion failure disappeared from the Messages buffer.

  • Is use-package.el in your load-path? Did you install package use-package? – Drew Apr 22 '19 at 17:12
  • @Drew: Not in a fresh Emacs. My point is to auto-install it, just like I auto-install the other packages with use-package ensure. – antonio Apr 22 '19 at 17:18
  • 3
    FYI, jwiegley doesn't use package.el to install packages at all, and use-package wasn't originally written to work with it (that was retrofitted by others afterwards). github.com/jwiegley/dot-emacs – npostavs Apr 22 '19 at 17:40
  • @npostavs: Thanks, I just saw and I don't understand how he installs use-package, maybe some bash script – antonio Apr 22 '19 at 18:38
  • I'm using the same bootstrap method, and don't get your error. Also, it takes about 12 seconds (by dumb counting) to bootstrap a "fresh" setup, and less 1 second to subsequently start emacs for me. – nega Apr 22 '19 at 20:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.