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 15:20:39 +0200

On 08/11/2023 14:29, Eli Zaretskii wrote:
>> Date: Wed, 8 Nov 2023 02:24:13 +0200
>> From: Dmitry Gutov<[email-masked]>
>>
>> Anyway, maybe an implementation like this (totally untested)?
>>
>> Or the warning could be skipped entirely.
>>
>> diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
>> index a6426c08840..e544dfefa73 100644
>> --- a/lisp/progmodes/project.el
>> +++ b/lisp/progmodes/project.el
>> @@ -1719,7 +1719,9 @@ project--write-project-list
>>                                    (expand-file-name name)))))
>>                        project--list)
>>                (current-buffer)))
>> -      (write-region nil nil filename nil 'silent))))
>> +      (let ((noninteractive t))
>> +        (with-demoted-errors "Failed to save file list: %S"
>> +          (write-region nil nil filename nil 'silent))))))
> Isn't the cure worse than the disease? we are in effect disregarding
> all errors that prevent us from saving the file.

If ask-user-about-lock signaled a specific error rather than just (error 
...), we could catch only that one.

 > If those errors are
 > not important, why save the list to the file at all?

It's not hugely important that the list is up-to-date at all times. I 
haven't encountered the conflicts myself, though. Maybe some other 
solution could be preferable.

Michael's suggestion sounds pretty efficient, for example.