GNU bug report logs - #53885
Autoload package-installed-p

Previous Next

Package: emacs;

Reported by: Corwin Brust <corwin <at> bru.st>

Date: Tue, 8 Feb 2022 23:56:02 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #59 received at 53885 <at> debbugs.gnu.org (full text, mbox):

From: Corwin Brust <corwin <at> bru.st>
To: Augusto Stoffel <arstoffel <at> gmail.com>
Cc: Philip Kaludercic <philipk <at> posteo.net>, Lars Ingebrigtsen <larsi <at> gnus.org>,
 53885 <at> debbugs.gnu.org
Subject: Re: 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 <at> gmail.com> wrote:
>
> On Wed,  9 Feb 2022 at 09:39, Corwin Brust <corwin <at> bru.st> wrote:
>
> > On Wed, Feb 9, 2022, 08:39 Augusto Stoffel <arstoffel <at> 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.




This bug report was last modified 3 years and 103 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.