From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Spencer Baugh Newsgroups: gmane.emacs.bugs Subject: bug#66993: [PATCH] project.el: avoid asking user about project-list-file lock Date: Wed, 08 Nov 2023 10:25:07 -0500 Message-ID: References: <5aec9d1b-f005-3870-f436-ecc01fc27027@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="7985"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 66993@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Nov 08 16:25:43 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 1r0kR5-0001ry-Dn for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 08 Nov 2023 16:25:43 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r0kQn-0005tQ-AS; Wed, 08 Nov 2023 10:25:25 -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 1r0kQm-0005tC-0k for bug-gnu-emacs@gnu.org; Wed, 08 Nov 2023 10:25:24 -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 1r0kQl-0001DT-Os for bug-gnu-emacs@gnu.org; Wed, 08 Nov 2023 10:25:23 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r0kRO-00043L-3h for bug-gnu-emacs@gnu.org; Wed, 08 Nov 2023 10:26:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Spencer Baugh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 08 Nov 2023 15:26:02 +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.169945715415565 (code B ref 66993); Wed, 08 Nov 2023 15:26:02 +0000 Original-Received: (at 66993) by debbugs.gnu.org; 8 Nov 2023 15:25:54 +0000 Original-Received: from localhost ([127.0.0.1]:46144 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r0kRF-00042z-K9 for submit@debbugs.gnu.org; Wed, 08 Nov 2023 10:25:53 -0500 Original-Received: from mxout5.mail.janestreet.com ([64.215.233.18]:51511) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r0kRD-00042h-Je for 66993@debbugs.gnu.org; Wed, 08 Nov 2023 10:25:52 -0500 In-Reply-To: <5aec9d1b-f005-3870-f436-ecc01fc27027@gutov.dev> (Dmitry Gutov's message of "Wed, 8 Nov 2023 15:58:25 +0200") 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:273993 Archived-At: Dmitry Gutov writes: > On 07/11/2023 23:28, Spencer Baugh wrote: >> - project-mode-line will call this on mode-line update >> - My own private project-watch will call this based on file-notify >> events. >> If a user has multiple Emacs instances open using one or more of >> these >> features, it's fairly easy for both of the Emacs instances to see a >> new project at the same time. In that case, they'll both call >> project--write-project-list at the same time, which will clash and run >> ask-user-about-lock. This will happen frequently if the user is often >> looking at new projects. > > Hmmm. What happens if we just show two buffers from different projects > in the same Emacs instance? Do the mode-line refreshes trigger the > changes in the list of remembered projects and subsequent writes to > disk (e.g. alternating the "current" project between these two, > potentially many times a second)? > > If so, we'll need a way to inhibit these updates, at least from the > mode-line formatter. Oh, I spoke too soon, perhaps - when MAYBE-PROMPT=nil in project-current, we don't call project--write-project-list. So the issue won't actually happen with project-mode-line or project-uniquify-dirname-transform. It will only happen with either: - Concurrent calls to regular project commands (e.g. project-async-shell-command or project-compile) from two Emacsen, since those set MAYBE-PROMPT=t - Concurrent calls to project-remember-project/project-forget-project and similar functions. (This is what my project-watch does, since it calls project-remember-project when a new project shows up in a directory, and if I'm unlucky that will be at the same time as another Emacs instance.) I guess that makes it less of a critical issue, but it still seems to me that this is worth fixing.