bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#66464: Vc mode-line


From: Dmitry Gutov
Subject: bug#66464: Vc mode-line
Date: Sat, 11 Nov 2023 01:54:38 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0

On 10/11/2023 09:33, Juri Linkov wrote:
It would be a pity not to add this handy feature.
So here is a small patch that joins the project name and vc status
on the mode line:

Could you described the intended look?

Here is the screenshot how the mode line looks like:

Thanks.

Two mode-line entries one right by another, without a space between?

The format is "project-branch" instead of "backend-branch".

It might also be misread as a directory name. E.g. I have directories called "emacs" and "emacs-master" (thanks to git-worktree), and they get automatically assigned the corresponding project names. The new mode-line with your customization looks like "emacs-master-master". But that could just be my problem.

And with the backend name removed? Wouldn't you say we're losing some
useful information this way? Or perhaps the backend name is not essential.

I'm sure that showing the backend name in all file buffers is useless
for most users and wastes the precious screen space.

Hmm, I suppose since we're in a situation where one VCS (Git) is used 99% of the time, the indication might be unnecessary. But it's also a reminder that this mode-line item is for VC. Anyway...

But I don't propose to change the default.

In any case, it seems like

   (const :tag "Show project name and status" with-project)

describes the option inaccurately, since VC's mode line doesn't show the
project name.

Technically it's not vc-mode that shows the project name indeed.
I already tried such things as calling '(project-mode-line-format)'
from 'vc-mode-line-string'.  But it's an unnecessary complication.

That's probably an overkill indeed, also because the user would have to customize project-mode-line to nil, and then some projects might not be VC-controlled, which would result in no mode-line element at all.

And if you customize 'vc-display-status' to 'with-project' but don't
set project-mode-line to t, the project name won't be shown at all.

This is why the condition already handles this case:

   (and (eq vc-display-status 'with-project)
        (bound-and-true-p project-mode-line))

What happens if mode-line-format doesn't contain project-mode-line-format, or has it in the wrong place? E.g. if the user (or third-party package) customized the mode-line.

It's probably not terrible not to support that (after all, that would be a combination of two non-default customizations).

Anyway, I've raised the questions, but I don't have strong objections to your patch. Perhaps consider changing the description from

  (const :tag "Show project name and status" with-project)

to

  (const :tag "Show only status next to project name" with-project)

and, maybe, check that project-mode-line-format precedes the vc-mode indicator in the current mode-line format. And otherwise keep the separating " ". If that makes sense to you.





reply via email to

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