From: Dmitry Gutov Date: Sun, 9 Jun 2024 02:37:25 +0000 (+0300) Subject: project-list-buffers-ibuffer: Handle the FILES-ONLY argument X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=50f0abae8898083a967bfc24d5ed105c16a052b5;p=emacs.git project-list-buffers-ibuffer: Handle the FILES-ONLY argument * lisp/progmodes/project.el (project-list-buffers-ibuffer): Handle the FILES-ONLY argument (bug71290). (project-list-buffers-buffer-menu): Expand docstring. (cherry picked from commit a486782f5ee394a432eebd1dc507ff558a8d7198) --- diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 7efa5e2a380..d73fac81280 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -1569,7 +1569,8 @@ ARG, show only buffers that are visiting files." (funcall project-buffers-viewer pr arg))) (defun project-list-buffers-buffer-menu (project &optional files-only) - "Lists buffers of a project in Buffer-menu mode" + "List buffers for PROJECT in Buffer-menu mode. +If FILES-ONLY is non-nil, only show the file-visiting buffers." (let ((buffer-list-function (lambda () (seq-filter @@ -1600,11 +1601,13 @@ ARG, show only buffers that are visiting files." (list-buffers-noselect files-only buffer-list-function))))) (defun project-list-buffers-ibuffer (project &optional files-only) - "Lists buffers of a project with Ibuffer" - ;; TODO files-only + "List buffers for PROJECT using Ibuffer. +If FILES-ONLY is non-nil, only show the file-visiting buffers." (ibuffer t (format "*Ibuffer-%s*" (project-name project)) - `((predicate . (member (current-buffer) - (project-buffers ',project)))))) + `((predicate . (and + (or ,(not files-only) buffer-file-name) + (member (current-buffer) + (project-buffers ',project))))))) (defcustom project-kill-buffer-conditions '(buffer-file-name ; All file-visiting buffers are included.