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

From: Dmitry Gutov <[email-masked]>
Date: Mon, 5 Dec 2022 04:35:21 +0200

Hi again!

On 23/11/2022 07:11, Gabriel wrote:
> 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)))

A couple more thoughts: the buffer name function will generally be used 
before the buffer is created. The value of default-directory might even 
be wrong.

But even if it's not, some project backends might choose to enable or 
disable themselves based on the value of the major mode, which at the 
time that the function is called, might not be set yet.

Which is to say, it might be handy to have the project instance passed 
to this function as an argument, rather than have it looked up again.

Does it look feasible to you in most cases? If yes, we could rethink the 
story with project-compilation-buffer-name-function. Perhaps make it a 
function which returns a function.