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, 21 Oct 2024 14:04:14 -0400 Message-ID: <487C14D0-1114-49BC-996E-E3C74D17950F@toadstyle.org> References: <2AA4E1A2-0422-40F5-BFD6-CDAE69996F1F@toadstyle.org> <864j55h0rl.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3818.100.11.1.3\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_BFA54B58-93F8-48CF-9988-5CE4AE5EF3D3" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14495"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 73932@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Oct 21 20:06:08 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 1t2wn9-0003Xm-OM for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 21 Oct 2024 20:06:08 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t2wmi-0002Zm-JX; Mon, 21 Oct 2024 14:05:40 -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 1t2wme-0002ZE-Pc for bug-gnu-emacs@gnu.org; Mon, 21 Oct 2024 14:05:37 -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 1t2wme-00089T-HA for bug-gnu-emacs@gnu.org; Mon, 21 Oct 2024 14:05:36 -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=yypt6IfyMjAtbkcMEh3WS21qIdL4lQUyvhyeIKIAn0o=; b=t2vVuHndIABW23J3zOys1cj2ro5/6l+h9n9ozBX4lZ+vM2RRCkpYISqqkGLN/xVhjiN3VnfL3Zwwhu1NQyKBDYRjXekiikmbjwNpEsy1cxurUcF14hN3V79CLwLzSSX4KE+p2Sjvk4jWaed/PQn1Vy6g2bLSJ/2XkF/+IVKEOt4d1ZEs99kjZmhVtQZoncwviQsronB5bpzjlK7voU/xEgwOsOKv0aX5IfZ+neenEaRzJywjQUQlNqQ7aZp5B4CIWDdazMZe4Y700llVSDOA+NWtYYs9dzxnxOpA41ZBjn6eAfnSzl3WGZ3zA3MClpEYEBWMAPsayQBwRPZWJPDnzQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t2wn4-0006Ms-8n for bug-gnu-emacs@gnu.org; Mon, 21 Oct 2024 14:06: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, 21 Oct 2024 18:06: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.172953396124464 (code B ref 73932); Mon, 21 Oct 2024 18:06:02 +0000 Original-Received: (at 73932) by debbugs.gnu.org; 21 Oct 2024 18:06:01 +0000 Original-Received: from localhost ([127.0.0.1]:53275 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t2wn2-0006MW-Jn for submit@debbugs.gnu.org; Mon, 21 Oct 2024 14:06:00 -0400 Original-Received: from mail-qv1-f45.google.com ([209.85.219.45]:54654) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t2wmx-0006M7-EA for 73932@debbugs.gnu.org; Mon, 21 Oct 2024 14:05:58 -0400 Original-Received: by mail-qv1-f45.google.com with SMTP id 6a1803df08f44-6cbce8d830dso31114806d6.1 for <73932@debbugs.gnu.org>; Mon, 21 Oct 2024 11:05:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toadstyle-org.20230601.gappssmtp.com; s=20230601; t=1729533866; x=1730138666; 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=yypt6IfyMjAtbkcMEh3WS21qIdL4lQUyvhyeIKIAn0o=; b=eCDdeaC3ApaVmmS7uMIsUjz5elWBKTxHjimxglZLK82RQgnKgBJY+ARCcILGNjoQ9R TnPjZnstEcU1DsfBoBFsM6bGwfNxGrQFbCnNF+B0Pqs6edOeUVcA1WVgtoSmLVc/nHIg nNN0ZcFDpZaQ3JunnTGNkQUVfsEGsKJicedC7W81gtfsOEnNtUz0kEpCxMcczD6cTDq7 wKU8gkPBeWIoyaxbAugtaw6LvhK1iaqhg+ZPl+kO32Y1DnVKH7p23rD4qJJLLsB2eQNj tdoYdJE1vfo6VOupBH31BwOOr5emYsmvRCyN7qXmVtM7HkEdpfRoLEWA/WuCKL0ZSvTN 89LA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729533866; x=1730138666; 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=yypt6IfyMjAtbkcMEh3WS21qIdL4lQUyvhyeIKIAn0o=; b=R9Wq2wA5pqAvZ/bkwClkW/PjPH3RkKfbRQL1ovf++gsik3nLGxBVxbxkzTF7NS6dpt Qftgbqy1dzidnMlzgtmOmx91mIYMQ7RmeW65Ocu6wdzlu3B7NtRKujj+leGukdz5HTIO 6SjedHSfPYrC9xFhaPchQV6Yp6Za/Ub9SWMqz9H6ewAFFXh4yzPHIHRsfWYF7f1j4mSc 3Zygf1VXA+p/NSUX5Lajl0S2dRjJvpSSf4FJ17FOHj6PApUoc/eOf5WvPMx1157RQRrG 5DHZRVwXnxwFyLfoUcPmbmg4xdtyKUDSNGOeIHRlLTObzAclzjTHsFQPGLOnl9QUvPev V1lg== X-Gm-Message-State: AOJu0YyvRxfAe9VFbBhTv6wxc8mqpoQNtT5AkPKRJI5tDjrTJfC3Zibl as3/Yk5Sjp2W/ULDz1e5e9DMF+/ymrj+O01+BZzzbdbVEeDxbREzObbb8dlp++4= X-Google-Smtp-Source: AGHT+IEVsNaeIsklPpwfAAfxXvH9/wC2pVUbtZdtB6oclKHIURwdAclyzLpVd8ssjaYO9ezHmMEtjw== X-Received: by 2002:a05:6214:5543:b0:6cb:eb51:a26a with SMTP id 6a1803df08f44-6cde162fa4emr224554676d6.47.1729533865552; Mon, 21 Oct 2024 11:04:25 -0700 (PDT) Original-Received: from smtpclient.apple ([70.107.172.48]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6ce009e27afsm19879006d6.120.2024.10.21.11.04.24 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Oct 2024 11:04:25 -0700 (PDT) In-Reply-To: <864j55h0rl.fsf@gnu.org> 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:294078 Archived-At: --Apple-Mail=_BFA54B58-93F8-48CF-9988-5CE4AE5EF3D3 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hello, > On Oct 21, 2024, at 12:35=E2=80=AFPM, Eli Zaretskii = wrote: >=20 >> From: Sean Devlin >> Date: Mon, 21 Oct 2024 11:58:34 -0400 >>=20 >> Attached is a patch adding an optional NOCONFIRM argument to = package-autoremove to skip user confirmation before removing packages. >>=20 >> I want to call package-autoremove in my init file to ensure there are = no packages installed except those I configured explicitly via = package-selected-packages. >>=20 >> For example, in one session I might install package XYZ interactively = via the package menu to try it out. If I decide I like it, I=E2=80=99ll = add it to package-selected-packages in my init file to keep it around. = Otherwise, I want to make sure it gets blown away the next time I start = Emacs. >>=20 >> This workflow is cumbersome in the current implementation of = package-autoremove, which prompts the user before removing any packages. = This patch adds an optional NOCONFIRM argument similar to what is = implemented in package-install-selected-packages. >>=20 >> Please let me know if any changes are needed. >=20 > Thanks. I'll let our package.el experts review and comment, but if > this is accepted, please add a NEWS entry for the new optional > behavior. Sounds good. Here is a patch with an attempt at a NEWS entry: --Apple-Mail=_BFA54B58-93F8-48CF-9988-5CE4AE5EF3D3 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=20a7574170716feb153016685a99f2537a27979627=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]=20Add=20= noconfirm=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= 8=20++++++++=0A=20lisp/emacs-lisp/package.el=20|=2019=20= ++++++++++++-------=0A=202=20files=20changed,=2020=20insertions(+),=207=20= deletions(-)=0A=0Adiff=20--git=20a/etc/NEWS=20b/etc/NEWS=0Aindex=20= cfc5a8e1785..a709a9ee6db=20100644=0A---=20a/etc/NEWS=0A+++=20b/etc/NEWS=0A= @@=20-587,6=20+587,14=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= 'package-autoremove'=20will=20not=20prompt=20the=20user=20for=0A= +confirmation=20before=20removing=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..6c23dcd68ff=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+will=20be=20deleted.=0A+=0A+If=20optional=20argument=20= NOCONFIRM=20is=20non-nil,=20don't=20ask=20for=0A+confirmation=20to=20= install=20packages."=0A=20=20=20(interactive)=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=_BFA54B58-93F8-48CF-9988-5CE4AE5EF3D3 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Please let me know if any changes are needed. >=20 > Also, would it make sense to turn NOCONFIRM on if the command is > invoked with a prefix argument? 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.= --Apple-Mail=_BFA54B58-93F8-48CF-9988-5CE4AE5EF3D3--