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: Sat, 08 May 2021 19:09:05 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Hi Dmitry,

Sorry for the late reply, I didn't found much time to work on this until
now.

> Actually, it didn't occur for vc-dir buffers. So it's arguably a bug
> in my code.
>
> Attaching the updated patch which fixes that particular problem,
> though I'm a little more suspicious of some of uniquify's choices now.

I agree that uniquify way of handling buffers not visiting files is
fragile...

> In particular, this code depends on list-buffers-directory being set
> to a value in particular format which is very non-obvious from this
> variable's docstring.

Yes, and shell-mode already sets list-buffers-directory to the default
directory which is not the

   (expand-file-name "*shell*" default-directory)

that uniquify would expect (and is overwritten by your patch).

> And to have uniquify work similarly with buffers created by M-x shell
> and M-x eshell as well, these commands need similar changes (we can't
> really depend on them in project.el because it's an ELPA Core
> package), as well as shell-mode and eshell-mode being listed in
> uniquify-list-buffers-directory-modes.

When shell minor mode dirtrack-mode is enabled (the default), the value
of list-buffers-directory is updated when cd, pushd, popd, etc. are
issued; It will thus interfere if uniquify has to rerationalize the
buffer name... 

I saw in commit 1c3a86e7fc2 that project-prefixed-buffer-name has been
introduced which I understand as "forgot of uniquify since it doesn't
handle buffer not visiting files properly". I have some time to work on
improving the uniquify situation but can you confirm there's still
interest for this?

My rough plan is to change uniquify-list-buffers-directory-modes to be a
mapping from major modes to functions that, given a buffer, returns the
buffer proposed name and a directory. This would remove the use of
list-buffers-directory in uniquify and gives the opportunity for each
major mode to provide its convenience function based on
current-directory or project-root.

The default won't be to add shell-mode and eshell-mode to this new
uniquify-list-buffers-directory-modes mapping (to avoid breaking current
behavior) but do it locally when shell or eshell are called from
project.el. Is this dependency acceptable?
-- 
Matthias



reply via email to

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