Bootstrapping an Emacs config with quelpa-use-package
Emacs configuration is already a hairy enough beast as it is, but package management introduces a whole new set of confusing, difficult problems. What I want from an Emacs package management system is the following:
- Every package I use should be recorded in my config
- My init file should ensure all my packages are installed when I start emacs.
- If any packages are not installed, the init should automatically download and install them.
- MELPA Stable should be used, not MELPA, unless I specify that a package should be installed from regular MELPA (for packages that don’t have a stable version).
- I don’t want to have to manually trigger package updates.
It’s a fairly simple set of requirements, but for a long time it was all-but-impossible to impossible to actually get all of them with Emacs’ packaging functionality. Fortunately a couple projects have come out that allow this vision to become a reality:
- use-package allows you to specify your packages in your init and keep their configuration isolated and tidy.
- quelpa allows you to build Emacs packages directly from source, using MELPA recipes. It also allows you to default to MELPA Stable, only using MELPA when specified.
- quelpa-use-package combines the two, allowing you to specify how a package should be installed as part of its use-package declaration.
I’ve created a minimal example of how to use these three packages
together in such a way that you don’t need anything installed except
for Emacs and the
init.el. Once you start Emacs, everything will be
automatically installed for you. You can find that at
quelpa-use-package-bootstrap-config. Please note that I
haven’t tested this with any versions of Emacs prior to 25.1.1 (the
version I’m currently running), nor on Windows, but I expect it should
work as far back as 24.3.1 or 24.4, and there’s no OS-specific code in
- You do have to pay attention to your packages and their
dependencies. Some packages require you to grab other packages
explicitly before they will work. In addition, MELPA packages that
come from EmacsWiki usually
fail to build on my machine, so I rehost the wiki packages I need to
GitHub and install them like so:
(use-package goto-chg :quelpa (goto-chg :stable nil :fetcher github :repo "benaiah/goto-chg"))
- If you’re not on a network and you don’t have your packages installed, this won’t work.
- While I’m writing this, no MELPA Stable version of quelpa-use-package exists, so you do technically have at least one unstable dependency with this setup. However, quelpa-use-package currently works well, and is rarely updated.
This setup has been working very well for me, and I hope it will be useful to you as well. It’s solid, easy to use (once you have it set up), and should theoretically make it trivial to set up Emacs on a new computer.
If you’d like to leave a comment, please email email@example.com