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: Dmitry Gutov
Subject: Re: Missing snprintf in ucrt mingw + vc-refresh in find-file hook?
Date: Wed, 14 Feb 2024 19:01:10 +0200
User-agent: Mozilla Thunderbird

On 14/02/2024 18:51, Eli Zaretskii wrote:
Date: Wed, 14 Feb 2024 18:36:47 +0200
Cc: arthur.miller@live.com, emacs-devel@gnu.org
From: Dmitry Gutov <dmitry@gutov.dev>

What is the purpose of such a change?  Does it target users who don't
want vc-refresh-state in find-file-hook, but still want the VC info
shown on the mode line?

Those in particular won't see an immediate benefit, but, to reiterate:

    As a result, we could have Emacs that's a little bit faster for users
    with custom mode-lines [that don't show VCS status or backend].

    And also [for all users:] any find-file-noselect calls performed in
    the background (sometimes those are even done on a list of files)
    won't fetch the VCS status eagerly until the buffer is displayed.

If that's the purpose, why not simply have a value of
vc-display-status which would cause vc-refresh-state do nothing?
AFAIU, the result will be the same, but with much less code churn and
definitely safer.

vc-display-status only affects what the default mode-line does, and not the myriad of alternative configurations.

It cleaner to let the work happen when it's really required to happen, rather than guess in advance based on an imprecise indicator like this.

  > That sounds like a strange preference, since
  > find-file-hook is called just once per file buffer, whereas showing
  > the info on the mode line can potentially cause vc-refresh-state (or
  > something similar) to be called much more frequently, right?

The backend and the state are cached in vc-file-prop-obarray, so it
shouldn't result in more process calls, no matter the scenario. It's
mostly about how early we fetch this information.

My point is that find-file-hook has an explicit and very specific
trigger for fetching the VC information, whereas doing that from the
mode line doesn't have that advantage, and will probably need to call
VC much more frequently in order not to miss changes.

Again: the backend and state are cached. Why would VC be called more?



reply via email to

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