Eli Zaretskii writes: >> Date: Wed, 23 Aug 2023 18:02:14 +0600 >> From: Andrey Samsonov >> >> Steps to reproduce: >> >> 1. Start 'emacs -Q --init-directory ', where is directory >> with only zero-sized 'init.el' file >> 2. M-x package-install RET mines RET >> 3. M-x package-install RET chess RET >> 4. C-h v package-selected-packages RET: Its value is (chess mines) >> 5. M-x package-delete RET mines RET >> 6. C-h v package-selected-packages RET: Its value is (chess) >> 7. M-x package-delete RET chess RET >> >> Actual behavior: >> >> 8. C-h v package-selected-packages RET: Its value is (chess) >> >> Expected behavior: >> >> 8. C-h v package-selected-packages RET: Its value is nil > > Philip, Stefan: any comments? 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, and it should be possible to invoke the function without any new value, just wishing to save the current one to disk (in fact this behaviour is required for the `after-init-hook'-trick to work). But if 'chess is removed from '(chess), the value is nil, hence nothing happens. One could imagine allowing a special value like 'empty to resolve the issue: