unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Sam Steingold <sds@gnu.org>
To: emacs-devel@gnu.org, Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Lars Magne Ingebrigtsen <larsi@gnus.org>
Subject: Re: package-update-all from command line
Date: Tue, 24 May 2022 11:04:15 -0400	[thread overview]
Message-ID: <lztu9fj7kg.fsf@3c22fb11fdab.ant.amazon.com> (raw)
In-Reply-To: <jwvee0joxko.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Tue, 24 May 2022 09:54:30 -0400")

> * Stefan Monnier <zbaavre@veb.hzbagerny.pn> [2022-05-24 09:54:30 -0400]:
>
>> 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.

replacing `package-initialize' with `package-activate-all' above results in

--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (void-function package-update-all)
--8<---------------cut here---------------end--------------->8---


>> 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 :-)

.emacs fragment for Lars:

--8<---------------cut here---------------start------------->8---
(with-eval-after-load "package"
  (dolist (s '(("melpa" . "https://melpa.org/packages/")))
    (add-to-list 'package-archives s)))
--8<---------------cut here---------------end--------------->8---


>> 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.

I restart emacs only once a week, when I rebuild it.
Not a problem interactively.

>> --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`

no, as indicated by the error above, `package-activate-all' does not
load package, so `package-update-all' and `package-archives' is still
not available:

--8<---------------cut here---------------start------------->8---
Error: void-variable (package-archives)
--8<---------------cut here---------------end--------------->8---

>>   -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.
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.

>>   -eval '(push (quote ("melpa" . "https://melpa.org/packages/")) package-archives)' \
>
> This one basically plays the role of a stripped down version of your `.emacs`.

yep - a fraction of a percent.

>> 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.  :-(

just add a setq at the end, like we already do with `package-activated-list'.

Thank you for your reply.

-- 
Sam Steingold (http://sds.podval.org/) on darwin Ns 10.3.2113
http://childpsy.net http://calmchildstories.com http://steingoldpsychology.com
https://jij.org https://camera.org https://mideasttruth.com
There are two ways to win an argument with a woman.  Neither works.



  parent reply	other threads:[~2022-05-24 15:04 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   ` Sam Steingold [this message]
2022-05-24 15:52     ` package-update-all from command line Stefan Monnier
2022-05-24 19:01       ` Sam Steingold
2022-05-24 19:55         ` Stefan Monnier
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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=lztu9fj7kg.fsf@3c22fb11fdab.ant.amazon.com \
    --to=sds@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=larsi@gnus.org \
    --cc=monnier@iro.umontreal.ca \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).