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 09:54:30 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

> I would like to be able to update packages from the command line, and
> thanks to Lars, I now can do
> --8<---------------cut here---------------start------------->8---
> emacs -batch -funcall package-initialize -load ~/.emacs.elc -funcall 
> package-update-all
> --8<---------------cut here---------------end--------------->8---

`package-initialize` should basically never be needed any more (other
than internally within `package.el`).  `package-activate-all` should
be sufficient.
If not, report it as a bug.

> Alas, this has two problems:
>
> 1. It prints "No packages to update" even though M-x list-packages RET
> reports "Packages that can be upgraded: 3; type ā€˜Uā€™ to mark for upgrading".

I'll let the author of `package-update-all` deal with this part :-)

> 2. Loading ~/.emacs.elc is relatively slow (e.g., because it fetches a
> remote `remember-data-file'). so I would rather use something smaller.

If it hurts don't do that: e.g., only fetch that remote file
if (not noninteractive) or something like that.

> --8<---------------cut here---------------start------------->8---
> emacs -batch -load package -load ~/.config/emacs/package-quickstart.elc \

The above 2 steps should be subsumed by calling `package-activate-all`

>   -eval '(setq package-selected-packages (delete-dups 
> package-activated-list))' \

Hmm... I wonder why you needed that.

>   -eval '(push (quote ("melpa" . "https://melpa.org/packages/";)) 
> package-archives)' \

This one basically plays the role of a stripped down version of your `.emacs`.

> E.g., I would like to save `package-archives' in
> `package-quickstart-file' so that I won't have to specify it on the
> command line (it is set in ~/.emacs, of course).

I can't think of a way to do that in a way that's reliable for all the
various ways this var can be set.  :-(

I have wished for there to be a init file that's loaded in
batch sessions.  Sometimes I feel like `early-init.el` could
be this file; i.e. load it when in `--batch` as well.


        Stefan




reply via email to

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