Subject: bug#59935: 29.0.60; project-list-buffers is slow

From: Eli Zaretskii <[email-masked]>
Date: Sat, 10 Dec 2022 22:11:13 +0200

> Date: Sat, 10 Dec 2022 21:53:28 +0200
> Cc: [email-masked], [email-masked]
> From: Dmitry Gutov <[email-masked]>
> 
> On 10/12/2022 21:42, Eli Zaretskii wrote:
> >> Date: Sat, 10 Dec 2022 21:19:30 +0200
> >> Cc:[email-masked],[email-masked]
> >> From: Dmitry Gutov<[email-masked]>
> >>
> >> On 10/12/2022 16:33, Eli Zaretskii wrote:
> >>> OK, but I didn't suggest making any changes to revert-buffer-function
> >>> set up by "C-x p C-b".  You can still use process-buffers there, and
> >>> it shouldn't slow down "C-x p C-b" itself, since the call to
> >>> process-buffers that is part of revert-buffer-function is not supposed
> >>> to be evaluated when you set revert-buffer-function.  Right?  Or what
> >>> else am I missing?
> >> Then only the 'g' binding will remain slow. An improvement, of course.
> > Why slow? it calls project-buffers only once.
> 
> You're looking at the "legacy" code path. Where emacs-version is < 29.

I'm looking at the code you posted as the original one, which is
identical to what I see on the current emacs-29 branch.  That means
Emacs 29, unless I'm seriously confused.

> In the "new" one revert-buffer-function uses the filter-predicate 
> argument we pass to list-buffers-noselect. Which is
> 
>    (lambda (buf) (memq buf (project-buffers pr)))

I see this in emacs-29:

             (setq-local revert-buffer-function
                         (lambda (&rest _ignored)
                           (list-buffers--refresh (project-buffers pr))
                           (tabulated-list-print t))))

So I still don't understand your fears.