0

I'm struggling to understand the place elpaca holds in the emacs ecosystem, and looking for an overview.

Is something elpaca-like a more-or-less necessary compromise in a vanilla-as-possible-yet-still-capable Emacs setup? Or is there a good-enough alternative (package.el?) that ships included now? Is use-package a package or a command or what? It seems to integrate with all the package managers?

2

2 Answers 2

2

TL;DR: Basically elpaca, use-package, et al are closely, but not completely overlapping Venn diagrams. Just use Emacs built-ins until you have a reason to do otherwise.

You are asking multiple questions here. I'll break them down:

Q: Is something elpaca-like a more-or-less necessary compromise in a vanilla-as-possible-yet-still-capable Emacs setup?

A: Not really. Just use standard Emacs until you run into a problem. Setting up another package manager will likely have an additional learning curve and time obligation.

Q: Or is there a good-enough alternative (package.el?) that ships included now?

A: package.el and use-package are big improvements, and as with the last question, use them until you have a reason not to.

Q: Is use-package a package or a command or what?

A: This can get a little confusing. use-package was an external package that is now a part of Emacs. So yes it is a package.

So what is happening when you run (use-package name-of-some-random-package), either from your .emacs or some other way?

Well, it's not a command in the strict sense, but maybe in the way you are used to using it. In Emacs, a command generally refers to a interactive function, usually executed via M-x or bound to a key. So in that sense, use-package is not a "command" to Emacs.

So what is it? use-package (also elpaca) is a macro (not a keyboard macro).

This is not the place to fully explain macros, but basically they are the secret sauce that allows things that look like Emacs functions to do all sorts of stuff that functions seemingly cannot. However, all macros expand to valid Emacs Lisp. So you could also say that macros are like super-power abbreviations or snippets if that makes sense.

So what does that mean in terms of what happens when you actually call elpaca and use-package? Using our example before of (use-package name-of-some-random-package), if we have our cursor right after that and do M-x pp-macroexpand-last-sexp, a buffer pops up with:

(progn
  (defvar use-package--warning0
    #'(lambda
    (keyword err)
    (let
        ((msg
          (format "%s/%s: %s" 'name-of-some-random-package keyword
              (error-message-string err))))
      (display-warning 'use-package msg :error))))
  (condition-case-unless-debug err
      (if
      (not
       (require 'foo nil t))
      (display-warning 'use-package
               (format "Cannot load %s" 'name-of-some-random-package)
               :error))
    (error
     (funcall use-package--warning0 :catch err))))

This is the code that is actually run from (use-package name-of-some-random-package) If you added :ensure t or similar, the macro would change accordingly. This allows use-package to handle autoloads, hooks, and all of those other things so we don't have to worry about it.

This is also what allows use-package to call different package managers.

I don't have it installed to show you, but you can use pp-macroexpand-last-sexp on (elpaca some-package) to see what it is doing as well.

Q: It [use-package] seems to integrate with all the package managers?

A: It kind of does. It depends on your definitions of "integrate" and "all."

From the use-package user manual: "Note that use-package is not a package manager. Although use-package does have the useful capability to interface with the Emacs package manager, its primary purpose is help with the configuration and loading of packages, not with managing their download, upgrades, and installation."

use-package does a lot, but it isn't made to do certain things. In one way, you could look at elpaca (or pacakge.el, straight.el, etc.) as a back-end for use-package, although this is reductive because elpaca and straight function on their own.

I haven't used elpaca, but in the README, it says "It allows users to find, install, update, and remove third-party packages..." use-package is meant for installing and configuring packages from Emacs Lisp. It does not include a way to browse, search, or get info about packages. As far as I know, I don't think you can even delete a package with use-package.

1
4

The readme in elpaca’s source code says:

Elpaca is an elisp package manager. It allows users to find, install, update, and remove third-party packages for Emacs. It is a replacement for the built-in Emacs package manager, package.el.

Elpaca:

  • Installs packages asynchronously, in parallel for fast, non-blocking installations.
  • Includes a flexible UI for finding and operating on packages.
  • Downloads packages from their sources for convenient elisp development.
  • Supports thousands of elisp packages out of the box (MELPA, NonGNU/GNU ELPA, Org/org-contrib).
  • Makes it easy for users to create their own ELPAs.

As you can see, it extends or supersedes Emacs’ built–in package manager.

The built–in package manager installed packages synchronously, one at a time. Honestly since installing a package is something you generally only do rarely, this is not that big of a deal. It’s fast enough that you’re not going to do any meaningful amount of work in that time anyway.

Emacs already has a built–in UI for finding and operating on packages, but it looks like Elpaca’s UI is more asynchronous. Where Emacs downloads the whole package list and renders it into the UI in one go, Elpaca appears to render into the UI as information arrives from the network. I suppose if your network is slow this will feel more responsive, since you can move the cursor around as information is downloaded. However, if your network is fast then waiting a second or two for the whole list to show up is not really that bad.

If you like elpaca, then use it. But it is by no means necessary.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.