From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Sam Steingold Newsgroups: gmane.emacs.devel Subject: Re: package-update-all from command line Date: Tue, 24 May 2022 11:04:15 -0400 Message-ID: References: <877d6bd2a2.fsf@gnu.org> Reply-To: sds@gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30761"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (darwin) Cc: Lars Magne Ingebrigtsen To: emacs-devel@gnu.org, Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue May 24 17:05:30 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ntW6D-0007ow-QD for ged-emacs-devel@m.gmane-mx.org; Tue, 24 May 2022 17:05:29 +0200 Original-Received: from localhost ([::1]:57232 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntW6C-0005M5-2B for ged-emacs-devel@m.gmane-mx.org; Tue, 24 May 2022 11:05:28 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:32856) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntW59-0004fm-Vf for emacs-devel@gnu.org; Tue, 24 May 2022 11:04:24 -0400 Original-Received: from mail-qk1-x732.google.com ([2607:f8b0:4864:20::732]:40490) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ntW55-0006td-RG; Tue, 24 May 2022 11:04:23 -0400 Original-Received: by mail-qk1-x732.google.com with SMTP id b200so6249138qkc.7; Tue, 24 May 2022 08:04:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:in-reply-to:references:user-agent :return-receipt-to:reply-to:mail-followup-to:date:message-id :mime-version:content-transfer-encoding; bh=q8lY1Hc6ZNmIaPxCOSvNB5knvuz4UiVcoDKpD6qr+f0=; b=ENDY5l3e3yO5orMN9rlvILymA80y5rqtrnManAbVznGqJpd4ZGyWUUCX73KzvToLez WFBbDDvXlWg5bWMgESsKq211GhQ6qs9gwQuYRhOxDzw4p2aaLhuxAE9wBbhxxUECDnmK pzVGE/XPP15A27i6j7DKffCLQORLPHf5FgXYaqiPcE0zynxkkvmAaCQ9zgbv32/7H5Ei Gnd74b57BQ8R5NAXAFdMdn4dFPog2+AAiBfpvdNtC3mO/89aoBFW89EDbb4ZOfW6g3Ka XTgCV7fl/Sx+yuoH78SPUJLeTF+mvYEm/TCG6CcvGM3/0C9kDUpveMGA3WBCer4NxHp+ WG3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:in-reply-to:references :user-agent:return-receipt-to:reply-to:mail-followup-to:date :message-id:mime-version:content-transfer-encoding; bh=q8lY1Hc6ZNmIaPxCOSvNB5knvuz4UiVcoDKpD6qr+f0=; b=prLVlFtp5njnY9tVo4GCkt8FItqBxfsPI+NJczJUE1CYCInI8XMz7xc/xFvyOMeYy4 zDWhKGf4nuFjcuVCdVU3kvXwjpIpWKjU7sTGChJoFPdOGZ2t08ke9t41r9vY1BLfSmgD mUTUnEzaL+T6WPsJ5ZmPY12vbo1kCbF/aqbEuuH4moguCq6rAYRs3xZtGBZ3UyVoMo0d 22wF/XlH76LC7giZccUA1OPsx44/twa5AhVXHgHmhj7HGAIPofh5SMHnAkekuQYBOD3g 5UqMkVd1s1uX9nyKKMfVqf+8MyPjeAAmwrx5TcByZiHRFXEhHhcv/3dOEPlK3p161PJ2 9HgQ== X-Gm-Message-State: AOAM5337JQv+3QUKBDqBWz6jjpAuyhl8jQiyWyYyjvyVXpJwUSWyC789 A2lHVvCFHhwwtnFdqGZ7bepbNCXPwg== X-Google-Smtp-Source: ABdhPJzEKgX8d91+TqxwmQVht/S+2h7N5/oNGDox8zs4H7T1NDATm2JYoSHaPicibDWsZyx0eZvH5Q== X-Received: by 2002:a05:620a:2546:b0:680:f744:5bc6 with SMTP id s6-20020a05620a254600b00680f7445bc6mr17663784qko.113.1653404657476; Tue, 24 May 2022 08:04:17 -0700 (PDT) Original-Received: from 3c22fb11fdab.ant.amazon.com (pool-108-30-23-113.nycmny.fios.verizon.net. [108.30.23.113]) by smtp.gmail.com with ESMTPSA id cg7-20020a05622a408700b002f9050bb622sm6270603qtb.69.2022.05.24.08.04.16 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 24 May 2022 08:04:16 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Tue, 24 May 2022 09:54:30 -0400") X-Attribution: Sam X-Disclaimer: You should not expect anyone to agree with me. Mail-Followup-To: emacs-devel@gnu.org, Stefan Monnier , Lars Magne Ingebrigtsen Received-SPF: pass client-ip=2607:f8b0:4864:20::732; envelope-from=sam.steingold@gmail.com; helo=mail-qk1-x732.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:290191 Archived-At: > * Stefan Monnier [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 pac= kage-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 =E2=80=98U=E2=80=99 to m= ark 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 `.em= acs`. 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. --=20 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.