]> git.eshelyaron.com Git - emacs.git/commitdiff
Update selected packages when deleting last package
authorStefan Kangas <stefankangas@gmail.com>
Sat, 2 Sep 2023 16:22:23 +0000 (18:22 +0200)
committerStefan Kangas <stefankangas@gmail.com>
Sat, 2 Sep 2023 16:26:03 +0000 (18:26 +0200)
* lisp/emacs-lisp/package.el (package--save-selected-packages): Allow
setting 'package-selected-packages' to a nil value.  (bug#65475)

lisp/emacs-lisp/package.el

index e1172d69bf0e610f15f82b26ee277ea19be41a47..43842cfea735ca15df1d7277304669a24a7519bf 100644 (file)
@@ -1982,7 +1982,10 @@ Used to populate `package-selected-packages'."
 
 (defun package--save-selected-packages (&optional value)
   "Set and save `package-selected-packages' to VALUE."
-  (when value
+  (when (or value after-init-time)
+    ;; It is valid to set it to nil, for example when the last package
+    ;; is uninstalled.  But it shouldn't be done at init time, to
+    ;; avoid overwriting configurations that haven't yet been loaded.
     (setq package-selected-packages value))
   (if after-init-time
       (customize-save-variable 'package-selected-packages package-selected-packages)