[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: VC registered, but ignored
From: |
Dmitry Gutov |
Subject: |
Re: VC registered, but ignored |
Date: |
Fri, 1 Sep 2023 12:16:42 +0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 |
On 01/09/2023 09:29, Eli Zaretskii wrote:
Date: Fri, 1 Sep 2023 04:03:43 +0300
Cc: emacs-devel@gnu.org
From: Dmitry Gutov <dmitry@gutov.dev>
On 31/08/2023 18:24, Eli Zaretskii wrote:
In a repository where *.txt files are ignored, I added to VC a file
with the .txt extension, and was surprised to see the ':' indicator on
the mode line although the file was up-to-date. Moreover, the tooltip
said the file was "locally modified". That had me puzzled for a few
minutes, until I saw the code in vc-hooks.el.
You added it with 'C-x v v'?
No, from the shell prompt. Would the result have been different if I
did that with "C-x v v"?
Not 100% sure, but that's not important -- I have my answer.
We have a problem of sorts, or a break in the abstration, where
(vc-state buffer-file-name) would return nil instead of 'ignored.
Only if the file is not registered, right? Most/all ignored files are
not registered, they are generated files that we don't want to see in
VC status displays. Here I describe a situation that shouldn't
happen, but did.
Apparently so.
The value nil is the expected value for a file that is not registered.
It's more subtle that that, (vc-state buffer-file-name) would return nil
in that case, but (vc-state buffer-file-name 'Git) would return
'ignored. That hasn't affected any practical code so far (AFAIK), but
something to keep in mind.
In the case I described above, vc-state returns 'ignored, not nil.
And the result was that, instead of seeing no VC information on the
mode line, I saw a revision ID preceded by ':', as if the file was
locally modified.
Ok.
So the problem is your annotation won't show up if you just open an
ignored file (for Git backend, at least). Is that okay for your purposes?
No, see above.
IIUC, you mean yes, the combined solution is okay for your purposes (if
you open an unregistered ignored file, the annotation won't be there,
and the whole mode-line item will be absent as well).
As for which character to use, maybe a period? Although that depends on
what you want to bring attention to: usually people are happy to keep
ignored files ignored.
Again, the file was NOT supposed to be ignored! I deliberately added
it to the repository, I just forgot that it had an extension of
ignored files. (The solution, once I relized the cause, was to exempt
that one file from the otherwise ignored *.txt files.)
In that case, that indeed sounds like a situation that warrants
additional attention, and "!" might be a good choice.
So I think we can push the patch, and just be on the lookout for cases
where it misfires. Thank you.