[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#58839: [Patch] Re: bug#58839: 29.0.50; project-kill-buffer fails whe
From: |
Dmitry Gutov |
Subject: |
bug#58839: [Patch] Re: bug#58839: 29.0.50; project-kill-buffer fails when Eglot is running |
Date: |
Tue, 1 Nov 2022 17:26:26 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 |
On 01.11.2022 13:27, Philip Kaludercic wrote:
I am biased, but I believe that the language could even find more use in
project.el, by having `project-buffers' just call `match-buffers' with a
special `buffer-match-p' predicate. Here is a sketch of how that could
look like (I haven't tested it yet):
Sure, but only after we're ready to drop project.el support for Emacs
older than 29.
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index ac278edd40..b55c245368 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -352,15 +352,28 @@ project--remote-file-names
(concat remote-id file))
local-files))))
+(defun project-includes-buffer-p (buffer dir)
+ "Return non-nil if the `default-directory' of BUFFER is below DIR."
+ (file-in-directory-p
+ (buffer-local-value 'default-directory buffer)
+ dir))
Not an optimal name, given that we have made project-buffers a generic
function, so that a custom project backend can define their own
buffer-listing strategy. And this one implies that matching by
default-directory is universal.
+(defcustom project-buffer-conditions
Why not keep considering unknown buffers as part of project by default?
We'll just stop killing them on cleanup.
Otherwise, we'll really need an extensible mechanism for major modes all
around the ecosystem to tag themselves as project-visible.
+ '(and (or buffer-file-name
+ (derived-mode . compilation-mode)
+ (derived-mode . dired-mode)
+ (derived-mode . diff-mode)
+ (derived-mode . comint-mode)
+ (derived-mode . eshell-mode)
+ (derived-mode . change-log-mode))
+ project-includes-buffer-p)
+ "A buffer predicate for matching what buffers belong to a project."
+ :type 'buffer-predicate)
Let's not forget Xref, Occur, VC-Dir, Log-View. Maybe some others.
- bug#58839: [Patch] Re: bug#58839: 29.0.50; project-kill-buffer fails when Eglot is running, (continued)
- bug#58839: [Patch] Re: bug#58839: 29.0.50; project-kill-buffer fails when Eglot is running, João Távora, 2022/11/01
- bug#58839: [Patch] Re: bug#58839: 29.0.50; project-kill-buffer fails when Eglot is running, Philip Kaludercic, 2022/11/01
- bug#58839: [Patch] Re: bug#58839: 29.0.50; project-kill-buffer fails when Eglot is running, João Távora, 2022/11/02
- bug#58839: [Patch] Re: bug#58839: 29.0.50; project-kill-buffer fails when Eglot is running, Philip Kaludercic, 2022/11/02
- bug#58839: [Patch] Re: bug#58839: 29.0.50; project-kill-buffer fails when Eglot is running, João Távora, 2022/11/02
- bug#58839: [Patch] Re: bug#58839: 29.0.50; project-kill-buffer fails when Eglot is running, Philip Kaludercic, 2022/11/02
- bug#58839: [Patch] Re: bug#58839: 29.0.50; project-kill-buffer fails when Eglot is running, João Távora, 2022/11/02
- bug#58839: [Patch] Re: bug#58839: 29.0.50; project-kill-buffer fails when Eglot is running, Philip Kaludercic, 2022/11/02
- bug#58839: [Patch] Re: bug#58839: 29.0.50; project-kill-buffer fails when Eglot is running, João Távora, 2022/11/02
- bug#58839: [Patch] Re: bug#58839: 29.0.50; project-kill-buffer fails when Eglot is running, Philip Kaludercic, 2022/11/02
- bug#58839: [Patch] Re: bug#58839: 29.0.50; project-kill-buffer fails when Eglot is running,
Dmitry Gutov <=
- bug#58839: [Patch] Re: bug#58839: 29.0.50; project-kill-buffer fails when Eglot is running, Philip Kaludercic, 2022/11/01
- bug#58839: [Patch] Re: bug#58839: 29.0.50; project-kill-buffer fails when Eglot is running, Dmitry Gutov, 2022/11/01
- bug#58839: [Patch] Re: bug#58839: 29.0.50; project-kill-buffer fails when Eglot is running, Philip Kaludercic, 2022/11/01
- bug#58839: [Patch] Re: bug#58839: 29.0.50; project-kill-buffer fails when Eglot is running, Dmitry Gutov, 2022/11/01
bug#58839: [Patch] Re: bug#58839: 29.0.50; project-kill-buffer fails when Eglot is running, Philip Kaludercic, 2022/11/01
bug#58839: [Patch] Re: bug#58839: 29.0.50; project-kill-buffer fails when Eglot is running, João Távora, 2022/11/01