unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dmitry@gutov.dev>
To: Juri Linkov <juri@linkov.net>
Cc: 66464@debbugs.gnu.org
Subject: bug#66464: Vc mode-line
Date: Sat, 11 Nov 2023 01:54:38 +0200	[thread overview]
Message-ID: <bdd7ff03-7b83-fb56-4c56-a52a6b27c8e9@gutov.dev> (raw)
In-Reply-To: <868r76p16h.fsf@mail.linkov.net>

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	other threads:[~2023-11-10 23:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-11 16:29 bug#66464: Vc mode-line Juri Linkov
2023-10-16  1:11 ` Dmitry Gutov
2023-10-16 17:14   ` Juri Linkov
2023-10-31  7:40 ` Juri Linkov
2023-11-09 16:41   ` Juri Linkov
2023-11-10  2:04     ` Dmitry Gutov
2023-11-10  7:33       ` Juri Linkov
2023-11-10 23:54         ` Dmitry Gutov [this message]
2023-11-11 18:50           ` Juri Linkov
2023-11-11 22:05             ` Dmitry Gutov
2023-11-12  8:07               ` Juri Linkov
2023-11-12 10:59                 ` Dmitry Gutov
2023-11-13  7:11                   ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bdd7ff03-7b83-fb56-4c56-a52a6b27c8e9@gutov.dev \
    --to=dmitry@gutov.dev \
    --cc=66464@debbugs.gnu.org \
    --cc=juri@linkov.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).