GNU bug report logs - #21423
24.5; (package-initialize) added to init.el without (setq package-enable-at-startup nil)

Previous Next

Package: emacs;

Reported by: Phil Sainty <psainty <at> orcon.net.nz>

Date: Sun, 6 Sep 2015 11:02:02 UTC

Severity: normal

Found in version 24.5

Done: Artur Malabarba <bruce.connor.am <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


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

From: Artur Malabarba <bruce.connor.am <at> gmail.com>
To: Phil Sainty <psainty <at> orcon.net.nz>
Cc: 21423 <at> debbugs.gnu.org
Subject: Re: bug#21423: 24.5; (package-initialize) added to init.el without
 (setq package-enable-at-startup nil)
Date: Sun, 6 Sep 2015 13:59:22 +0100
I think I'd rather do the patch below.
This will not only help the situation where we automatically add
`(package-initialize)' to the init file, but it will also help those
users who have manually added it without knowing about this caveat.

Does anyone foresee problems with this?


From 94dafb46f7f258cb19929efc8bb9c123f428bcc5 Mon Sep 17 00:00:00 2001
From: Artur Malabarba <bruce.connor.am <at> gmail.com>
Date: Sun, 6 Sep 2015 13:52:54 +0100
Subject: [PATCH] * lisp/emacs-lisp/package.el (package-initialize): Set
 enable-at-startup

When `package-initialize' is called as part of loading the init file,
the user probably doesn't want it to be called again afterwards. In this
situation, `package-initialize' now sets `package-enable-at-startup' to
nil to prevent that. The user can have the old behaviour by setting this
variable to t after the call to `package-initialize'.  (Bug#21423)
---
 lisp/emacs-lisp/package.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 7c4f21f..57b35ca 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -1378,7 +1378,9 @@ it to the file."
   (if (equal user-init-file load-file-name)
       ;; If `package-initialize' is being called as part of loading
       ;; the init file, it's obvious we don't need to ensure-init.
-      (setq package--init-file-ensured t)
+      (setq package--init-file-ensured t
+            ;; And likely we don't need to run it again after init.
+            package-enable-at-startup nil)
     (package--ensure-init-file))
   (package-load-all-descriptors)
   (package-read-all-archive-contents)
-- 
2.5.1




This bug report was last modified 9 years and 256 days ago.

Previous Next


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