emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Speed up project-kill-buffers


From: Dmitry Gutov
Subject: Re: [PATCH] Speed up project-kill-buffers
Date: Mon, 17 May 2021 00:58:06 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1

On 16.05.2021 23:36, Stephen Leake wrote:
Which means you need to provide an option for the times when we want the
other behavior: C-u kills root and external-roots, plain kills root only.

I wouldn't mind adding an option, but that presents a difficulty.

At the moment, we call `project-current` in each buffer and compare the returned value to the "current" project instance. That wouldn't work for external roots no matter what option we add because a given file inside "external root" can belong (in an "extended" sense) to several projects at once, so there's no logical way to obtain the project instance we're looking for based on such external file. Right?

A generic like project-contains? I previously mentioned would have a problem that every project backend's implementation would have to obey such an option, which creates new possibility for bugs and diverging behaviors.

If the current project-kill-buffers doesn't work for you (please check; IIRC your backend's peculiar behavior might have an upside in this case), what we could more easily do is create an option like 'project-list-buffers-function'. The default would delegate to project-current. The alternative could indeed use file-in-directory-p (or a string comparison to similar effect) as discussed in this thread, providing a different inclusion semantics and improved performance, and the third alternative value could enable looking in external roots as well.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]