emacs-devel
[Top][All Lists]
Advanced

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

Re: Missing snprintf in ucrt mingw + vc-refresh in find-file hook?


From: Arthur Miller
Subject: Re: Missing snprintf in ucrt mingw + vc-refresh in find-file hook?
Date: Thu, 15 Feb 2024 12:16:35 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Dmitry Gutov <dmitry@gutov.dev> writes:

> On 14/02/2024 23:04, Arthur Miller wrote:
>
>>> The idea behind it was something else: to be able to unify mode-line 
>>> elements
>>> (from vc and project).
>> Ok, I see. A question: is it importnat to keep display on modeline or
>> elsewhere decoupled from the actual repo query?
>
> Probably, yes. If I understood your question right.
>
>>>> In case when list of files are checked, one can let-binding 
>>>> vc-display-status
>>>> to nil in vc-refresh (or the responsible one) so to not trigger git?
>>>
>>> vc-display-status only affects vc's mode-line element.
>> Can I use to in the meaning "no status display" = "no git query"? That is why
>> I
>> ask if it is important to keep display decoupled from the query.
>
> If we do it this way, it will just be an incremental increase in the 
> complexity
> of the code, and it will support only a part of the applicable use cases. I

Allright, np I understand.

> think I've explained that in one of the previous emails.

You will have to forgive me; I am not familiar with vc-mode and project.el;
perhaps you have explained, but I didn't got it how ti all hangs together and
what are intentions with all this. Better to ask, than to assume wrong.

>>>>> So I would welcome such an experiment, especially if one is careful to 
>>>>> retain
>>>>> support for vc-follow-symlinks.
>>>>>
>>>>> vc-after-save could similarly avoid doing the full refresh until the 
>>>>> file's
>>>>> backend/state are requested again.
>>>> When they request for the backend state; they could do so asyncrhonously 
>>>> to,
>>>> by
>>>> starting a timer? The update will not be immideate; run first when Emas is 
>>>> idle,
>>>> if it is just the modeline; but third party apps, if there are such, can 
>>>> be more
>>>> picky.
>>>
>>> That's not simpler.
>> After looking more at it; what I find problematic is that it is
>> automatic. Also,
>> use of hooks find-file/after-save (eventually) means either all or nothing.
>> I looked a bit in vc-hooks and vc-dir, and come up with this little ugly 
>> hack:
>> (define-minor-mode vc-mode
>>    "vc-mode test"
>>    :global nil :lighter " vcm "
>>    (setq-local vc-handled-backends
>>          (if vc-mode
>>              '(RCS CVS SVN SCCS SRC Bzr Git Hg)
>>            nil)))
>> Since vc-mode is just a dummy function; I per-used it. Now I can keep in my
>> init
>> file (setq vc-handled-backends nil) and nothing screems after Git when it is 
>> not
>> in the path; and in projects where I wish to work with vc-mode and run 
>> vc-dir, I
>> can start vc-mode and than vc-dir works as expected.
>
> If you're just looking for a hack for personal use, this one's as good as any.
>
>> I also don't see how Emacs could know when to start vc-mode and when not,
>> without user taking an action. If complete automatic handling of version 
>> control
>> is desired than something like that is not acceptable.
>
> It would be whenever some actual feature requested the vc state to be computed
> because it's going to use it now.
So basically commands would have to auto-start it.

>> Anyway, I think I can personally live with my hack, unless there is something
>> really nasty I am forseeing there. That achieves what I asked for, without 
>> you
>> needed to change anything.
>
> I don't think you're going to have any big problems with the above setup, as
> long as you remember to turn on vc-mode to use any features that require
> VC. Such as diff-hl-mode, for example.
I can just advice or wrap those commands I use, so I guess it is not a problem
for me.

Thanks for the help.
/a



reply via email to

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