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 11:58:34 -0400 Message-ID: <2AA4E1A2-0422-40F5-BFD6-CDAE69996F1F@toadstyle.org> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_6D02C3F3-6A2C-4158-9FC8-672D9C7561B8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39942"; mail-complaints-to="usenet@ciao.gmane.io" To: 73932@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Oct 21 17:59:54 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 1t2up0-000ADS-FM for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 21 Oct 2024 17:59:54 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t2uoo-0007kt-4Y; Mon, 21 Oct 2024 11:59:42 -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 1t2uoj-0007kK-De for bug-gnu-emacs@gnu.org; Mon, 21 Oct 2024 11:59: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 1t2uoj-0001Nq-52 for bug-gnu-emacs@gnu.org; Mon, 21 Oct 2024 11:59:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=Date:Mime-Version:From:To:Subject; bh=8vImCeRPtTtvk3zSb2IofeZlkM7nZ1P+eiGBdnUZSzk=; b=fTzSRAYEJXp+E40d9XN+WV14JlsW4+AfPW7bF4Q3g6fQUoBR87TnWnnons9wZ5JgbW97o4ZNvGd4nObRMojZvIktRQaOOgXvy7e+X0YogyxjoexuPJPAwbzdqe9gsvtnMao0oWSLMKn3/XZq681T8kUT3VrDVIkniF1YWr+vSqTND0jJNyXWFE0CpSC3jlkkdh3uo1W9m8ps3CBQyeNtacaMNpnXAYT3sCOPuCQ+g8ugqeAvZUlEgmYxqfCGMQXpiou7EgcSFkcEooRf4jgT1XNkH552fCCOBObrwMCZgh0GbSGCnnkqxqa0Ft5YhWgNffNxKFd/qawnOYXbJ98odg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t2up9-0000PW-Fi for bug-gnu-emacs@gnu.org; Mon, 21 Oct 2024 12:00:03 -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 16:00:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 73932 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.17295263641494 (code B ref -1); Mon, 21 Oct 2024 16:00:03 +0000 Original-Received: (at submit) by debbugs.gnu.org; 21 Oct 2024 15:59:24 +0000 Original-Received: from localhost ([127.0.0.1]:53019 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t2uoV-0000O1-Lx for submit@debbugs.gnu.org; Mon, 21 Oct 2024 11:59:23 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:55906) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t2uoO-0000Nn-EO for submit@debbugs.gnu.org; Mon, 21 Oct 2024 11:59:21 -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 1t2unx-0007gU-32 for bug-gnu-emacs@gnu.org; Mon, 21 Oct 2024 11:58:49 -0400 Original-Received: from mail-qk1-x731.google.com ([2607:f8b0:4864:20::731]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t2unv-0001MB-8Q for bug-gnu-emacs@gnu.org; Mon, 21 Oct 2024 11:58:48 -0400 Original-Received: by mail-qk1-x731.google.com with SMTP id af79cd13be357-7b14df8f821so414694985a.2 for ; Mon, 21 Oct 2024 08:58:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toadstyle-org.20230601.gappssmtp.com; s=20230601; t=1729526325; x=1730131125; darn=gnu.org; h=to:date:message-id:subject:mime-version:from:from:to:cc:subject :date:message-id:reply-to; bh=8vImCeRPtTtvk3zSb2IofeZlkM7nZ1P+eiGBdnUZSzk=; b=JY+jSw46x/uU54jC2LY+xDktOTWM6CTvkEeLUOl576L/LZvql0vLv1OKUPltTyn3td /kPkzX69Yo/IL4yw/UyHB40XUc3Ihq64UthoUJpswHfIO0d8UF5Rj8+E+FIjf0DE1dmO LVRC1/QysSLAsmgKSVQoc63ZodqqBV76VLNEVVSiAo9IYOHjXGHmunQMOav5KTTLly42 3C87uMlImdWNnPUw9NdiChPtQE0kh24xZ5xjYYZAnKfOvbOXLwgwWUBSxGh8GeEjlrOo CGQAimVUgJMQvnh5aCH8gwzhKyW1st0Dj+okg0KkG7mUvbD2tY0MttqjJfje6ICOJ384 wyqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729526325; x=1730131125; h=to:date:message-id:subject:mime-version:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=8vImCeRPtTtvk3zSb2IofeZlkM7nZ1P+eiGBdnUZSzk=; b=lYHZTW2J1j1vf5UfB8pWhuw1Mm9viFmskZb8Ol3qq+7BgiK90yZj41YBlWMcdFCKOc c9H6U9I/QQaCe3m+MW+r0dPZP2pIkVpoRZ35ni6S39zk3RbgDxMnWoTzaDD+rchLhIET FJR6ZYieibOSB3rfVk6eaywUtiECcER1LZNHQvFdPIq8t4z3OKx9aJjre0EO0b7fSSlZ Pd734ldkqMej+zp9ONVCr1dgJgnyZcOv0hPtYcPcDhSAj2r5+qB5g8C9KKnN6Eff9JqX TcVnHZnuXkJ1EgyBO0zbpf37Vjj09DWbFrW1u8shzSNxK1ZRszZ3gtPLlsP9mS6h8GuV D9wA== X-Gm-Message-State: AOJu0YxoaJrQIJaT7qv+H6Uipw08B4Sqm+PLQSbMLhpPxBDUi64l21OV FJvr9PC6k1GUkBWLyBLMDI4Y20FtnD5nFElYjkt5cRbohikVNw2w4JqEEEmlHrMCUcu4WGHtDhW p X-Google-Smtp-Source: AGHT+IGZonSAfWOYXWni3LvuwixLOFHiaPMgcf0oYA5udTS/UorDAYmLbls8gKq/zmDY+FRhFI4ydw== X-Received: by 2002:a05:620a:4690:b0:7b1:4536:8dc7 with SMTP id af79cd13be357-7b157bdfb51mr1560858685a.41.1729526325251; Mon, 21 Oct 2024 08:58:45 -0700 (PDT) Original-Received: from smtpclient.apple ([70.107.172.48]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7b1659b9415sm182431285a.3.2024.10.21.08.58.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Oct 2024 08:58:44 -0700 (PDT) X-Mailer: Apple Mail (2.3776.700.51) Received-SPF: pass client-ip=2607:f8b0:4864:20::731; envelope-from=spd@toadstyle.org; helo=mail-qk1-x731.google.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:294073 Archived-At: --Apple-Mail=_6D02C3F3-6A2C-4158-9FC8-672D9C7561B8 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hi folks, Attached is a patch adding an optional NOCONFIRM argument to = package-autoremove to skip user confirmation before removing packages. 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. 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. 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. Please let me know if any changes are needed. Thanks! --Apple-Mail=_6D02C3F3-6A2C-4158-9FC8-672D9C7561B8 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=20952d8facc6be876f6aa71f742491b58287b0e7a2=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---=0A=20lisp/emacs-lisp/package.el=20|=2019=20= ++++++++++++-------=0A=201=20file=20changed,=2012=20insertions(+),=207=20= deletions(-)=0A=0Adiff=20--git=20a/lisp/emacs-lisp/package.el=20= b/lisp/emacs-lisp/package.el=0Aindex=207cae8d68bc0..d2de264743a=20100644=0A= ---=20a/lisp/emacs-lisp/package.el=0A+++=20b/lisp/emacs-lisp/package.el=0A= @@=20-2616,26=20+2616,31=20@@=20are=20invalid=20due=20to=20changed=20= byte-code,=20macros=20or=20the=20like."=0A=20=20=20=20=20=20=20= (package-recompile=20pkg-desc))))=0A=20=0A=20;;;###autoload=0A-(defun=20= package-autoremove=20()=0A+(defun=20package-autoremove=20(&optional=20= noconfirm)=0A=20=20=20"Remove=20packages=20that=20are=20no=20longer=20= needed.=0A=20=0A=20Packages=20that=20are=20no=20more=20needed=20by=20= other=20packages=20in=0A=20`package-selected-packages'=20and=20their=20= dependencies=0A-will=20be=20deleted."=0A+will=20be=20deleted.=0A+=0A+If=20= optional=20argument=20NOCONFIRM=20is=20non-nil,=20don't=20ask=20for=0A= +confirmation=20to=20install=20packages."=0A=20=20=20(interactive)=0A=20=20= =20;;=20If=20`package-selected-packages'=20is=20nil,=20it=20would=20make=20= no=20sense=20to=0A=20=20=20;;=20try=20to=20populate=20it=20here,=20= because=20then=20`package-autoremove'=20will=0A=20=20=20;;=20do=20= absolutely=20nothing.=0A-=20=20(when=20(or=20package-selected-packages=0A= +=20=20(when=20(or=20noconfirm=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=_6D02C3F3-6A2C-4158-9FC8-672D9C7561B8--