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

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

bug#59502: 29.0.50; [PATCH] Dedicated buffers per project


From: Gabriel
Subject: bug#59502: 29.0.50; [PATCH] Dedicated buffers per project
Date: Wed, 23 Nov 2022 02:11:36 -0300

Severity: wishlist

Description:

Currently, xref commands in project.el (`project-find-regexp' and
`project-or-external-find-regexp') use a "default" xref buffer (through
a call to `xref-show-xrefs').  It's a "default" buffer because it uses a
constant name ("*xref*") for the xref buffers created (see
`xref-buffer-name').

If a user is working with two or more projects, any xref command will
override a previous "*xref*" buffer.  Thus, it's required that the user
first manually rename any existing xref buffer prior to executing a new
xref command, in order to keep the xref buffers of other projects.  The
same is true for "*Buffer List*", "*Shell Command Output*" and "*Async
Shell Command*" buffers.

Currently, project.el already support prefix names for compilation,
shell and eshell commands (see `project-prefixed-buffer-name' and
`project-compilation-buffer-name-function').  The "*vc-dir*" buffer
created by `project-vc-dir' is handled by uniquify.el
(`vc-dir-prepare-status-buffer' uses `create-file-buffer').

In summary, project.el currently has the following behavior and
customization options:

| Project Command                   | Generated Buffer         | Current 
Behavior              | Customization Options                      |
|-----------------------------------+--------------------------+-------------------------------+--------------------------------------------|
| `project-find-regexp'             | "*xref*"                 | Use a default 
buffer          | Not available                              |
| `project-or-external-find-regexp' | "*xref*"                 | Use a default 
buffer          | Not available                              |
| `project-list-buffers'            | "*Buffer List*"          | Use a default 
buffer          | Not available                              |
| `project-kill-buffers'            | "*Buffer List*"          | Use a default 
buffer          | Not available                              |
| `project-shell-command'           | "*Shell Command Output*" | Use a default 
buffer          | Not available                              |
| `project-async-shell-command'     | "*Async Shell Command*"  | Use a default 
buffer          | Not available                              |
| `project-compile`                 | "*compilation*"          | Use a default 
buffer          | `project-compilation-buffer-name-function' |
| `project-vc-dir'                  | "*vc-dir*"               | Use a default 
buffer          | Through uniquify.el defcustom's            |
| `project-shell'                   | "*shell*"                | Use a project 
prefixed buffer | Not available                              |
| `project-eshell'                  | "*eshell*"               | Use a project 
prefixed buffer | Not available                              |

My suggestion is to improve the consistency of how project-related
buffers are created and named, providing sufficient customization
options for users.

Solutions:

1) Make all project-related buffers use by default
`project-prefixed-buffer-name'.  This is similar to how `project-shell'
and `project-eshell' behaves today.  The downsides are the lack of
customization options for users and the introduction of behavior changes
related to how some project-related buffers are currently named.

2) Create dedicated defcustom's for each project-related buffer.  This
is similar to how `project-compile' behaves today, by allowing users to
customize the option `project-compilation-buffer-name-function'.  The
downside is the excessive number of new defcustom's.

3) Create a single defcustom to compute the name of project-related
buffers.  This is similar to how `project-compile' behaves today, but
would be a more general-purpose customization option.  This is currently
my preferred solution (see the attached patch).  I tried to make it
simple, consistent and without introducing behavior changes related to
how project-related buffers are currently named, but I am not really
happy with the implementation.  An example of how users could customize
this option is presented below:

(setopt project-buffer-name-function
        (lambda (name)
            (format "*%s-%s*"
                    (project-name (project-current))
                    name)))

Attachment: 0001-Add-user-option-project-buffer-name-function.patch
Description: Text Data

Please share your comments or suggestions.

---
Gabriel

reply via email to

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