GNU bug report logs - #47124
28.0.50; [PATCH] Init archive and add noconfirm to 'package-install-selected-packages'

Previous Next

Package: emacs;

Reported by: Gabriel <gabriel376 <at> hotmail.com>

Date: Sat, 13 Mar 2021 17:16:02 UTC

Severity: normal

Tags: fixed, patch

Found in version 28.0.50

Fixed in version 28.1

Done: Stefan Kangas <stefan <at> marxist.se>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 47124 in the body.
You can then email your comments to 47124 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#47124; Package emacs. (Sat, 13 Mar 2021 17:16:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Gabriel <gabriel376 <at> hotmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 13 Mar 2021 17:16:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Gabriel <gabriel376 <at> hotmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.0.50; [PATCH] Init archive and add noconfirm to
 'package-install-selected-packages'
Date: Sat, 13 Mar 2021 14:15:07 -0300
[Message part 1 (text/plain, inline)]
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.

Thread on emacs-devel:
https://lists.gnu.org/archive/html/emacs-devel/2021-03/msg00662.html

[0001-Init-archive-and-add-noconfirm-to-package-install-se.patch (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47124; Package emacs. (Sat, 13 Mar 2021 19:02:02 GMT) Full text and rfc822 format available.

Message #8 received at 47124 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Gabriel <gabriel376 <at> hotmail.com>
Cc: 47124 <at> debbugs.gnu.org
Subject: Re: 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
Gabriel <gabriel376 <at> hotmail.com> 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'"




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47124; Package emacs. (Sat, 13 Mar 2021 19:17:01 GMT) Full text and rfc822 format available.

Message #11 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Gabriel <gabriel376 <at> hotmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: 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 part 1 (text/plain, inline)]
>>  ;;;###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.

[0001-Init-archive-and-add-noconfirm-to-package-install-se.patch (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47124; Package emacs. (Mon, 15 Mar 2021 02:30:02 GMT) Full text and rfc822 format available.

Message #14 received at 47124 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Gabriel <gabriel376 <at> hotmail.com>
Cc: 47124 <at> debbugs.gnu.org
Subject: Re: bug#47124: 28.0.50; [PATCH] Init archive and add noconfirm to
 'package-install-selected-packages'
Date: Sun, 14 Mar 2021 19:29:20 -0700
tags 47124 fixed
close 47124 28.1
thanks

Gabriel <gabriel376 <at> hotmail.com> writes:

> Hi Stefan, good catch! Thank you for the suggestion. Here is an updated
> patch.

Thanks!  Pushed to master as commit 2d12df3926.




Added tag(s) fixed. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Mon, 15 Mar 2021 02:30:03 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 47124 <at> debbugs.gnu.org and Gabriel <gabriel376 <at> hotmail.com> Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Mon, 15 Mar 2021 02:30:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 12 Apr 2021 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 132 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.