help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: package-autoremove ?


From: Philip Kaludercic
Subject: Re: package-autoremove ?
Date: Sat, 26 Aug 2023 12:03:15 +0000

David Masterson <dsmasterson@gmail.com> writes:

> Philip Kaludercic <philipk@posteo.net> writes:
>
>> 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):
>>
>> ...
>>                 (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))
>> ...
>>
>>
>> What might be an issue, is that package-install tries to save the
>> modification of `package-selected-packages' to disk (package.el):
>
> Save it to "custom-file" which might be nil (.emacs).  Didn't know about
> custom-file... 
>
>>   (if after-init-time
>>       (customize-save-variable 'package-selected-packages
>>                                package-selected-packages)
>>     (add-hook 'after-init-hook #'package--save-selected-packages))
>>
>> 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).
>
> What happens if custom-file (.emacs) is already loaded in a buffer?  I
> thought, if you customize something (via the GUI?), the custom-file
> (.emacs) would be loaded into a buffer (unless it's already in a buffer)
> and the custom-variables would be updated.  When you exit Emacs, the
> file would be saved.

That should be the case.  You can experiment with this yourself using
`customize-save-variable'.

-- 
Philip Kaludercic



reply via email to

[Prev in Thread] Current Thread [Next in Thread]