[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#65475: 29.1; package-selected-packages variable is not updated when
From: |
Stefan Kangas |
Subject: |
bug#65475: 29.1; package-selected-packages variable is not updated when the last package is deleted |
Date: |
Sat, 26 Aug 2023 13:57:22 +0200 |
> The issue here is that `package--save-selected-packages' only updates
> the value of `package-selected-packages', if the new value is non-nil,
> presumably because the VALUE argument is optional,
This was added in d0a5162fd825, fixing Bug#20855. Personally, I'm not
a huge fan of that fix, as nil is clearly a valid (if infrequent)
value here.
Could something like this work?
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index e1172d69bf0..9f97f950e64 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -1982,7 +1982,7 @@ package--find-non-dependencies
(defun package--save-selected-packages (&optional value)
"Set and save `package-selected-packages' to VALUE."
- (when value
+ (when (or value after-init-time)
(setq package-selected-packages value))
(if after-init-time
(customize-save-variable 'package-selected-packages
package-selected-packages)