emacs-devel
[Top][All Lists]
Advanced

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

Re: Name of buffers created by project-shell


From: Matthias Meulien
Subject: Re: Name of buffers created by project-shell
Date: Sun, 14 Mar 2021 14:46:38 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> 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.

Thanks Dmitry, I had forgotten that users have different settings for
uniquify-buffer-name-style variable...

> 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.

Thanks! I am testing it.

I am not an eshell user but I guess the patch should use the variable
`eshell-buffer-name' defined in eshell.el in place of the hardcoded
"*eshell*" string.

> 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
>
>   *shell*
>   emacs-master/*shell*
>   vc/emacs-master/*shell*
>
> instead of what one might expect, like
>
>   emacs-master/*shell*
>   emacs-master/*shell*<2>
>   emacs-master/*shell*<3>
>

I think there's a problem even without using C-u: 

`project-shell' from a buffer whose associated project root path is
/src/project1 creates a buffer named *shell*.

Then `project-shell' from a buffer whose associated project root path is
/src/project2 creates a buffer named *shell*<project2> (I am using the
default `post-forward-angle-brackets' for `uniquify-buffer-name-style').

But the uniquify rationalize mecanism doesn't rename the first buffer to
*shell*<project1> which happens to be the case for buffers visiting
files...

-- 
Matthias



reply via email to

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