From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gabriel 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 16:16:32 -0300 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11016"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) To: 47124@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Mar 13 20:17:29 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 1lL9lQ-0002mB-W5 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 13 Mar 2021 20:17:29 +0100 Original-Received: from localhost ([::1]:39286 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lL9lP-0004eY-UM for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 13 Mar 2021 14:17:27 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52392) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lL9l0-0004dP-Gk for bug-gnu-emacs@gnu.org; Sat, 13 Mar 2021 14:17:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49143) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lL9l0-0003Ij-1e for bug-gnu-emacs@gnu.org; Sat, 13 Mar 2021 14:17:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lL9kz-0005bd-RG for bug-gnu-emacs@gnu.org; Sat, 13 Mar 2021 14:17:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Gabriel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 13 Mar 2021 19:17:01 +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 X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.161566300821525 (code B ref -1); Sat, 13 Mar 2021 19:17:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 13 Mar 2021 19:16:48 +0000 Original-Received: from localhost ([127.0.0.1]:60689 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lL9kl-0005b7-PI for submit@debbugs.gnu.org; Sat, 13 Mar 2021 14:16:48 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:40536) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lL9kh-0005aw-8n for submit@debbugs.gnu.org; Sat, 13 Mar 2021 14:16:46 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52380) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lL9kf-0004T7-Mq for bug-gnu-emacs@gnu.org; Sat, 13 Mar 2021 14:16:43 -0500 Original-Received: from mail-dm6nam10olkn2060.outbound.protection.outlook.com ([40.92.41.60]:46176 helo=NAM10-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lL9kc-0003IA-UL for bug-gnu-emacs@gnu.org; Sat, 13 Mar 2021 14:16:41 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Oqb7Y83NnkhNnIqn2ZAH4UNGoZim3+BtyuVXlJtTArUgTEuOzOPLPXR3HL45HdrX+w+vPrrTzCtEHsrE51dgJW6V8upfJobfwOmTnSAKo6MhUJ7qW99w61hZi2VUU35w2Xo69urc/XXxalPcEIW6I9nVqFcE+VIxPcMYDxtnVPwqSwLJLvCEHdOlQTjHB1v2QZqlOGB27S8wcQOjOJneLwtOeKYattpygcUsYAqPd6kv8MBduN3rz83noUOPPIAdNzIss910uwUia2Zu5nm7mZMdX9Yn8ouCvNx7yOe6K2cnw94qCH7PWX69hNLPoHNrAIPNc/+8Byl/AbJfn4slvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eYu4V9Go/Ktb+x9895kYqA65p/Zi1zyVWT/mp6Q1MH4=; b=Ur+tl1IOrgrKgqF/dZtUUYwgZhbrY5BdaOtgz6vbOIMM+snw/8w4KnJQd9uW0P9hMVuRP6PcWc1GCaWl7kfo2pgiAaFyCf9D9gPT4GAJduEhyBBHxDplvfUmOHZuwWmtlYwBOWAL081C0vrd3twU60LlBmgAlKWssCl7EswLCbEa9MEFTzrTl1bbRxDf8kqOvfptZMWr/+1SH84UmXReBFHqkgqV7WvNACuJYmtBSwUPDdxQu9zUUAPpS5EYKzr1kuBp9bAL6BOB2LKG2eij1wnyaHLkzcwVGWRtpGLNNb2GvxsKvBGMh3EMssNXTooXyI/nHtxZ4y6eE689FF6I/w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eYu4V9Go/Ktb+x9895kYqA65p/Zi1zyVWT/mp6Q1MH4=; b=A/9D3wvSKXZeFxH2Lq98jmmueoapsFH6YMLInNpHuyHiZn91bFANjsKLnJNA/7mMdhPCrYvVeflV1D9u75IIiuV2PVoH9CHF3FQodUHCLOD7McbKfEx2yxAjxWwNvhFIA7hLcrs9KLPxIxNX35ClglOV2B+OItppbyrKWo5pGbsjNRWVh+XSw0xmvbjob6DeJkWw/SbQXb9F2s5iMX3Ej0RFgFK/A5RjJs91AMX/7Im+lRQ5SRlbE0jm3zharzixl94XemXGOd53ucTj/lp8tZJDlIaJxh8YPj8aNjAvjGVIwF+1P6rVy52+R4IiQ3mmf60fw9zL+zlmsKuTpatntQ== Original-Received: from DM6NAM10FT004.eop-nam10.prod.protection.outlook.com (2a01:111:e400:7e86::4b) by DM6NAM10HT160.eop-nam10.prod.protection.outlook.com (2a01:111:e400:7e86::250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3933.31; Sat, 13 Mar 2021 19:16:36 +0000 Original-Received: from CH2PR01MB5879.prod.exchangelabs.com (2a01:111:e400:7e86::46) by DM6NAM10FT004.mail.protection.outlook.com (2a01:111:e400:7e86::222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3933.31 via Frontend Transport; Sat, 13 Mar 2021 19:16:36 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:B3EFED65C7C973F1EF424B82E1730738059F2A813A94BF367E14D9ED7C6E511E; UpperCasedChecksum:CAFFDEFBA4C1BC6533819F491C2ECEBC147707BDF516DACE84D9882144E37A37; SizeAsReceived:7633; Count:45 Original-Received: from CH2PR01MB5879.prod.exchangelabs.com ([fe80::592f:9a58:d8cd:d9c9]) by CH2PR01MB5879.prod.exchangelabs.com ([fe80::592f:9a58:d8cd:d9c9%7]) with mapi id 15.20.3912.028; Sat, 13 Mar 2021 19:16:36 +0000 In-Reply-To: (Stefan Kangas's message of "Sat, 13 Mar 2021 13:01:14 -0600") X-TMN: [F5ImVJ5i6Vqnsw1+ACoh4HbmZgeVk8m4r0y2eWAdtly7rHPdNpwdHuNi0M0QOYwV] X-ClientProxiedBy: CP3P284CA0144.BRAP284.PROD.OUTLOOK.COM (2603:10d6:103:6a::29) To CH2PR01MB5879.prod.exchangelabs.com (2603:10b6:610:3c::12) X-Microsoft-Original-Message-ID: <87pn02lv8v.fsf@hotmail.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from precision5540 (2804:431:c7f2:d29a:25d8:42fc:c5b0:f20) by CP3P284CA0144.BRAP284.PROD.OUTLOOK.COM (2603:10d6:103:6a::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3933.31 via Frontend Transport; Sat, 13 Mar 2021 19:16:35 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 45 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: e0ab0aca-e0f8-47ac-968f-08d8e654856b X-MS-TrafficTypeDiagnostic: DM6NAM10HT160: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: x8pwYOhFcaZTx89ujSzMWAV2RUJyE5G3+0XnrTGcg6c2pPvD/T1P/9wlGv/zUNSZTYDJnHEO3SWqukbDPNmOLx2WEchT//eFLq/8ApibuWVbP3IAwFtqBDNh2PkqRT+qCjXs1CInJNEScj3Sc33TrM/7u5V3tOwHWpG0Ory3/ecaabJE7BCWCYBgvNjZySr476H3nl6dybtrkDxvjQZIdN14skCnJo6CoqBT7xAhn9i03OgWTcPbI9ggp0po7PnK9zXnn7el1/sPB1OqRHgzEWEhElyAXfPg8Vvp4cIspM05U92b0kieeragFaKz7Qfs4O8xAamfMY+tUQZYViB73MrAlf3GcewIIzl4QnVLtEYUR9fNF18FozHfENwhfL7gemkvPs2TxFSWq/8hxvbM1g== X-MS-Exchange-AntiSpam-MessageData: PUZRS339BHSBHkegCTDvsgna6VW89Zh93qsw9ZXjsOWZ7N8k3Hy3hWPGyBLnPZ/dB4oNM8q3gO96u8C2vysRX3nu7s++TLwSaDMjWXFOnktFcX89BpM6+ZohGEHeyneSqBv4M+a8XVS5ADYD8TSzL2wNCEp1gs+Kgv4GaUrfUPYWF5CmAF8WNWdkSLmK2MuIQBwbceIKp2maylb4lvQY7A== X-OriginatorOrg: hotmail.com X-MS-Exchange-CrossTenant-Network-Message-Id: e0ab0aca-e0f8-47ac-968f-08d8e654856b X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Mar 2021 19:16:36.8623 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: DM6NAM10FT004.eop-nam10.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6NAM10HT160 Received-SPF: pass client-ip=40.92.41.60; envelope-from=gabriel376@hotmail.com; helo=NAM10-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:202289 Archived-At: --=-=-= Content-Type: text/plain >> ;;;###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: Hi Stefan, good catch! Thank you for the suggestion. Here is an updated patch. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Init-archive-and-add-noconfirm-to-package-install-se.patch >From 61f6bcdc3534c0d3a47d7f5e04e1f7c952539b6b Mon Sep 17 00:00:00 2001 From: Gabriel do Nascimento Ribeiro Date: Sat, 13 Mar 2021 16:12:47 -0300 Subject: [PATCH] Init archive and add noconfirm to 'package-install-selected-packages' * lisp/emacs-lisp/package.el (package-install-selected-packages): Add call to 'package--archives-initialize' and add optional argument NOCONFIRM to skip user confirmation when installing packages. --- lisp/emacs-lisp/package.el | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 0973963af2..2ecd92cee9 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2206,10 +2206,13 @@ package-install-file (package-install-from-buffer))) ;;;###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) + (package--archives-initialize) ;; We don't need to populate `package-selected-packages' before ;; using here, because the outcome is the same either way (nothing ;; gets installed). @@ -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'" -- 2.27.0 --=-=-=--