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

From: Dmitry Gutov <[email-masked]>
Date: Wed, 7 Dec 2022 04:35:35 +0200

On 06/12/2022 19:23, Juri Linkov wrote:
>>> (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.
> I haven't tried the proposed patch yet.  But it would be interesting to
> guess how it will behave with 'C-x p p ...'.

More testing is welcome.

 > Do you think it will get
 > the project name from the original project, or from another project
 > where it switches to?

It all depends on what's in project-find-functions. With project-vc it 
will probably work as expected (module the problem that was brought up 
in bug#59722, but we'll need to fix that separately anyway), but it can 
behave unexpectedly with more complex project-finding logic, like the 
one favored by Stephen L. or Eli Z., where belonging to a project is not 
defined by the directory only. But possibly by the major mode as well.

And I'm guessing project-buffer-name-function will usually be called 
before the major mode is set.