Subject: bug#72019: closed (Re: bug#72019: [PATCH] Add project argument to project-kill-buffers)

From: [email-masked] (GNU bug Tracking System)
Date: Tue, 16 Jul 2024 02:02:02 +0000

Your bug report

#72019: [PATCH] Add project argument to project-kill-buffers

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
72019: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=72019
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#72019: [PATCH] Add project argument to project-kill-buffers
From: Dmitry Gutov <[email-masked]>
To: Eli Zaretskii <[email-masked]>
Cc: [email-masked], [email-masked]
Date: Tue, 16 Jul 2024 05:00:50 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

On 12/07/2024 08:48, Eli Zaretskii wrote:
>> Date: Thu, 11 Jul 2024 22:47:57 +0300
>> Cc:[email-masked],[email-masked]
>> From: Dmitry Gutov<[email-masked]>
>>
>> Let me know if it's okay for emacs-30, or we should postpone it to master.
> I prefer master.

Thank you, now pushed to master, and closing.

Let's see if any problems come up with this solution.

Subject: [PATCH] Add project argument to project-kill-buffers
From: Spencer Baugh <[email-masked]>
To: [email-masked]
Date: Tue, 09 Jul 2024 14:31:11 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

Tags: patch

Previously, project-kill-buffers always called (project-current t).  A
Lisp program could change what project project-kill-buffers operated
on by binding project-current-directory-override.  However, in some
edge cases (for example, if the project was deleted between looking it
up and calling project-kill-buffers) this might fail to detect a
project, and so (project-current t) would prompt the user.

To avoid this, accept the project to kill buffers for as an argument.

* lisp/progmodes/project.el (project-kill-buffers): Take project as an
optional argument.

In GNU Emacs 29.2.50 (build 2, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.15.12, Xaw scroll bars) of 2024-06-01 built on
 igm-qws-u22796a
Repository revision: fcef787a846f0c51f7443dfab6af6e18b476b166
Repository branch: emacs-29
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Rocky Linux 8.10 (Green Obsidian)

Configured using:
 'configure --with-x-toolkit=lucid --without-gpm --without-gconf
 --without-selinux --without-imagemagick --with-modules --with-gif=no
 --with-cairo --with-rsvg --without-compress-install
 --with-native-compilation=aot --with-tree-sitter
 PKG_CONFIG_PATH=/usr/local/home/garnish/libtree-sitter/0.22.6-1/lib/pkgconfig/'

>From 5fdd9735148a5b009c0a2a4339c88bf8ab177f37 Mon Sep 17 00:00:00 2001
From: Spencer Baugh <[email-masked]>
Date: Tue, 9 Jul 2024 14:30:27 -0400
Subject: [PATCH] Add project argument to project-kill-buffers

Previously, project-kill-buffers always called (project-current t).  A
Lisp program could change what project project-kill-buffers operated
on by binding project-current-directory-override.  However, in some
edge cases (for example, if the project was deleted between looking it
up and calling project-kill-buffers) this might fail to detect a
project, and so (project-current t) would prompt the user.

To avoid this, accept the project to kill buffers for as an argument.

* lisp/progmodes/project.el (project-kill-buffers): Take project as an
optional argument.
---
 lisp/progmodes/project.el | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index b7c1698f50b..3d0f742c51d 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -1715,7 +1715,7 @@ project--buffers-to-kill
     bufs))
 
 ;;;###autoload
-(defun project-kill-buffers (&optional no-confirm)
+(defun project-kill-buffers (&optional no-confirm project)
   "Kill the buffers belonging to the current project.
 Two buffers belong to the same project if their project
 instances, as reported by `project-current' in each buffer, are
@@ -1725,9 +1725,11 @@ project-kill-buffers
 NO-CONFIRM is always nil when the command is invoked
 interactively.
 
+If PROJECT is non-nil, kill buffers for that project instead.
+
 Also see the `project-kill-buffers-display-buffer-list' variable."
   (interactive)
-  (let* ((pr (project-current t))
+  (let* ((pr (or project (project-current t)))
          (bufs (project--buffers-to-kill pr))
          (query-user (lambda ()
                        (yes-or-no-p
-- 
2.39.3