all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Gabriel <gabriel376@hotmail.com>
To: 47124@debbugs.gnu.org
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	[thread overview]
Message-ID: <CH2PR01MB5879FF58472EED81DA97324A8B6E9@CH2PR01MB5879.prod.exchangelabs.com> (raw)
In-Reply-To: <CADwFkmmEAPkX9XU3-N93GpPY5=x1nL9KC5kw-VLDphuSUx9Tbw@mail.gmail.com> (Stefan Kangas's message of "Sat, 13 Mar 2021 13:01:14 -0600")

[-- Attachment #1: Type: text/plain, Size: 833 bytes --]

>>  ;;;###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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Init-archive-and-add-noconfirm-to-package-install-se.patch --]
[-- Type: text/x-diff, Size: 2306 bytes --]

From 61f6bcdc3534c0d3a47d7f5e04e1f7c952539b6b Mon Sep 17 00:00:00 2001
From: Gabriel do Nascimento Ribeiro <gabriel.nascimento@nubank.com.br>
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


  reply	other threads:[~2021-03-13 19:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-13 17:15 bug#47124: 28.0.50; [PATCH] Init archive and add noconfirm to 'package-install-selected-packages' Gabriel
2021-03-13 19:01 ` Stefan Kangas
2021-03-13 19:16   ` Gabriel [this message]
2021-03-15  2:29     ` Stefan Kangas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CH2PR01MB5879FF58472EED81DA97324A8B6E9@CH2PR01MB5879.prod.exchangelabs.com \
    --to=gabriel376@hotmail.com \
    --cc=47124@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.