bug-gnu-emacs
[Top][All Lists]
Advanced

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

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


From: Dmitry Gutov
Subject: bug#59935: 29.0.60; project-list-buffers is slow
Date: Sat, 10 Dec 2022 04:03:11 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2

On 10/12/2022 03:49, Dmitry Gutov wrote:
Curiously, though, it shows a different list of buffers. It also
includes "hidden" buffers - diff-syntax, Echo Area, etc. We should look
into that either way.

The combined fix for both can be this:

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 016dfdd5b4..835ab07e50 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -1340,18 +1340,21 @@ project-list-buffers
 start with a space (which are for internal use).  With prefix argument
 ARG, show only buffers that are visiting files."
   (interactive "P")
-  (let ((pr (project-current t)))
+  (let* ((pr (project-current t))
+         (fetcher (lambda ()
+                    (cl-delete-if-not
+                     (lambda (b)
+                       (or (buffer-file-name b)
+                           (string-match-p "\\`[^ ]" (buffer-name b))))
+                     (project-buffers pr)))))
     (display-buffer
-     (if (version< emacs-version "29.0.50")
-         (let ((buf (list-buffers-noselect arg (project-buffers pr))))
-           (with-current-buffer buf
-             (setq-local revert-buffer-function
-                         (lambda (&rest _ignored)
-                           (list-buffers--refresh (project-buffers pr))
-                           (tabulated-list-print t))))
-           buf)
-       (list-buffers-noselect
-        arg nil (lambda (buf) (memq buf (project-buffers pr))))))))
+     (let ((buf (list-buffers-noselect arg (funcall fetcher))))
+       (with-current-buffer buf
+         (setq-local revert-buffer-function
+                     (lambda (&rest _ignored)
+                       (list-buffers--refresh (funcall fetcher))
+                       (tabulated-list-print t))))
+       buf))))

 (defcustom project-kill-buffer-conditions
   '(buffer-file-name    ; All file-visiting buffers are included.






reply via email to

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