From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.bugs Subject: bug#47124: 28.0.50; [PATCH] Init archive and add noconfirm to 'package-install-selected-packages' Date: Sat, 13 Mar 2021 13:01:14 -0600 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31756"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 47124@debbugs.gnu.org To: Gabriel Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Mar 13 20:03:23 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1lL9Xm-0008BK-Pv for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 13 Mar 2021 20:03:22 +0100 Original-Received: from localhost ([::1]:59242 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lL9Xl-0008Tn-QP for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 13 Mar 2021 14:03:21 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50236) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lL9WU-0007cs-K1 for bug-gnu-emacs@gnu.org; Sat, 13 Mar 2021 14:02:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49130) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lL9WU-0001Nh-Bo for bug-gnu-emacs@gnu.org; Sat, 13 Mar 2021 14:02:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lL9WU-0005Ge-AB for bug-gnu-emacs@gnu.org; Sat, 13 Mar 2021 14:02:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 13 Mar 2021 19:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47124 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 47124-submit@debbugs.gnu.org id=B47124.161566208720187 (code B ref 47124); Sat, 13 Mar 2021 19:02:02 +0000 Original-Received: (at 47124) by debbugs.gnu.org; 13 Mar 2021 19:01:27 +0000 Original-Received: from localhost ([127.0.0.1]:60672 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lL9Vu-0005FX-S1 for submit@debbugs.gnu.org; Sat, 13 Mar 2021 14:01:27 -0500 Original-Received: from mail-pj1-f48.google.com ([209.85.216.48]:42677) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lL9Vo-0005FA-Ux for 47124@debbugs.gnu.org; Sat, 13 Mar 2021 14:01:25 -0500 Original-Received: by mail-pj1-f48.google.com with SMTP id j6-20020a17090adc86b02900cbfe6f2c96so12715133pjv.1 for <47124@debbugs.gnu.org>; Sat, 13 Mar 2021 11:01:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:in-reply-to:references:user-agent :mime-version:date:message-id:subject:to:cc; bh=8YVl82RVJOBCuZx9OI72UllyCms1WkD50hEmI2SD3iI=; b=cWhBOeAgZla48VDLtGXNf330rINlsTRHEGD7yhGhhRVOmGi0sNEpelPhDgb1gEntER LL4ZfXyBNOK62aQqu9/o+YD2ekHTdfSUMUUWU8ElJRNxwJY/4bCPcsmfjlfs4/EAS9rJ QoNY+2+jCoUl6UJqoR2vsqRYw0rrqR8yzD8cXvOCPv3TQnwPR5AloVaTDGtoNlQ8HXxa Ei+H7JPsiUR8e0WQptvNmpBwlMCxUE6kU5EZybCJRJVc14DEKOxIx593Z0oXB1mbYeeh GeavRJwWYvSmeYLWnlAm7MoIQ7Rx4xgcvS4gBwaVyTx1bn0S26OJdME3uZgQyZcBJUO5 zK1g== X-Gm-Message-State: AOAM530eSqIiwTDXTlPfUmOozNWqUWYNrrpk4C+uyuKTDBpoQ28QKq0k JNukwjfft9kyyHSw6+pAB3ITs7po9JW4cXBQwok= X-Google-Smtp-Source: ABdhPJxhy3krChEQMJEVSiA1EuJKVWnrfD8Brm1g+jd7jx+Bzu/gOD5GV2dxZONi/EN9DX+ouFj4K00gvfQ+46SQWso= X-Received: by 2002:a17:90a:f986:: with SMTP id cq6mr4894148pjb.175.1615662075130; Sat, 13 Mar 2021 11:01:15 -0800 (PST) Original-Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Sat, 13 Mar 2021 13:01:14 -0600 In-Reply-To: (Gabriel's message of "Sat, 13 Mar 2021 14:15:07 -0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:202288 Archived-At: Gabriel writes: > This patch adds the following to 'package-install-selected-packages': > - a call to 'package--archives-initialize', to initialize the archive > contents, similar to how 'package-install' works; > - a new optional argument NOCONFIRM, to don't ask for confirmation when > installing new packages. LGTM, with one minor nit: > ;;;###autoload > -(defun package-install-selected-packages () > +(defun package-install-selected-packages (&optional noconfirm) > "Ensure packages in `package-selected-packages' are installed. > -If some packages are not installed propose to install them." > +If some packages are not installed, propose to install them. > +If optional argument NOCONFIRM is non-nil, don't ask for > +confirmation to install packages." > (interactive) > ;; We don't need to populate `package-selected-packages' before > ;; using here, because the outcome is the same either way (nothing > ;; gets installed). > + (package--archives-initialize) I would put this new line above the comment, as the comment relates to this next line: > (if (not package-selected-packages) > (message "`package-selected-packages' is empty, nothing to install") > (let* ((not-installed (seq-remove #'package-installed-p package-selected-packages)) > @@ -2220,10 +2223,11 @@ package-install-selected-packages > (difference (- (length not-installed) (length available)))) > (cond > (available > - (when (y-or-n-p > - (format "Packages to install: %d (%s), proceed? " > - (length available) > - (mapconcat #'symbol-name available " "))) > + (when (or noconfirm > + (y-or-n-p > + (format "Packages to install: %d (%s), proceed? " > + (length available) > + (mapconcat #'symbol-name available " ")))) > (mapc (lambda (p) (package-install p 'dont-select)) available))) > ((> difference 0) > (message "Packages that are not available: %d (the rest is already installed), maybe you need to `M-x package-refresh-contents'"