]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/emacs-lisp/package.el (package--save-selected-packages):
authorArtur Malabarba <bruce.connor.am@gmail.com>
Tue, 30 Jun 2015 09:17:55 +0000 (10:17 +0100)
committerArtur Malabarba <bruce.connor.am@gmail.com>
Tue, 30 Jun 2015 09:19:15 +0000 (10:19 +0100)
Don't save before init time, to avoid overwriting configurations.
(Bug#20855)

lisp/emacs-lisp/package.el

index 9f5634577482188a986272cb86ca542d346436d6..e599e840fb7f6ec3cfe9bac5494e010f90803c4b 100644 (file)
@@ -1620,12 +1620,14 @@ Used to populate `package-selected-packages'."
              unless (memq name dep-list)
              collect name)))
 
-(defun package--save-selected-packages (value)
+(defun package--save-selected-packages (&optional value)
   "Set and save `package-selected-packages' to VALUE."
-  (let ((save-silently inhibit-message))
-    (customize-save-variable
-     'package-selected-packages
-     (setq package-selected-packages value))))
+  (when value
+    (setq package-selected-packages value))
+  (if after-init-time
+      (let ((save-silently inhibit-message))
+        (customize-save-variable 'package-selected-packages package-selected-packages))
+    (add-hook 'after-init-hook #'package--save-selected-packages)))
 
 (defun package--user-selected-p (pkg)
   "Return non-nil if PKG is a package was installed by the user.