all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: emacs-devel@gnu.org
Subject: Re: package-update-all from command line
Date: Tue, 24 May 2022 15:55:41 -0400	[thread overview]
Message-ID: <jwvilpun2gq.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <lzpmk2kb5n.fsf@3c22fb11fdab.ant.amazon.com> (Sam Steingold's message of "Tue, 24 May 2022 15:01:24 -0400")

>>>>>   -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	other threads:[~2022-05-24 19:55 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-24  3:42 package-update-all from command line Sam Steingold
2022-05-24 13:54 ` Stefan Monnier
2022-05-24 14:05   ` Eli Zaretskii
2022-05-24 16:00     ` Loading early-init.el in batch mode (was: package-update-all from command line) Stefan Monnier
2022-05-24 18:58       ` Eli Zaretskii
2022-05-24 15:04   ` package-update-all from command line Sam Steingold
2022-05-24 15:52     ` Stefan Monnier
2022-05-24 19:01       ` Sam Steingold
2022-05-24 19:55         ` Stefan Monnier [this message]
2022-05-25 15:14           ` Sam Steingold
2022-05-25 16:13             ` Stefan Monnier
2022-05-26 15:13               ` Sam Steingold
2022-05-26 15:35                 ` Stefan Monnier
2022-05-25  1:26 ` Lars Ingebrigtsen
2022-05-25  4:58   ` Tassilo Horn
2022-05-25 12:05     ` Lars Ingebrigtsen
2022-05-25 12:27       ` Tassilo Horn
2022-05-27 10:21         ` Lars Ingebrigtsen
2022-05-27 20:33           ` Tassilo Horn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvilpun2gq.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.