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: Stefan Monnier
Subject: Re: [PATCH] Speed up project-kill-buffers
Date: Mon, 03 May 2021 18:45:29 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

>> I've noticed that sometimes project-kill-buffers is noticeably slow, and
>> it seems like it's has to do with project--buffer-list working on remote
>> files. The function goes through every buffer and calls
>> (project-current), even if the buffer is related to a remote file that
>> cannot be part of the current project.
>> The patch I attach below is a simple fix to avoid checking files that
>> cannot be part of the current project. Or are there any edge-cases that
>> this code approach breaks?
>
> In theory, files on different hosts could be part of the same "project" (in
> Eli's sense, see
> https://lists.gnu.org/archive/html/emacs-devel/2020-07/msg00051.html and the
> other messages in that thread), but we'll get there when we get
> there. Probably by adding a method like project-contains-file-p.

Of course, we could also make the check super fast by keeping the
"current project" in a buffer-local var, and then just look for buffers
which have an `eq` value in that var.  That would be both faster than
`file-in-directory-p` and more arguably more correct.


        Stefan




reply via email to

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