From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Zachary Kanfer Newsgroups: gmane.emacs.bugs Subject: bug#31397: 27.0.50; Emacs doesn't call package-initialize if there's no elpa directory Date: Mon, 6 Aug 2018 19:41:18 -0400 Message-ID: References: <87o9gyd6hp.fsf@gmail.com> <87fu2acchi.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000006b1ac0572ccd146" X-Trace: blaine.gmane.org 1533598810 15478 195.159.176.226 (6 Aug 2018 23:40:10 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 6 Aug 2018 23:40:10 +0000 (UTC) Cc: 31397@debbugs.gnu.org, radon.neon@gmail.com, npostavs@gmail.com To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Aug 07 01:40:06 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fmp6Z-0003rC-W8 for geb-bug-gnu-emacs@m.gmane.org; Tue, 07 Aug 2018 01:40:04 +0200 Original-Received: from localhost ([::1]:36669 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fmp8e-0008I7-Uv for geb-bug-gnu-emacs@m.gmane.org; Mon, 06 Aug 2018 19:42:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56142) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fmp8Y-0008Hr-6f for bug-gnu-emacs@gnu.org; Mon, 06 Aug 2018 19:42:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fmp8V-0003Z7-3Z for bug-gnu-emacs@gnu.org; Mon, 06 Aug 2018 19:42:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:38002) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fmp8U-0003Ye-V2 for bug-gnu-emacs@gnu.org; Mon, 06 Aug 2018 19:42:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fmp8U-0006fJ-FG for bug-gnu-emacs@gnu.org; Mon, 06 Aug 2018 19:42:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Zachary Kanfer Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 06 Aug 2018 23:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 31397 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 31397-submit@debbugs.gnu.org id=B31397.153359889625578 (code B ref 31397); Mon, 06 Aug 2018 23:42:02 +0000 Original-Received: (at 31397) by debbugs.gnu.org; 6 Aug 2018 23:41:36 +0000 Original-Received: from localhost ([127.0.0.1]:43020 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fmp84-0006eT-F1 for submit@debbugs.gnu.org; Mon, 06 Aug 2018 19:41:36 -0400 Original-Received: from mail-it0-f43.google.com ([209.85.214.43]:35934) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fmp83-0006eF-1A for 31397@debbugs.gnu.org; Mon, 06 Aug 2018 19:41:35 -0400 Original-Received: by mail-it0-f43.google.com with SMTP id p81-v6so20646725itp.1 for <31397@debbugs.gnu.org>; Mon, 06 Aug 2018 16:41:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=E+M+ecdEfhA/OM2U/STAxk2YRm1jR6G2CeDIg1hitlY=; b=h4JAumdZRAm/e1tadc4YT4XD+y8nYKdaw9AdEgm/c6fX2/rhN10XDGAH32HSvgyHTZ 6hHEiVZYGeHbjmfsx6EBmj00BLGft5zpL9RvXx8777OnASE71g77UX7y+xHYd7d1vVmo 5Bq9tqd778/Vv24mZMldsujM1hV0lsiOo/Fjx6dZ1tHjY9ze8oXiWeknuUHT1EK4HB+t LatNqZssbK4+C9t2jSUqI5q99wAx3t6saBLVmmR5M8tBwO40GlAgc+F1FrkjxR6PFgyi to/DP5BnQ5X+uZs18Tdn+QDMBkJhz8jCc4ETX+AlzlI5NaHiLwzVisOHy71lmGuVqQtc GrvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=E+M+ecdEfhA/OM2U/STAxk2YRm1jR6G2CeDIg1hitlY=; b=AjeqTEefM3o/Yag8cdAnrVOIq1CXubN+fEtXibhIpAcuzOUJDY9eY+JypZm/b84omC RpvWsAa+dEtHy0Ic4u7/yprzqYPXzTK18pkkYHPAuRL8iTJVskYOUrQ+pyOpcSFchN+F SHcMzQzEGoa+We2qHuwaSG+lUmiGZoPD7NWtJpwQ/jBAhtvaZ6Fbyya9tPNrVmfmckGX 1SONxx0cu5dqHQjczpGm1sIEbEl6JJtfuA8+Gw6UhbIMALHmelLQu5ntV9wNkuhSQSUm J0HF3qdbuvRXTfDIaXseI+pxwK2Zl1F9vqAm+YKIROB0dXmUhZ2alxO+Cr9FYk7DHOiP aRow== X-Gm-Message-State: AOUpUlEmrCVwi7sxGv9iviqWGFapUl0ws8nxK/cHmT/1ajOgz1M7KBHe x4y+irWUTQaUAUGxd7gZcXfZx1wlh6fqQ1NRazI= X-Google-Smtp-Source: AA+uWPwZ5WL4lKg0IJbki9mj0GBzuHQT89d7ey4FwjGPvoWY6defDMGYgh/CQwGUnL0l41a8WdWJZucZFzDpL/R4he8= X-Received: by 2002:a24:41e9:: with SMTP id b102-v6mr111377itd.19.1533598889321; Mon, 06 Aug 2018 16:41:29 -0700 (PDT) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:149299 Archived-At: --00000000000006b1ac0572ccd146 Content-Type: text/plain; charset="UTF-8" I'm circling back around to this; I think that that change makes a lot of sense. It seems better to me -- if you're calling one of these package functions, you probably want to work with the package system, which is only properly set up when you call package-initialize. What other functions would need to call package-initialize, if it hasn't been called? I notice that package-install already does that. Some other functions for installing don't (package-install-from-archive, package-install-from-buffer), but I'm not sure whether they need to. On Tue, May 29, 2018 at 6:58 PM, Stefan Monnier wrote: > >> 1. Make `package-installed-p' and other functions automatically > >> initialize package.el if necessary. > > Yes, when I changed it recently I hesitated to do that and decided to > refrain from doing so in order to minimize the changes, but it makes > a lot of sense. > > > Stefan > > > diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el > index 94d98178c4..56be5ef70c 100644 > --- a/lisp/emacs-lisp/package.el > +++ b/lisp/emacs-lisp/package.el > @@ -1889,8 +1889,8 @@ package-installed-p > ;; We used the quickstart: make it possible to use package-installed-p > ;; even before package is fully initialized. > (memq package package-activated-list)) > - ((not package--initialized) (error "package.el is not yet > initialized!")) > (t > + (unless package--initialized (package-initialize 'no-activate)) > (or > (let ((pkg-descs (cdr (assq package package-alist)))) > (and pkg-descs > --00000000000006b1ac0572ccd146 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I'm circling back around to this; I think that that ch= ange makes a lot of sense. It seems better to me -- if you're calling o= ne of these package functions, you probably want to work with the package s= ystem, which is only properly set up when you call package-initialize.
=
What other functions would need to call package-initialize, = if it hasn't been called? I notice that=C2=A0package-install already do= es that. Some other functions for installing don't (package-install-fro= m-archive,=C2=A0package-install-from-buffer), but I'm not sure whether = they need to.

On Tue, May 29, 2018 at 6:58 PM, Stefan Monnier <monnie= r@iro.umontreal.ca> wrote:
= >> 1. Make `package-installed-p' and other functions automa= tically
>>=C2=A0 =C2=A0 initialize package.el if necessary.

Yes, when I changed it recently I hesitated to do that and decided t= o
refrain from doing so in order to minimize the changes, but it makes
a lot of sense.


=C2=A0 =C2=A0 =C2=A0 =C2=A0 Stefan


diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 94d98178c4..56be5ef70c 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -1889,8 +1889,8 @@ package-installed-p
=C2=A0 =C2=A0 =C2=A0;; We used the quickstart: make it possible to use pack= age-installed-p
=C2=A0 =C2=A0 =C2=A0;; even before package is fully initialized.
=C2=A0 =C2=A0 =C2=A0(memq package package-activated-list))
-=C2=A0 =C2=A0((not package--initialized) (error "package.el is not ye= t initialized!"))
=C2=A0 =C2=A0 (t
+=C2=A0 =C2=A0 (unless package--initialized (package-initialize 'no-act= ivate))
=C2=A0 =C2=A0 =C2=A0(or
=C2=A0 =C2=A0 =C2=A0 (let ((pkg-descs (cdr (assq package package-alist))))<= br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 (and pkg-descs

--00000000000006b1ac0572ccd146--