[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: package-autoremove ?
From: |
Tassilo Horn |
Subject: |
Re: package-autoremove ? |
Date: |
Fri, 25 Aug 2023 10:40:34 +0200 |
User-agent: |
mu4e 1.11.15; emacs 30.0.50 |
Philip Kaludercic <philipk@posteo.net> writes:
Hi Philip,
>>> For me, this situation comes up when I install a package via
>>> `(use-package ... :ensure t)' instead of via `list-packages'.
>>
>> Sounds like a good possibility for me as well. Someone should adjust
>> use-package to add the package to package-selected-packages for this
>> reason. My Lisp isn't that good.
>
> The :ensure keyword for use-package should select the packages, since
> it invokes `package-install' without setting the optional DONT-SELECT
> argument (use-package-ensure.el):
>
> --8<---------------cut here---------------start------------->8---
> ...
> (if (assoc package package-archive-contents)
> (package-install package)
> (package-refresh-contents)
> (when (assoc package (bound-and-true-p
> package-pinned-packages))
> (package-read-all-archive-contents))
> (package-install package))
> ...
> --8<---------------cut here---------------end--------------->8---
>
> What might be an issue, is that package-install tries to save the
> modification of `package-selected-packages' to disk (package.el):
>
> --8<---------------cut here---------------start------------->8---
> (if after-init-time
> (customize-save-variable 'package-selected-packages
> package-selected-packages)
> (add-hook 'after-init-hook #'package--save-selected-packages))
> --8<---------------cut here---------------end--------------->8---
>
> Now if you have customised `custom-file' and/or don't load the
> contents of the file, then upon restarting Emacs the updated value
> would be lost and package-autoremove would suggest removing all the
> packages installed by use-package (but also package-install, for that
> matter).
Very good analysis. I'm also affected by that issue and indeed, I have
customized custom-file, because I use the very same user-init-file on
multiple machines but put minor machine-related tweaks in custom-file.
Basically, my user-init-file starts with:
--8<---------------cut here---------------start------------->8---
(setopt custom-file (expand-file-name
"custom.el"
(if user-init-file
(file-name-directory user-init-file)
"~/.emacs.d/")))
(load custom-file t)
--8<---------------cut here---------------end--------------->8---
Now on two machines which should have pretty much the same emacs setup
(pretty current git master with the same init.el containing the same
use-package with :ensure t statements), package-autoremove suggests
different removal sets. The union of both sets contains many packages
installed by use-package which are certainly wrong.
It would be great if that could be fixed.
Bye,
Tassilo
- package-autoremove ?, David Masterson, 2023/08/22
- Re: package-autoremove ?, Rudolf Schlatte, 2023/08/22
- Re: package-autoremove ?, David Masterson, 2023/08/25
- Re: package-autoremove ?, Philip Kaludercic, 2023/08/25
- Re: package-autoremove ?,
Tassilo Horn <=
- Re: package-autoremove ?, Philip Kaludercic, 2023/08/25
- Re: package-autoremove ?, Tassilo Horn, 2023/08/25
- Re: package-autoremove ?, Tassilo Horn, 2023/08/25
- Re: package-autoremove ?, David Masterson, 2023/08/25
- Re: package-autoremove ?, David Masterson, 2023/08/25
- Re: package-autoremove ?, Philip Kaludercic, 2023/08/26