Subject: bug#53885: Autoload package-installed-p

From: Augusto Stoffel <[email-masked]>
Date: Thu, 10 Feb 2022 10:30:47 +0100

On Thu, 10 Feb 2022 at 03:23, Corwin Brust <[email-masked]> wrote:

>> 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.

I thought your goal was to have Emacs download all the packages you need
if you copy your configuration files to a new computer.  Maybe I
misunderstood.

>> 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.

The first time you start Emacs, it doesn't have a list of packages from
ELPA et al (and even if you do, it may be out of date), so
'package-install-pakcage' will fail.