[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#31397: 27.0.50; Emacs doesn't call package-initialize if there's no

From: Zachary Kanfer
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

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 <address@hidden> 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.


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!"))
+    (unless package--initialized (package-initialize 'no-activate))
      (let ((pkg-descs (cdr (assq package package-alist))))
        (and pkg-descs

reply via email to

[Prev in Thread] Current Thread [Next in Thread]