From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Corwin Brust Newsgroups: gmane.emacs.bugs Subject: bug#53885: Autoload package-installed-p Date: Thu, 10 Feb 2022 03:23:19 -0600 Message-ID: References: <87a6f0nly1.fsf@gmail.com> <87y22jm7su.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7992"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Philip Kaludercic , Lars Ingebrigtsen , 53885@debbugs.gnu.org To: Augusto Stoffel Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Feb 10 10:24:11 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nI5gR-0001sv-0x for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 10 Feb 2022 10:24:11 +0100 Original-Received: from localhost ([::1]:41740 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nI5gP-0003el-IL for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 10 Feb 2022 04:24:09 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:39228) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nI5gI-0003eT-OS for bug-gnu-emacs@gnu.org; Thu, 10 Feb 2022 04:24:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:60062) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nI5gI-0008CB-Eu for bug-gnu-emacs@gnu.org; Thu, 10 Feb 2022 04:24:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nI5gI-0002GZ-9Y for bug-gnu-emacs@gnu.org; Thu, 10 Feb 2022 04:24:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Corwin Brust Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 10 Feb 2022 09:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53885 X-GNU-PR-Package: emacs Original-Received: via spool by 53885-submit@debbugs.gnu.org id=B53885.16444850188672 (code B ref 53885); Thu, 10 Feb 2022 09:24:02 +0000 Original-Received: (at 53885) by debbugs.gnu.org; 10 Feb 2022 09:23:38 +0000 Original-Received: from localhost ([127.0.0.1]:53959 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nI5ft-0002Fo-WF for submit@debbugs.gnu.org; Thu, 10 Feb 2022 04:23:38 -0500 Original-Received: from mail-ed1-f43.google.com ([209.85.208.43]:36559) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nI5fs-0002FY-Hv for 53885@debbugs.gnu.org; Thu, 10 Feb 2022 04:23:36 -0500 Original-Received: by mail-ed1-f43.google.com with SMTP id s7so9851539edd.3 for <53885@debbugs.gnu.org>; Thu, 10 Feb 2022 01:23:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=I2/+NI4ihiNbzCXUEr/giqcNB9tFOs7Vmbs4l2ebJ5A=; b=LNJHRw3BSyQ4Zcs+wi9HFeep0m+Rx4gkeftPNgAvswLTeahEcAF9nUoQAIF7iRjuAX YS+gC2hUTpJmlBCBciDaeH62GzjssxlPkz9g2AXKCNItzVNNALKkStX1qdwUd81qVusw WTEzNLrWk7iPn3Ontrn4v+Q1Ny1HVKZiIBx/3jyQcpb2VYr2PaZYLzD6ox7EZrSDRyJf XjDYlb5AghdmHi3O/+UtTn9XlfwxKlUTYzxLKT83nWKFklyxOvthFsOHe1w3SyydMcCi cZJOqEIUmVsllVYc6CA+oPOW513mR9YrM+J2r7QghRZNIpnZYhRmggzkuQ7DCy4aG9XM JJVA== X-Gm-Message-State: AOAM530xHrg8RxU8kU5oEWcLeBuGO0F7k90ft8MmC7nN+r+NJ2G6/NMA EPcR46bVy6lNdQZYHfhEOEBrKBoO5UFh9CvblEo= X-Google-Smtp-Source: ABdhPJxZSZr2OSpwW+dzQB9xwzjiGw+r2lqJYU4af4QBgtMk5YD1WuVqbjFxJo5Vj0tZuu7bO7E79CnErzThE9MYALA= X-Received: by 2002:a05:6402:f17:: with SMTP id i23mr7333423eda.196.1644485010741; Thu, 10 Feb 2022 01:23:30 -0800 (PST) In-Reply-To: <87y22jm7su.fsf@gmail.com> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:226577 Archived-At: On Thu, Feb 10, 2022 at 3:06 AM Augusto Stoffel wrote: > > On Wed, 9 Feb 2022 at 09:39, Corwin Brust wrote: > > > On Wed, Feb 9, 2022, 08:39 Augusto Stoffel 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.