unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#72019: [PATCH] Add project argument to project-kill-buffers
@ 2024-07-09 18:31 Spencer Baugh
  2024-07-09 19:59 ` Dmitry Gutov
  2024-07-10 11:19 ` Eli Zaretskii
  0 siblings, 2 replies; 21+ messages in thread
From: Spencer Baugh @ 2024-07-09 18:31 UTC (permalink / raw)
  To: 72019

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

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/'


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-project-argument-to-project-kill-buffers.patch --]
[-- Type: text/patch, Size: 1885 bytes --]

From 5fdd9735148a5b009c0a2a4339c88bf8ab177f37 Mon Sep 17 00:00:00 2001
From: Spencer Baugh <sbaugh@janestreet.com>
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


^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2024-07-16  2:00 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-09 18:31 bug#72019: [PATCH] Add project argument to project-kill-buffers Spencer Baugh
2024-07-09 19:59 ` Dmitry Gutov
2024-07-10 11:43   ` Eli Zaretskii
2024-07-10 11:19 ` Eli Zaretskii
2024-07-10 13:27   ` Spencer Baugh
2024-07-10 14:32     ` Eli Zaretskii
2024-07-10 15:47       ` Spencer Baugh
2024-07-10 17:32         ` Eli Zaretskii
2024-07-10 17:42           ` Spencer Baugh
2024-07-10 17:54             ` Eli Zaretskii
2024-07-10 18:30               ` Spencer Baugh
2024-07-10 19:00                 ` Eli Zaretskii
2024-07-11  0:18                   ` Dmitry Gutov
2024-07-11  4:52                     ` Eli Zaretskii
2024-07-11 19:47                       ` Dmitry Gutov
2024-07-12  5:48                         ` Eli Zaretskii
2024-07-16  2:00                           ` Dmitry Gutov
2024-07-11  0:11       ` Dmitry Gutov
2024-07-11  4:50         ` Eli Zaretskii
2024-07-11 19:44           ` Dmitry Gutov
2024-07-12  5:47             ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).