emacs-devel
[Top][All Lists]
Advanced

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

Re: package-update-all from command line


From: Stefan Monnier
Subject: Re: package-update-all from command line
Date: Tue, 24 May 2022 15:55:41 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

>>>>>   -eval '(setq package-selected-packages (delete-dups 
>>>>> package-activated-list))' \
>>>> Hmm... I wonder why you needed that.
>>> because otherwise `package-selected-packages' is nil and there is
>>> nothing to update.
>>
>> I can't see in the code where `package-update-all` ends up using
>> `package-selected-packages`.
>> At the place where it uses it, it probably should auto-initialize it if
>> it's still nil.
>
> note that it should be auto-initialized based on package-quickstart.el
> which contains the list of packages that the used installed.

That's unrelated, actually: when nil `package-selected-packages` can be
auto-initialized based on the set of packages currently installed.
`package-quickstart.el` doesn't set `package-selected-packages` nor does
it pay attention to the set of packages currently installed: it just
activates in one go a particular set of packages (which are presumably
all still installed in the same way as when that quickstart file was
created).

In any case, the question is to figure out where `package-update-all`
ends up using `package-selected-packages` and from there to figure out
where to add the same

    (unless (consp package-selected-packages)
      (package--save-selected-packages (package--find-non-dependencies)))

as currently found in `package--user-selected-p`.
[ Tho maybe, we shouldn't "save" this, really.  ]

>>> and I need `delete-dups' because `package-activated-list' will repeat
>>> all installed packages as many times as `list-packages' or
>>> `package-quickstart-refresh' was called.
>>
>> I can't see in the code many efforts to make absolutely sure that
>> duplicates don't make it there, admittedly.
>> But `package-quickstart-refresh` let-binds it to nil around the whole
>> call so it shouldn't be able to modify it at all.  And I can't think of
>> any reason why `list-packages` would modify that var either.
>> IOW, sounds like a bug somewhere.
>
> The breakage may come from loading package-quickstart.el multiple times.

Ah, that might be it.  Indeed the quickstart file contains:

          `(setq package-activated-list
                 (append ',(mapcar #'package-desc-name package--quickstart-pkgs)
                         package-activated-list))

:-(

> One is not supposed to do that, of course...

If it happens accidentally, please report it as a bug.

>> `package-archives` is a completely different problem because it's
>> a defcustom which may be set to a different value in the user's config
>> in all kinds of different ways, and which may be eval'd either before or
>> after loading the quickstart file, so it *would* mess up the user's
>> config in various circumstances.
> so save a new non-user variable like `package-current-archives' instead,
> so that I can set `package-archives' from it on the command line.

Setting `package-archives` from `package-current-archives` doesn't seem
much easier than the ad-hoc addition of "melpa" you're currently using,
so it doesn't seem like a great improvement.

I think we'd want to try and find a more general solution to a more
general problem.

>> Maybe a more general way to attack this problem would be to try and
>> create a "quickinit.el" file which is a bit like a "dump" of the user's
>> config, so it can be used instead of loading `init.el`?
> here we already have package-quickstart.el which can be re-used.

AFAIK the problem is not how to name the file but what to put into it.


        Stefan




reply via email to

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