Subject: Re: bug#66993: [PATCH] project.el: avoid asking user about project-list-file lock

From: Dmitry Gutov <[email-masked]>
Date: Wed, 8 Nov 2023 23:14:36 +0200

On 08/11/2023 17:25, Spencer Baugh wrote:
> - Concurrent calls to regular project commands
>    (e.g. project-async-shell-command or project-compile) from two
>    Emacsen,
>    since those set MAYBE-PROMPT=t

Since they are usually triggered manually, the user will have to try 
hard to launch them at the same time.

> - 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.)

Note that if your code triggers the rewrites of the project-list file 
frequently enough so that the conflicts happen, doing more work during 
that time (e.g. reading, re-serializing, and then writing the file) 
might actually cause some disk/CPU usage increase. (Although if the 
conflicts happen due to synchronous firing of inotify watches in 
parallel Emacs instances, then probably not.)

BTW, the merging algorithm to use it is not very obvious (especially if 
we're going to do that in kill-emacs-hook). E.g. if one instance removed 
a project from history and another did not, we probably want to have it 
removed in the "merged" version.

> I guess that makes it less of a critical issue, but it still seems to me
> that this is worth fixing.

I'm glad to hear that the current design is working fine for the 
expected usage scenarios, but indeed, why not make it more resilient. If 
we don't sacrifice too much of something else.