[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#53885: Autoload package-installed-p
From: |
Corwin Brust |
Subject: |
bug#53885: Autoload package-installed-p |
Date: |
Thu, 10 Feb 2022 03:23:19 -0600 |
On Thu, Feb 10, 2022 at 3:06 AM Augusto Stoffel <arstoffel@gmail.com> wrote:
>
> On Wed, 9 Feb 2022 at 09:39, Corwin Brust <corwin@bru.st> wrote:
>
> > On Wed, Feb 9, 2022, 08:39 Augusto Stoffel <arstoffel@gmail.com> wrote:
> >
> > By the way, there are two issues with this code snippet. First, you
> > should call '(package-refresh-contents)' to make sure you have the
> > package list from MELPA.
> >
> > I believe this was changed with the implementation of "early-init". We
> > don't need to expressly call
> > `package-refresh-contents' since Emacs 27, see:
> > https://github.com/emacs-mirror/emacs/blob/master/etc/NEWS.27#L227
>
> This is a different matter. What I was saying is, you need to download
> the package list from MELPA before trying to install a missing package.
This is taken care of by a call to package-installed-p in the case
where it does not receive a package description as the first argument
and when no min-version is passed, as in my "reproducer". Or maybe I
still don't understand.
> If you delete ~/.emacs.d/elpa, your configuration as you showed it won't
> be able to bootstrap.
I don't think I called for deleting anything; I just set-up a
non-standard place for the installation of packages. But I suspect
I'm missing your point.
>
> Autoloading 'package-installed-p' wouldn't cause any harm, but it also
> doesn't solve any problems, so why bother?
Here I don't agree. Consider:
(when (not (package-installed-p 'foo))
(package-install-package 'foo))
This seems to DTRT; the package does get installed whereas in the
present world a backtrace is triggered unless we first take care to
load package.el.
- bug#53885: 28.0.51 [PATCH] Autoload package-installed-p, (continued)
bug#53885: Autoload package-installed-p, Corwin Brust, 2022/02/09