From: Stefan Kangas Date: Sat, 2 Sep 2023 16:22:23 +0000 (+0200) Subject: Update selected packages when deleting last package X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=610105ee81bbf79f72d4efb46d0caddf8d654cf1;p=emacs.git Update selected packages when deleting last package * lisp/emacs-lisp/package.el (package--save-selected-packages): Allow setting 'package-selected-packages' to a nil value. (bug#65475) --- diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index e1172d69bf0..43842cfea73 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -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)