Emacs packages

How the pieces fit together

Now that Emacs 29 moved so many useful things into Emacs proper, it’s time to declare config bankruptcy and start over, with a newer, cleaner init.el.

So, I need to understand how Emacs packages work.

Like, what does use-package do? What is Elpaca for? And is it worth straying from the vanilla path?

Here’s what I’ve put together so far…


Packages

Emacs packages serve roughly the same function as packages in other languages. The organized package repositories are named some variant of “ELPA” (“Emacs Lisp Package Archive”)1.

Step one: installing packages manually

In the beginning, packages were installed manually. Xah Lee has a guide.

Step two: use a package manager

As near as I can figure, in 2007, Tom Tromey created package.el and ELPA. Both are mentioned in blog posts dating to April of 2007.

In version 24, Emacs started shipping with package.el included. M-x list-packages will bring up the package manager, and let you browse and install.

Package archives

There are several flavors of ELPA:

GNU ELPA
elpa.gnu.org - requires copyright assignment. Essentially, packages here are considered part of Emacs, but not distributed by default. 443 packages.
NonGNU ELPA
https://elpa.nongnu.org - requires GPLv3-compatible code and GNU FDL v1.4-compatible documentation. 235 packages.
MELPA
melpa.org - anything goes. Just open a PR to add a package. 5,796 packages.

package.el defaults to showing packages from GNU ELPA and NonGNU ELPA.

Step three: more powerful package managers

From there, a variety of different package managers exist, with varying capabilities and aras of focus. (Get more control over package sources? Install from git? Help you develop packages?) The straight.el comparison to other package managers docs and following TL;DR section give an excellent overview.

Step four: use-package

use-package, created by John Wiegley in 2012, offers concise, tidy syntax for using packages. It seems to have won, and was merged into Emacs in 2022, for Emacs 29.

A use-package call lets you easily register a package, installing if necessary. In that same single call you can also:

Modern package managers integrate with use-package, replacing its default installation mechanism.

More information on use-package:

Step five: package managers so powerful, it’s getting silly

If you search for modern advice on which package manager to use, you’ll see a lot of articles on using straight.el. But, the current maintainer of straight.el then went on to write Elpaca. Their reddit comparison is useful. I believe Elpaca is the current state of the art. It can install packages asynchronously, in parallel!3

Final comments

I’m currently using Elpaca, although since I don’t do anything fancy, I should probably just use package.el. Elpaca’s async loading notifications look cool…

I asked emacs stackexchange to “Explain Elpaca Like I’m 5” and the reponses provided interesting perspectives and a good starting point.


That’s it! If you see a mistake, or think something should be added, clarified, or corrected, please let me know. I’d like this post to be the thing I wish I’d found at the start. zellyn.com/about#contact


  1. The Comprehensive Perl Archive Network (CPAN) is probably the most well-known “Package Archive” package system, and was inspired by TeX’s CTAN↩︎

  2. Multi-threading: it’s not clear whether you should use it (yet?). See Troy Hinckley’s “A vision of a multi-threaded Emacs”, and Tom Tromey’s Reddit comment, both from May, 2022. ↩︎

  3. Installing packages asynchronously, in parallel, is neat, although you don’t really install packages that often… 🤷‍♂️ ↩︎