reddit / emacs

package-autoremove showing almost all non-built-in packages as not needed?

Gangsir · 2022-01-25 15:35
I'm using use-package to manage my packages, and running into a (technically ignorable but suspicious) behavior where, after an update, `list-packages` tells me that there's a ton of packages that aren't needed and can be removed, and to run `package-autoremove` to remove them. However, this seems to be almost all of my installed packages. Is this a known issue/conflict with Melpa packages/use-package/something else, or is it offering to remove the older versions, or is something messed up? It's not a huge issue as I can just.... not answer y to package-autoremove.... but it shouldn't be considering everything unneeded. Plus I guess it prevents me from later removing actually unneeded stuff... Anyone else have this issue?
Danrobi1 · 2022-01-25 16:01
I've noclue about `package-autoremove`. You can always remove packages manually. When running `auto-package-update-now` there's a `package update results` buffer. That list all upgraded packages. With `package-delete` you delete the oldest version of the upgraded packages.
_pkal · 2022-01-25 16:09
AFAIR package.el uses `package-selected-packages` to track the packages you installed manually, and traces dependencies to infer what packages shouldn't be autoremoved based on the contents of that list. Did you prevent package.el from saving this variable, eg. by disabling customize (something like `(setq custom-file "/dev/null")`)? I don't know if use-package messes with the variable, but I think it shouldn't because it explicitly presents itself as a configuration macro, and not a package manager.
Gangsir · 2022-01-25 17:31
Hmm, no that's not it, I have my custom file set to an actual file in .emacs.d, and package-selected-packages correctly lists all my installed packages (that I initially installed via `:ensure t` in my use-package call... use-package docs does say it populates selected-packages with stuff that's `:ensure`-ed, so that's working normally). It also says in the docs of package-selected-packages that package-autoremove considers it... and yet it wants to remove everything. How odd.
mrolivertaylor · 2022-01-25 17:55
[These issues](https://github.com/jwiegley/use-package/issues?q=is%3Aissue+is%3Aopen+package-autoremove) might have something to do with it. If you run `list-packages` are all your packages listed as dependencies or "installed"?
_pkal · 2022-01-25 19:40
What is the value of `package-selected-packages`? And does manually installing a pacakge via `package-install` change anything?