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")
(package-initialize)
;; Download use-package
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(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.
Edit
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.
use-package.el
in yourload-path
? Did you install packageuse-package
? – Drew Apr 22 '19 at 17:12ensure
. – antonio Apr 22 '19 at 17:18use-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:40use-package
, maybe some bash script – antonio Apr 22 '19 at 18:38emacs
for me. – nega Apr 22 '19 at 20:16