Jimmy Wong writes: > I don’t think you should dedup the variable that could have been > modified by something else such as package-install. This may make > debugging harder should package.el itself introduce a bug that > duplicates pacakages in the variable. How about just using good old > add-to-list? The issue is that we want to go through package--save-selected-packages, that is given a new value to assign to `package-selected-packages'. An otherwise, I my understanding is that add-to-list is not conventional in executed code. The alternative is to check for duplicates before invoking the function: