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.bugs Subject: bug#66993: [PATCH] project.el: avoid asking user about project-list-file lock Date: Wed, 08 Nov 2023 14:22:31 +0200 Message-ID: <83sf5g1lko.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19173"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 66993@debbugs.gnu.org To: Spencer Baugh , Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Nov 08 13:23:54 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1r0hb7-0004oE-9U for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 08 Nov 2023 13:23:53 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r0hai-0007mq-RI; Wed, 08 Nov 2023 07:23:28 -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 1r0haf-0007kt-A9 for bug-gnu-emacs@gnu.org; Wed, 08 Nov 2023 07:23:26 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0had-0004ah-TM for bug-gnu-emacs@gnu.org; Wed, 08 Nov 2023 07:23:24 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r0hbG-000299-0R for bug-gnu-emacs@gnu.org; Wed, 08 Nov 2023 07:24:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 08 Nov 2023 12:24:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66993 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 66993-submit@debbugs.gnu.org id=B66993.16994462148197 (code B ref 66993); Wed, 08 Nov 2023 12:24:01 +0000 Original-Received: (at 66993) by debbugs.gnu.org; 8 Nov 2023 12:23:34 +0000 Original-Received: from localhost ([127.0.0.1]:44144 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r0hao-000289-8b for submit@debbugs.gnu.org; Wed, 08 Nov 2023 07:23:34 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57150) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r0haj-00027q-4Z for 66993@debbugs.gnu.org; Wed, 08 Nov 2023 07:23:32 -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 1r0hZz-0004Z3-Lq; Wed, 08 Nov 2023 07:22:44 -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=iEjYf7/W+WOv9/lPT8FoprgHXrFRXJ7+qXXUvBWMt+8=; b=IBcUZjEpY5d5 jFAWaNsBV9/by8GDdJwmc5Q5l5Jr931GjOnQnS1Dk4PfDgB1h1XzgcWO2HU9TbguugW6kdMp9EOT3 tup5PJWMQkmKX2lw3brUV4E2BsxzETLr43vkCf/6zGvMnYptWKkWJPLLqCGlNUuU55ZyB6KwggamL O4ICz/GvNtzoBlDYPxpQyyvicQK4vaThQdwpzDzd2D11kZK3k8u2hxRHDYYiKsYPbxQEKLnAHoNm3 5VrRofAEedGADkADAWiTV24P552vGgyaHgNQ43UtDSItYuiIeYY8vGenNaVfGug8suK0addeuu7SO bHyxSroznM+SIN0Mw7ZaXg==; In-Reply-To: (message from Spencer Baugh on Tue, 07 Nov 2023 16:28:04 -0500) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:273977 Archived-At: > From: Spencer Baugh > Date: Tue, 07 Nov 2023 16:28:04 -0500 > > There are several features which will cause Emacs to frequently call > project-current, and therefore call project-remember-project, and > therefore sometimes call project--write-project-list whenever a new > project is seen. Why does project-current immediately writes the list to the file? Why cannot it keep the information in memory and write it only when the session ends, or at some random rare opportunity? > - project-uniquify-dirname-transform will call this for each new > buffer > > - project-mode-line will call this on mode-line update > > - My own private project-watch will call this based on file-notify > events. Ouch! this doesn't sound like a clean implementation to me. Writing something to a file from mode-line update? or when a new buffer is created? Why cannot we come up with a cleaner implementation? > There's no correct answer the user can give to ask-user-about-lock: > either way, one of the Emacs instances will have its project-list-file > update lost. So let's not even bother prompting the user: just do > nothing if project-list-file is currently locked. Sorry, that cannot be TRT. We cannot second-guess what the user wants to do in this case, and claim we are always right. > In the long run, the update doesn't actually get lost, because the > Emacs instance will probably make the same project-list-file update > again a few seconds later due to a later call to project-current. So > this doesn't lose anything. One more reason not to write the changes upon each change. Or at least detect that the file is locked, and schedule update at a later time, or something. Ideally, we should only write the file at exit.