From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Arthur Miller Newsgroups: gmane.emacs.devel Subject: Re: Missing snprintf in ucrt mingw + vc-refresh in find-file hook? Date: Tue, 13 Feb 2024 10:47:33 +0100 Message-ID: References: <6aed5106-b78c-49f1-8caa-a7f9d34c161b@gutov.dev> <207528e2-6bec-436e-8868-8e7b707133f6@gutov.dev> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9462"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: emacs-devel@gnu.org To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Feb 13 13:01:08 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 1rZrTH-0002IC-2k for ged-emacs-devel@m.gmane-mx.org; Tue, 13 Feb 2024 13:01:07 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rZrSA-0000P0-NE; Tue, 13 Feb 2024 06:59:58 -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 1rZpOA-0006tC-8r for emacs-devel@gnu.org; Tue, 13 Feb 2024 04:47:43 -0500 Original-Received: from mail-am0eur02olkn2025.outbound.protection.outlook.com ([40.92.49.25] helo=EUR02-AM0-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rZpO8-0001f2-2d for emacs-devel@gnu.org; Tue, 13 Feb 2024 04:47:42 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZSjuadVumC0ZAGYTHENGLgreSsIy/pIvIfEGppbc/Qn0/fkIXStJ2rd3iXeU5NuAGwiQ58vD5weBYGpdoZeq1LNNt+efJBDha/Yy7gTyfgxIHd3On/rCdK76/aYlpm2KFIaLAC1IcinqUiXTH0rnA+JQRo8N/D2IpWHaNtcduR6N8HyQTgaEScDw8vsofS8LbNK4xybXqelfItkUeOhcQGDEQggF/rAQwdpvUEw+cuOY7fQjoo6Upca1fxPAKPbGblYbguzMhniZZUARW2yaguXAnCIHpobmSEuhAty1h4h64xvRrt7ZZzfhR+axwjqR//qKsF+BRUSA8Yj04gRLuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=COWrarK1YEvAydR+1wEvUGqhryTkR9rPPPrqlIRaYC4=; b=iFw81X18nWh3yl9ugAfs1iVrWRoMFAeAR7ji/p4x7mAqUZdxmAJLsyL5zVNDWy6NdhKDjxoUkSQxxK04FWhJHphK/H/5Qx38Rq4ZyuHEejjgDPRo1JK8bIspjHu5YRS0WysyiqcfTTHpDVb/v+lVlHbGKi1jD1Rwrtd+Ljal3pmbi8mfzEg9/8RxIYynAPv71sfjwNyBGMFBCU6uiQ7u0iwE13CwUit8/N4wxxhOROQdcIA3QHfpW8uGZC8q7Ue/k1QXbSjiuHZOrbVVAKBUvn3xrMD8oieGKG925S/vS2dfLghYuCCgpP4cGmbisWml2zVXfyupq4Fmwy2ohhkWdA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=COWrarK1YEvAydR+1wEvUGqhryTkR9rPPPrqlIRaYC4=; b=gIxr7sdrTAYEbqCFMZclCUa4G5Hd01LtH+C0cM1H52ZXmTbz6V3OtnYFUOzYyeXAYzGUIASCrJWr1R6N3YpOq84Ua5FqUa+n/aILnuPe3BJYJ9VDzFcIaqIfYiPcveD7wMP5nc+3wWg2kZxc5draJSfmEQi9yYysxTiDSYO8LOs5GfBkkuZExZDC8yYYcQ1J/l1rhUBaRpyrnUD0IFkr6M9C0no07jtitK/ZLVnskeK1kus5gQu/0dQeT29iWZSuXPP4gyKotey5yNfAX4EdtRdnwTcO/2KH08nQR5M5n5DUuVmq4RSTsv0qbcv+v2OaKXxjrThYF7233nQPrFL06w== Original-Received: from DU2PR02MB10109.eurprd02.prod.outlook.com (2603:10a6:10:497::14) by AS8PR02MB8733.eurprd02.prod.outlook.com (2603:10a6:20b:54f::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.39; Tue, 13 Feb 2024 09:47:36 +0000 Original-Received: from DU2PR02MB10109.eurprd02.prod.outlook.com ([fe80::1752:9b0:4c48:15f8]) by DU2PR02MB10109.eurprd02.prod.outlook.com ([fe80::1752:9b0:4c48:15f8%7]) with mapi id 15.20.7270.036; Tue, 13 Feb 2024 09:47:36 +0000 In-Reply-To: <207528e2-6bec-436e-8868-8e7b707133f6@gutov.dev> (Dmitry Gutov's message of "Mon, 12 Feb 2024 16:58:52 +0200") X-TMN: [DmtsEKFnM6O0sgrIzxybflqgKXUEpMO2] X-ClientProxiedBy: OS6P279CA0032.NORP279.PROD.OUTLOOK.COM (2603:10a6:e10:32::20) To DU2PR02MB10109.eurprd02.prod.outlook.com (2603:10a6:10:497::14) X-Microsoft-Original-Message-ID: <867cj8n1ai.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR02MB10109:EE_|AS8PR02MB8733:EE_ X-MS-Office365-Filtering-Correlation-Id: 94d9d0b7-f821-475b-9948-08dc2c78ced2 X-MS-Exchange-SLBlob-MailProps: laRBL560oLQAnGxpW41NMDDzKdy+5rTznFc3txI0S53F8F95/dQ2s6H624ZBlBW3CFBAowhmj/x+oufle6CfJcNrBvNxcyAb1ebwb10n7vQffSDFJjMHaNiIsPXTDr8VCjDXi68p/y46oUjUlY+4h73n1T/TLi/4ja6+taNBI3NXY7R2TvSV7LKJ71a8tTVtzFhVWi9bcCAAbnQc9N/W4oHh935hSdProD00/L8oyHSa/ZIql5NyEd7DjWY1V0iBuxZvDcZO7ywVU0oNaxuKgR/FOY3xkSrCkTGJaB+RUYAMbUc1xgta4zS5DT+ud1ZbIe7raPi9xQN0A8bnZyft+vEQYP3+218ztKctGxIw5xC+1YCAfMI8G4OA50iabQ3bCEgeC/xE80tpHKug86JsKQMQy/ZBYDTjgH+QsZ0p7sPhiDAiCfN24SPyjZRcNUOfx+k4LTvvUt2AZ2qL9y+twQcRfzOdJ6yKgemS7CD8wr/mOMFZ4v+l05fyZGPETh0k9xVOivZwtSXSyWHtQXv/LPwoI9wweNDvP0kKEVvXAkhpyUw62uZjMXASqp9ILe5DLKszWGj2XbWVeXCJAumO4OnmOWZGx9kQGr95gz4B+Fx/SPZInvKhbEP5Nn7uCRGG5mejmkjfe52d/TEeWIgl+09eCqGL0VcuVM30m/gMp6p/ssPX5Iqnl0tmFoV7W3oac58XnKIMhmubZ2S+n2c4vIP/i6duZhz9N8aIXbkVQLJv+l+1NGQiXscLNzZnKCkC eBOhZOja9ME998ZW87K4K47GEtktsRQL X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0LoaWgnRyzeIQPwhLBwwyKGwL4Dpx8ZOSo6XiuKNTXdkKwytteq7bR3QWjkeU+UVdaOFbmM9drrndvgv1i1aoL/fTx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O1+tjylgJA8pSh+x8tF2PNDAm1?= =?us-ascii?Q?e1oHLjqWpgmPSIuKHUSEBYyQAbiN7g4D4PqGyuboJ2/2cKDjL7iXGCfqKWkq?= =?us-ascii?Q?5+HtuSD+8rtl+lxXBr94Kr+cuBnANcrUC8qyyCLNZ+79c2kEPlwiT7jX9DJA?= =?us-ascii?Q?5ec4Kvhv/5F3cV+XN3aPB9LdKMybVtAzPDhaDjn80x9cnuB71ThzrAHsck6U?= =?us-ascii?Q?mLeq6xM/5Iwkons3rCTqGH4nf+7FaxquuqH8CsFyDMWqD3aSrr/dymy+ikCj?= =?us-ascii?Q?QE X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-ab7de.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 94d9d0b7-f821-475b-9948-08dc2c78ced2 X-MS-Exchange-CrossTenant-AuthSource: DU2PR02MB10109.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Feb 2024 09:47:36.3280 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR02MB8733 Received-SPF: pass client-ip=40.92.49.25; envelope-from=arthur.miller@live.com; helo=EUR02-AM0-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Tue, 13 Feb 2024 06:59:57 -0500 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:316171 Archived-At: Dmitry Gutov writes: > On 12/02/2024 15:56, Arthur Miller wrote: >> Dmitry Gutov writes: >> >>> On 12/02/2024 12:06, Arthur Miller wrote: >>>> Also, calling vc-refresh obviously results in a quite expensive call to git >>>> process everytime I open a file from git repo. Is it really a good default >>>> option? At least I interpret it so since emacs -q has vc-refresh in >>>> find-file-hook. Why do we even need vc-refresh by default in find-file-hook? >>> To have the mode-line indicator up-to-date, I imagine. >> (setq vc-handled-backends nil) solved it. I would prefer such an expensive >> feature to be opt-in not opt-out, or at least better advertised so I don't have >> to find by a chance what Emacs is doing in the background; thanks. > > The fact of the matter is, it's relatively expensive only on certain platforms, > but much less so on the main one that we keep in mind when developing Emacs > (GNU/Linux). To me, this is expensive regardless of the platform. It is not so much about the speed of process spawning, more about the fact that I am spending CPU cycles and battery on something I don't care about. I wasn't even aware this was going on, untill yesterday. I understand that some users like to see diverse stuff in their modeline, statusbars, powerlines, command prompts and other widgets. That is fine; if users want it, give it to them. But I am not such a user, and this feels a bit too much to have it auto on. This can get triggered automatically in save places; for example I have save place on, so when I open a file, Emacs will display cursor at the same place where I left. I see that it gets triggred in some places with Helm completion. Basically everything I have nowdays is in Git, inclusive my entire emacs.d folder. That means I am constantly starting and killing git processes, and I don't even care about that info on my modeline. I look barely at modeline; sometimes I take a look at the clock or line/column number. As a note, doesn't people normally use gitstatusd for this? https://github.com/romkatv/gitstatus (GPL3 software) > You might be curious to hear that visiting a file controlled by Git under MS > Windows was ever slower in the past, and yours truly spent some effort reducing > the number of process calls we take to compute a file's status (about 10 years > ago or so). I trust you, and I have no doubts that you have done a good job. Ten years ago, I wasn't even using git myself. If you consider that people are complaining quite a lot about Emacs been too slow on Windows, than I would consider if this is something that has to be on by default. >>> I imagine. >> I would appreciate if you leave sarcasm out of your answers. > > No sarcasm here. If you end with "I imagne" than it implies it is self-evident. For me it obviously wasn't :). I got aware of it from that backtrace. As a side note: I am really grateful to whomever wrote the debugger and edebug so I can just click on a function name and jump to the implementation instrument it with edebug and just step through. It is really handy. > No sarcasm here. Your question is valid: why not defer the process calls until > some operation actually requests the file's status. > > The answer stems from the UI considerations. And if we show it in the mode-line, > we have to update the file's VCS status eagerly. I understand and agree that running a git process in modeline update would be even worse, we don't want that :-). Can we have it optional to update modeline, but to have the rest of vc-mode active? Seems that setting vc-backend to nil shuts down everything. If it is used just for the modeline update, than we can safely (and optionally) remove it from the find-file hook to start with? Something like this: #+begin_src emacs-lisp (defcustom vc-display-status t "If non-nil, display revision number and lock status in mode line. If nil, only the backend name is displayed. When the value is `no-backend', then no backend name is displayed before the revision number and lock status." :type '(choice (const :tag "Show only revision/status" no-backend) (const :tag "Show backend and revision/status" t) (const :tag "Show only backend name" backend) (const :tag "Don't show any revision info" nil)) :set (lambda (symbol new) (set-default symbol new) (if (not new) (setq find-file-hook (delq 'vc-refresh-state find-file-hook)) (add-hook 'find-file-hook 'vc-refresh-state))) :group 'vc) #+end_src When saving files, it is implemented differently, basic-save-buffer triggers everything by calling vc-backend. Is it some special reason why vc-refresh-state is called directly and now in after-save-hook for example? I add vc-refresh-state to after-save-hook and hack the needed places, could that work, or are the some other considerations? Sorry, I am not familiar with vc.el/project.el so I don't know how everything hangs together in that regard. Thanks for the help. /arthur