From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Missing snprintf in ucrt mingw + vc-refresh in find-file hook? Date: Wed, 14 Feb 2024 18:51:39 +0200 Message-ID: <865xyrxa3o.fsf@gnu.org> References: <6aed5106-b78c-49f1-8caa-a7f9d34c161b@gutov.dev> <207528e2-6bec-436e-8868-8e7b707133f6@gutov.dev> <86sf1wpjui.fsf@gnu.org> <8876d606-c4af-4a27-a1b1-4c3dea6d720e@gutov.dev> <86r0hfxgm9.fsf@gnu.org> <7ecaf383-081f-47ad-bd83-6f1fe300fddc@gutov.dev> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1502"; mail-complaints-to="usenet@ciao.gmane.io" Cc: arthur.miller@live.com, emacs-devel@gnu.org To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Feb 14 17:52:36 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1raIUt-00008y-9G for ged-emacs-devel@m.gmane-mx.org; Wed, 14 Feb 2024 17:52:35 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1raIU6-0005gE-3i; Wed, 14 Feb 2024 11:51:46 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1raIU4-0005g3-Kq for emacs-devel@gnu.org; Wed, 14 Feb 2024 11:51:44 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1raIU2-0006Wh-Uj; Wed, 14 Feb 2024 11:51:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=RyRtK65ewx5zdD3JoCsR0g3WyM/c/GPacqSBBe4x/mA=; b=aUlZv0GXi7xi YOL1Q/VbJLi5EnbUFnfCUZs7P1GpiOd1x/bUyFpiK20doHN6rUImP97+x16a9D4ZSjWM5JrmoeueN TR1J5fzTQo5Z0G+cExrSZowsxpxmg1w/TUoWkSxqsuCiRZPyfo0ncG4kqaFpKEy9C9FFhBLhl1IBk Yff+3M/vnFirshZ60mysMi5S45F7njfkvAM6qobPnEBxxtMcBECiRBsOmCZr8JAX6goRH0fwDe3VH s6t5pRANi/YrC+cjB5GLsFHEFy9fst/RhKRE3+I9D2ag2m+y6GoLh0InaZ+g46qUL0HIYgUClZ5Vo UAKGYJGGQmsQjEce9OXNnQ==; In-Reply-To: <7ecaf383-081f-47ad-bd83-6f1fe300fddc@gutov.dev> (message from Dmitry Gutov on Wed, 14 Feb 2024 18:36:47 +0200) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:316206 Archived-At: > Date: Wed, 14 Feb 2024 18:36:47 +0200 > Cc: arthur.miller@live.com, emacs-devel@gnu.org > From: Dmitry Gutov > > > 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. > > 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.