GNU bug report logs - #66993
[PATCH] project.el: avoid asking user about project-list-file lock

Previous Next

Package: emacs;

Reported by: Spencer Baugh <sbaugh <at> janestreet.com>

Date: Tue, 7 Nov 2023 21:29:02 UTC

Severity: normal

Tags: patch

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Spencer Baugh <sbaugh <at> janestreet.com>
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: 66993 <at> debbugs.gnu.org
Subject: bug#66993: [PATCH] project.el: avoid asking user about project-list-file lock
Date: Wed, 08 Nov 2023 10:25:07 -0500
Dmitry Gutov <dmitry <at> gutov.dev> 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.




This bug report was last modified 1 year and 268 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.