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
.
elpaca
, this may help: emacs.stackexchange.com/questions/65064/…elpaca
adds on top of emacs, but far!