GNU bug report logs - #71290
Options for viewing project buffers

Previous Next

Package: emacs;

Reported by: mikpom <mikpom <at> mikpom.ru>

Date: Fri, 31 May 2024 12:30:02 UTC

Severity: normal

Done: Dmitry Gutov <dmitry <at> gutov.dev>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 71290 in the body.
You can then email your comments to 71290 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#71290; Package emacs. (Fri, 31 May 2024 12:30:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to mikpom <mikpom <at> mikpom.ru>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 31 May 2024 12:30:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: mikpom <mikpom <at> mikpom.ru>
To: bug-gnu-emacs <at> gnu.org
Subject: Options for viewing project buffers
Date: Fri, 31 May 2024 19:28:53 +0700
Greetings devs and emacs community.

I occasionally need to list buffers of a project and do so with the
built-in command project-list-buffers from project.el. The problem is
that this command utilizes Buffer-menu mode and does so in a hard-coded
way. Personally I prefer IBuffer which is already heavily customized
while I have zero knowledge of Buffer-menu mode. 

I suggest to make an option whether project.el will list buffers with
Ibuffer, Buffer-menu or even something else?

Kind regards,
-Mikhail




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#71290; Package emacs. (Sat, 01 Jun 2024 15:29:01 GMT) Full text and rfc822 format available.

Message #8 received at 71290 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: mikpom <mikpom <at> mikpom.ru>, 71290 <at> debbugs.gnu.org
Subject: Re: bug#71290: Options for viewing project buffers
Date: Sat, 1 Jun 2024 18:27:45 +0300
Hi!

On 31/05/2024 15:28, mikpom wrote:
> Greetings devs and emacs community.
> 
> I occasionally need to list buffers of a project and do so with the
> built-in command project-list-buffers from project.el. The problem is
> that this command utilizes Buffer-menu mode and does so in a hard-coded
> way. Personally I prefer IBuffer which is already heavily customized
> while I have zero knowledge of Buffer-menu mode.
> 
> I suggest to make an option whether project.el will list buffers with
> Ibuffer, Buffer-menu or even something else?

I'm happy to add a new option, but if you look at the definition of 
project-list-buffers, it's not as trivial as

 - bind default-directory
 - call function

And ibuffer seems to require some effort as well. As a consequence, the 
option is unlikely to be infinitely extensible, it would just list 
'list-buffers' and 'ibuffers' as possible values. Maybe a "Custom 
function" alternative too, but the users who would want to use it will 
need to put it some work as well.

Speaking of ibuffer in particular, here's a hint of setup required to 
use it for project buffers: 
https://github.com/emacsmirror/ibuffer-project/blob/master/ibuffer-project.el

Of course, a lot of this could be optional (improvements to make the UI 
better), so if someone wanted to contribute a minimal implementation, we 
could certainly use it (just please don't copy the code from the above, 
it's not copyright-assigned).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#71290; Package emacs. (Sat, 01 Jun 2024 16:09:01 GMT) Full text and rfc822 format available.

Message #11 received at 71290 <at> debbugs.gnu.org (full text, mbox):

From: mikpom <mikpom <at> mikpom.ru>
To: Dmitry Gutov <dmitry <at> gutov.dev>, 71290 <at> debbugs.gnu.org
Subject: Re: bug#71290: Options for viewing project buffers
Date: Sat, 01 Jun 2024 23:07:17 +0700
Thanks for pointing to ibuffer-project. It will deliver on my request
even if suggested feature is never implemented.

On Sat, 2024-06-01 at 18:27 +0300, Dmitry Gutov wrote:
> Hi!
> 
> On 31/05/2024 15:28, mikpom wrote:
> > Greetings devs and emacs community.
> > 
> > I occasionally need to list buffers of a project and do so with the
> > built-in command project-list-buffers from project.el. The problem
> > is
> > that this command utilizes Buffer-menu mode and does so in a hard-
> > coded
> > way. Personally I prefer IBuffer which is already heavily
> > customized
> > while I have zero knowledge of Buffer-menu mode.
> > 
> > I suggest to make an option whether project.el will list buffers
> > with
> > Ibuffer, Buffer-menu or even something else?
> 
> I'm happy to add a new option, but if you look at the definition of 
> project-list-buffers, it's not as trivial as
> 
>   - bind default-directory
>   - call function
> 
> And ibuffer seems to require some effort as well. As a consequence,
> the 
> option is unlikely to be infinitely extensible, it would just list 
> 'list-buffers' and 'ibuffers' as possible values. Maybe a "Custom 
> function" alternative too, but the users who would want to use it
> will 
> need to put it some work as well.
> 
> Speaking of ibuffer in particular, here's a hint of setup required to
> use it for project buffers: 
> https://github.com/emacsmirror/ibuffer-project/blob/master/ibuffer-project.el
> 
> Of course, a lot of this could be optional (improvements to make the
> UI 
> better), so if someone wanted to contribute a minimal implementation,
> we 
> could certainly use it (just please don't copy the code from the
> above, 
> it's not copyright-assigned).





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#71290; Package emacs. (Wed, 05 Jun 2024 04:02:02 GMT) Full text and rfc822 format available.

Message #14 received at 71290 <at> debbugs.gnu.org (full text, mbox):

From: mikpom <mikpom <at> mikpom.ru>
To: Dmitry Gutov <dmitry <at> gutov.dev>, 71290 <at> debbugs.gnu.org
Subject: Re: bug#71290: Options for viewing project buffers
Date: Wed, 05 Jun 2024 11:00:53 +0700
[Message part 1 (text/plain, inline)]
So I implemented (thank  for a suggestion in Emacs-ru chat) optional
Ibuffer viewer. Diff on project.el is attached. It works in my setting.

Best wishes, 
-Mikhail

On Sat, 2024-06-01 at 23:07 +0700, mikpom wrote:
> Thanks for pointing to ibuffer-project. It will deliver on my request
> even if suggested feature is never implemented.
> 
> On Sat, 2024-06-01 at 18:27 +0300, Dmitry Gutov wrote:
> > Hi!
> > 
> > On 31/05/2024 15:28, mikpom wrote:
> > > Greetings devs and emacs community.
> > > 
> > > I occasionally need to list buffers of a project and do so with
> > > the
> > > built-in command project-list-buffers from project.el. The
> > > problem
> > > is
> > > that this command utilizes Buffer-menu mode and does so in a
> > > hard-
> > > coded
> > > way. Personally I prefer IBuffer which is already heavily
> > > customized
> > > while I have zero knowledge of Buffer-menu mode.
> > > 
> > > I suggest to make an option whether project.el will list buffers
> > > with
> > > Ibuffer, Buffer-menu or even something else?
> > 
> > I'm happy to add a new option, but if you look at the definition of
> > project-list-buffers, it's not as trivial as
> > 
> >   - bind default-directory
> >   - call function
> > 
> > And ibuffer seems to require some effort as well. As a consequence,
> > the 
> > option is unlikely to be infinitely extensible, it would just list 
> > 'list-buffers' and 'ibuffers' as possible values. Maybe a "Custom 
> > function" alternative too, but the users who would want to use it
> > will 
> > need to put it some work as well.
> > 
> > Speaking of ibuffer in particular, here's a hint of setup required
> > to
> > use it for project buffers: 
> > https://github.com/emacsmirror/ibuffer-project/blob/master/ibuffer-project.el
> > 
> > Of course, a lot of this could be optional (improvements to make
> > the
> > UI 
> > better), so if someone wanted to contribute a minimal
> > implementation,
> > we 
> > could certainly use it (just please don't copy the code from the
> > above, 
> > it's not copyright-assigned).
> 

[add_ibuffer_viewer.patch (text/x-patch, attachment)]

Reply sent to Dmitry Gutov <dmitry <at> gutov.dev>:
You have taken responsibility. (Sun, 09 Jun 2024 02:52:01 GMT) Full text and rfc822 format available.

Notification sent to mikpom <mikpom <at> mikpom.ru>:
bug acknowledged by developer. (Sun, 09 Jun 2024 02:52:02 GMT) Full text and rfc822 format available.

Message #19 received at 71290-done <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: mikpom <mikpom <at> mikpom.ru>, 71290-done <at> debbugs.gnu.org
Subject: Re: bug#71290: Options for viewing project buffers
Date: Sun, 9 Jun 2024 05:42:16 +0300
Hi!

On 05/06/2024 07:00, mikpom wrote:
> So I implemented (thank  for a suggestion in Emacs-ru chat) optional
> Ibuffer viewer. Diff on project.el is attached. It works in my setting.

This works, thank you. Pushed to master with expanded docstring and a 
minor fix (the ARG argument).

Also added the below patch.

This seems to work well, so marking this as resolved.

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index ab928a35e54..a16ff30395b 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -1567,7 +1567,8 @@ project-list-buffers
     (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
@@ -1598,11 +1599,13 @@ project-list-buffers-buffer-menu
        (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.





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 07 Jul 2024 11:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 348 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.