From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: package-update-all from command line Date: Tue, 24 May 2022 15:55:41 -0400 Message-ID: References: <877d6bd2a2.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40199"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue May 24 21:57:45 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 1ntaf2-000AKs-W3 for ged-emacs-devel@m.gmane-mx.org; Tue, 24 May 2022 21:57:45 +0200 Original-Received: from localhost ([::1]:53194 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntaf1-0005qA-Ur for ged-emacs-devel@m.gmane-mx.org; Tue, 24 May 2022 15:57:43 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55656) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntadB-0003oD-WA for emacs-devel@gnu.org; Tue, 24 May 2022 15:55:51 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:27253) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntad8-0008QC-E5 for emacs-devel@gnu.org; Tue, 24 May 2022 15:55:47 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 2C25B1001CB; Tue, 24 May 2022 15:55:44 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 66324100091; Tue, 24 May 2022 15:55:42 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1653422142; bh=ptvL7QxRWZC3hzIKQ2qv/BRwTdOQw9/CQKWTEOgaGhw=; h=From:To:Subject:References:Date:In-Reply-To:From; b=gd6NL0ClchcvlyVrXboNW6pjk+NbQayOgdwm/spD+BIOMEwmFGQ03zwnD/F5aIV63 5OngJk6lFNnxeJAmCv+jJ/hsFl3Cbba2ObXEFv/jS6PEaBfXLLPUpL9nfcXaCP2/mI RKO2uQWpUIitkr6lNIPtX42ue5mQwsOeS+WawMsMErAuekbhgmAghU2K3O8DyWw7SJ xC6vSrf48XbddOcz+pVdFiPIuWnC95nRy+9DAj9DrN7B7hZFStXSTXVNT1gC5MokaO A5uu5SAduu/MHbyLEB5V3ZbHPCEBe2jBanegUCquvlhBfh6IYXwuLB8i9eJ8tsceHu LYYyHcv6ttDzw== Original-Received: from pastel (unknown [45.72.221.51]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 41F911208F3; Tue, 24 May 2022 15:55:42 -0400 (EDT) In-Reply-To: (Sam Steingold's message of "Tue, 24 May 2022 15:01:24 -0400") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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:290211 Archived-At: >>>>> -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