From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Sean Devlin Newsgroups: gmane.emacs.bugs Subject: bug#73932: [PATCH] Add noconfirm to 'package-autoremove' Date: Mon, 28 Oct 2024 10:48:47 -0400 Message-ID: <3EBD1382-E6F4-43BA-8CAA-39EAD42CC4CD@toadstyle.org> References: <2AA4E1A2-0422-40F5-BFD6-CDAE69996F1F@toadstyle.org> <864j55h0rl.fsf@gnu.org> <487C14D0-1114-49BC-996E-E3C74D17950F@toadstyle.org> <87iktfe2wr.fsf@posteo.net> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3818.100.11.1.3\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_DE139A3B-0383-4090-9159-9117FB6DBCE9" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15105"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , 73932@debbugs.gnu.org To: Stefan Kangas , Philip Kaludercic Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Oct 28 15:50:46 2024 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 1t5R4v-0003k3-RO for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 28 Oct 2024 15:50:45 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t5R4j-0001sV-Ie; Mon, 28 Oct 2024 10:50:33 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t5R4g-0001rW-H2 for bug-gnu-emacs@gnu.org; Mon, 28 Oct 2024 10:50:31 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t5R4c-0005zW-Hx for bug-gnu-emacs@gnu.org; Mon, 28 Oct 2024 10:50:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:In-Reply-To:Date:Mime-Version:From:To:Subject; bh=8FwgYM1E6nJZPz1vxmSHA6u623L8VERM7koQVn8W/cY=; b=XZPlDG8sMT6hFSMqQMV6SWV7QAA1PJQxM3F/muiOfkcXdtzGzJOEp3W8R5BWE3Op2Ze9TSe9gk8kWrjuDVSj3+Y3xOz5eZ5xDEptyRkSNdCx5lwJd9XTOCR4TjXHcYysvKxqNm5x6WjgKXlDOn1UfoXTpfFccxKSpQkN4yWdUNXIYzQbofBnRLSVOmbN226br1NMIRVWdZ3b4kP8gK1pYNrnBFP8PWtjGR5F3MQAzGqyTdCiaOgkHqM/xA8PsOshwA8aVBDJ6M00+JXvRHcjAzrg2Swu3M9sRQo//D20i2nbKcZ+DcB/wFRPL7jG3QPMZcKXwEEpODbgpyH1wMKQgg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t5R5C-0004IY-Gu for bug-gnu-emacs@gnu.org; Mon, 28 Oct 2024 10:51:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Sean Devlin Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 28 Oct 2024 14:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73932 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 73932-submit@debbugs.gnu.org id=B73932.173012704516139 (code B ref 73932); Mon, 28 Oct 2024 14:51:02 +0000 Original-Received: (at 73932) by debbugs.gnu.org; 28 Oct 2024 14:50:45 +0000 Original-Received: from localhost ([127.0.0.1]:54334 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t5R4v-0004CF-1n for submit@debbugs.gnu.org; Mon, 28 Oct 2024 10:50:45 -0400 Original-Received: from mail-qk1-f169.google.com ([209.85.222.169]:48365) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t5R4s-0004Bw-6k for 73932@debbugs.gnu.org; Mon, 28 Oct 2024 10:50:43 -0400 Original-Received: by mail-qk1-f169.google.com with SMTP id af79cd13be357-7b13fe8f4d0so332810185a.0 for <73932@debbugs.gnu.org>; Mon, 28 Oct 2024 07:50:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toadstyle-org.20230601.gappssmtp.com; s=20230601; t=1730126939; x=1730731739; darn=debbugs.gnu.org; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=8FwgYM1E6nJZPz1vxmSHA6u623L8VERM7koQVn8W/cY=; b=HKZbbZBlcy0QShSN2dFfrJhyHZ3b7LCLNxHvJ1+YRVFXvbJcsfpKXdts+ka7Xkaf19 35QdW2s/MJkkDt6dZBVilqLyZca21q0gCi9iMVsq7uNh9ay3AzhJ6Jb5qELMdUmxyRF9 WMz+uq9caaYlGOp4N4GkapZLklqulc5EHj3C6AUu0hwYevIJyQCRe4FOkcBL7A9P1uFj JAL9/KeqKAj+FEKmGNGb0jnYzO7di74zO5EPQV6iMw+l/C5HbYRpEdWt2KcJ2vxKnj0Q 5z+RjqkyYQVUtROsNnkP9tyW2OddikczWd3oTkmouee5trGZyOw7EnIVLOF6HcU6x5lg 3RgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730126939; x=1730731739; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=8FwgYM1E6nJZPz1vxmSHA6u623L8VERM7koQVn8W/cY=; b=V/HlUVbps8ZdaR41Svrq85bMODZHXVW3kcOljhL6vSNNKlwYErbcCOj2b+58S93W73 VUgX7pIWoa8BwfGWVAirDnsnFeGguKMBUENAM0EJ2wBOYy2YReDpRiMF5CObjq7+YWt+ DmxuZkdXb+l2/pLRhnQmUN79miNvdD1tLHKJpEmN150UVcKL7wg6xQ3ahv0SIx2Mir/R V8eQG8fKFhDUvK5JFKFzuKpe82/Gg7fshR3awnwCACPcqRwV26GyTK+H/SpK64ZcnWZK VfSKjJbwW2yZzESGCbDJvano1jPlRjCcqWnoY47kj7X/hainInEofGeKH3Cw+0TfGmIS iuug== X-Forwarded-Encrypted: i=1; AJvYcCXY5M5tDlykKG6wxZJqUx0WVKSp12botWF0J9aJ78fDxr/pmRXu3dVbo/e4B8UISnoDnKGc4g==@debbugs.gnu.org X-Gm-Message-State: AOJu0YzxkGtB71vTKLYGQQ4GyCPihBngRLq8pTAoqITEqmJlgXZXeWXa qo+NMMKZSzO6FU35Uq9HUT26UVW13wPyn1CW8ZEtXOi7gFe+oJSPRHUOjVkS8K0= X-Google-Smtp-Source: AGHT+IHvWs9H6JSg8DuCXMtD8zcdb1Cat3cMJf2/bGO3AegLr/qDQmXAAeXNS6hVuSHjZyJZEymAuA== X-Received: by 2002:a05:620a:29d3:b0:7a9:a1b5:26f5 with SMTP id af79cd13be357-7b193eee1a1mr1657716785a.26.1730126938252; Mon, 28 Oct 2024 07:48:58 -0700 (PDT) Original-Received: from smtpclient.apple ([70.107.172.48]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7b18d32b9adsm322046185a.84.2024.10.28.07.48.57 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Oct 2024 07:48:57 -0700 (PDT) In-Reply-To: X-Mailer: Apple Mail (2.3818.100.11.1.3) 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:294429 Archived-At: --Apple-Mail=_DE139A3B-0383-4090-9159-9117FB6DBCE9 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hi folks, > On Oct 27, 2024, at 5:53=E2=80=AFAM, Stefan Kangas = wrote: >=20 > Philip Kaludercic writes: >=20 >> Is the variation interesting, where NOCONFIRM is a predicate so that >> we can selectively remove packages? >=20 > Do you have a use case in mind? >=20 >>> Sure, that might make sense. If we do that, should we do the same in = package-install-selected-packages? It uses its NOCONFIRM argument in a = similar way. >>=20 >> We can do that in a subsequent patch. >=20 > Feel free to post such a patch, indeed. Thanks in advance. Here=E2=80=99s two patches: --Apple-Mail=_DE139A3B-0383-4090-9159-9117FB6DBCE9 Content-Disposition: attachment; filename=0001-Add-noconfirm-to-package-autoremove.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-Add-noconfirm-to-package-autoremove.patch" Content-Transfer-Encoding: quoted-printable =46rom=205ad7a54aae80704fe2827b8e2b924b30adabcf2c=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Sean=20Devlin=20=0ADate:=20= Mon,=2021=20Oct=202024=2011:28:06=20-0400=0ASubject:=20[PATCH=201/2]=20= Add=20noconfirm=20to=20'package-autoremove'=0A=0A*=20= lisp/emacs-lisp/package.el=20(package-autoremove):=0AAdd=20optional=20= argument=20NOCONFIRM=20to=20skip=20user=20confirmation=20when=20removing=0A= packages.=0A*=20etc/NEWS:=20Announce=20the=20new=20argument.=0A---=0A=20= etc/NEWS=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20|=20=20= 9=20+++++++++=0A=20lisp/emacs-lisp/package.el=20|=2021=20= +++++++++++++--------=0A=202=20files=20changed,=2022=20insertions(+),=20= 8=20deletions(-)=0A=0Adiff=20--git=20a/etc/NEWS=20b/etc/NEWS=0Aindex=20= cfc5a8e1785..aad81d56ed4=20100644=0A---=20a/etc/NEWS=0A+++=20b/etc/NEWS=0A= @@=20-587,6=20+587,15=20@@=20When=20non-nil,=20MPC=20will=20crossfade=20= between=20songs=20for=20the=20specified=20number=0A=20of=20seconds.=20=20= Crossfading=20can=20be=20toggled=20using=20the=20command=0A=20= 'mpc-toggle-crossfade'=20or=20from=20the=20MPC=20menu.=0A=20=0A+**=20= Package=0A+=0A+---=0A+***=20New=20optional=20argument=20to=20= 'package-autoremove'.=0A+An=20optional=20argument=20NOCONFIRM=20has=20= been=20added=20to=20'package-autoremove'.=0A+If=20it=20is=20non-nil,=20= or=20when=20invoked=20with=20a=20prefix=20argument,=0A= +'package-autoremove'=20will=20not=20prompt=20the=20user=20for=20= confirmation=20before=0A+removing=20packages.=0A+=0A=20=0C=0A=20*=20New=20= Modes=20and=20Packages=20in=20Emacs=2031.1=0A=20=0Adiff=20--git=20= a/lisp/emacs-lisp/package.el=20b/lisp/emacs-lisp/package.el=0Aindex=20= 90d6150ed0b..b3e561f762e=20100644=0A---=20a/lisp/emacs-lisp/package.el=0A= +++=20b/lisp/emacs-lisp/package.el=0A@@=20-2616,26=20+2616,31=20@@=20are=20= invalid=20due=20to=20changed=20byte-code,=20macros=20or=20the=20like."=0A= =20=20=20=20=20=20=20(package-recompile=20pkg-desc))))=0A=20=0A=20= ;;;###autoload=0A-(defun=20package-autoremove=20()=0A+(defun=20= package-autoremove=20(&optional=20noconfirm)=0A=20=20=20"Remove=20= packages=20that=20are=20no=20longer=20needed.=0A=20=0A=20Packages=20that=20= are=20no=20more=20needed=20by=20other=20packages=20in=0A=20= `package-selected-packages'=20and=20their=20dependencies=0A-will=20be=20= deleted."=0A-=20=20(interactive)=0A+will=20be=20deleted.=0A+=0A+If=20= optional=20argument=20NOCONFIRM=20is=20non-nil,=20or=20when=20invoked=20= with=20a=20prefix=0A+argument,=20don't=20ask=20for=20confirmation=20to=20= install=20packages."=0A+=20=20(interactive=20"P")=0A=20=20=20;;=20If=20= `package-selected-packages'=20is=20nil,=20it=20would=20make=20no=20sense=20= to=0A=20=20=20;;=20try=20to=20populate=20it=20here,=20because=20then=20= `package-autoremove'=20will=0A=20=20=20;;=20do=20absolutely=20nothing.=0A= -=20=20(when=20(or=20package-selected-packages=0A+=20=20(when=20(or=20= noconfirm=0A+=20=20=20=20=20=20=20=20=20=20=20=20= package-selected-packages=0A=20=20=20=20=20=20=20=20=20=20=20=20=20= (yes-or-no-p=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20(format-message=0A= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= "`package-selected-packages'=20is=20empty!=20Really=20remove=20ALL=20= packages?=20")))=0A=20=20=20=20=20(let=20((removable=20= (package--removable-packages)))=0A=20=20=20=20=20=20=20(if=20removable=0A= -=20=20=20=20=20=20=20=20=20=20(when=20(y-or-n-p=0A-=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20(format=20"Packages=20to=20delete:=20%d=20= (%s),=20proceed?=20"=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20(length=20removable)=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20(mapconcat=20#'symbol-name=20removable=20"=20")))=0A+=20=20=20= =20=20=20=20=20=20=20(when=20(or=20noconfirm=0A+=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20(y-or-n-p=0A+=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20(format=20"Packages=20to=20delete:=20= %d=20(%s),=20proceed?=20"=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20(length=20removable)=0A+=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20(mapconcat=20#'symbol-name=20removable=20"=20"))))=0A=20=20=20=20=20=20= =20=20=20=20=20=20=20(mapc=20(lambda=20(p)=0A=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20(package-delete=20(cadr=20(assq=20p=20= package-alist))=20t))=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20removable))=0A--=20=0A2.39.5=20(Apple=20Git-154)=0A=0A= --Apple-Mail=_DE139A3B-0383-4090-9159-9117FB6DBCE9 Content-Disposition: attachment; filename=0002-Use-prefix-argument-in-package-install-selected-pack.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0002-Use-prefix-argument-in-package-install-selected-pack.patch" Content-Transfer-Encoding: quoted-printable =46rom=208fcc764ab0ae260f751f25013f400a4368b05d07=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Sean=20Devlin=20=0ADate:=20= Mon,=2028=20Oct=202024=2010:34:48=20-0400=0ASubject:=20[PATCH=202/2]=20= Use=20prefix=20argument=20in=0A=20'package-install-selected-packages'=0A=0A= *=20lisp/emacs-lisp/package.el=20(package-install-selected-packages):=0A= When=20invoked=20with=20a=20prefix=20argument,=20skip=20user=20= confirmation=20when=0Ainstalling=20packages.=0A*=20etc/NEWS:=20Announce=20= the=20prefix=20argument=20usage.=0A---=0A=20etc/NEWS=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20|=205=20+++++=0A=20= lisp/emacs-lisp/package.el=20|=207=20++++---=0A=202=20files=20changed,=20= 9=20insertions(+),=203=20deletions(-)=0A=0Adiff=20--git=20a/etc/NEWS=20= b/etc/NEWS=0Aindex=20aad81d56ed4..32f0233ce09=20100644=0A---=20= a/etc/NEWS=0A+++=20b/etc/NEWS=0A@@=20-596,6=20+596,11=20@@=20If=20it=20= is=20non-nil,=20or=20when=20invoked=20with=20a=20prefix=20argument,=0A=20= 'package-autoremove'=20will=20not=20prompt=20the=20user=20for=20= confirmation=20before=0A=20removing=20packages.=0A=20=0A+---=0A+***=20= New=20prefix=20argument=20for=20'package-install-selected-packages'.=0A= +When=20invoked=20with=20a=20prefix=20argument,=20= 'package-install-selected-packages'=0A+will=20not=20prompt=20the=20user=20= for=20confirmation=20before=20installing=20packages.=0A+=0A=20=0C=0A=20*=20= New=20Modes=20and=20Packages=20in=20Emacs=2031.1=0A=20=0Adiff=20--git=20= a/lisp/emacs-lisp/package.el=20b/lisp/emacs-lisp/package.el=0Aindex=20= b3e561f762e..16e53871780=20100644=0A---=20a/lisp/emacs-lisp/package.el=0A= +++=20b/lisp/emacs-lisp/package.el=0A@@=20-2438,9=20+2438,10=20@@=20= directory."=0A=20(defun=20package-install-selected-packages=20(&optional=20= noconfirm)=0A=20=20=20"Ensure=20packages=20in=20= `package-selected-packages'=20are=20installed.=0A=20If=20some=20packages=20= are=20not=20installed,=20propose=20to=20install=20them.=0A-If=20optional=20= argument=20NOCONFIRM=20is=20non-nil,=20don't=20ask=20for=0A-confirmation=20= to=20install=20packages."=0A-=20=20(interactive)=0A+=0A+If=20optional=20= argument=20NOCONFIRM=20is=20non-nil,=20or=20when=20invoked=20with=20a=20= prefix=0A+argument,=20don't=20ask=20for=20confirmation=20to=20install=20= packages."=0A+=20=20(interactive=20"P")=0A=20=20=20= (package--archives-initialize)=0A=20=20=20;;=20We=20don't=20need=20to=20= populate=20`package-selected-packages'=20before=0A=20=20=20;;=20using=20= here,=20because=20the=20outcome=20is=20the=20same=20either=20way=20= (nothing=0A--=20=0A2.39.5=20(Apple=20Git-154)=0A=0A= --Apple-Mail=_DE139A3B-0383-4090-9159-9117FB6DBCE9 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 The first is the same as before, but it adds the prefix argument usage = Eli suggested. The second patch adds a matching prefix argument to = package-install-selected-packages (if this is desired). I didn=E2=80=99t implement a predicate option for NOCONFIRM yet, since I = couldn=E2=80=99t think of a use case, and the intended semantics are not = quite clear to me. Please let me know what else is needed, and thanks!= --Apple-Mail=_DE139A3B-0383-4090-9159-9117FB6DBCE9--