[Top][All Lists]

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

Re: Name of buffers created by project-shell

From: Dmitry Gutov
Subject: Re: Name of buffers created by project-shell
Date: Thu, 4 Mar 2021 05:21:59 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

Hi Matthias,

On 02.03.2021 23:18, Matthias Meulien wrote:
When I C-x p v (project-vc-dir) from a buffer with project root called, say, "myproject" , I switch to a buffer called *vc-dir*<myproject>. When I C-x p s (project-shell) from a buffer with same project root, I switch to a buffer called *myproject-shell*

Later, I found it not very convenient when switching between buffers by name using C-x b (switch-to-buffer) to have one buffer with a prefix build from the project root and one with a suffix. Don't you think we should homogenize those namings?   Since when I M-x shell then C-u M-x shell, I switch to a *shell*<2> buffer, I'd suggest to rename the buffer created by project-shell to *shell*<myproject>...

What you're asking for makes sense, but there is a snag because of how these commands are implemented.

vc-dir doesn't choose the buffer name format itself. It ultimately calls create-file-buffer (which has an advice made by uniquify) which renames the buffer based on uniquify-buffer-name-style (if uniquify is loaded in the current session), of course. The problem with that function is that it always creates a new buffer. So, before calling it, vc-dir-prepare-status-buffer does a search for existing buffer and can find existing one if it matches by major mode and default directory.

Both shell and eshell buffers can change their default-directory, but we can track which project they belong to with a new variable. See the attached patch.

There's one problem, though: when called with C-u, the piece of behavior which reads as "create a new inferior shell buffer even if one already exists" now creates buffers uniquely named according to uniquify's rules, which seems to mean


instead of what one might expect, like


Perhaps the solution is not to go through uniquify for this, but then we project-shell can't really be consistent with project-vc-dir.

Attachment: uniquify-project-shell.diff
Description: Text Data

reply via email to

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