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:36:12 -0500 Message-ID: References: <83sf5g1lko.fsf@gnu.org> <9d460f36-6035-da54-3abc-12171ac8977f@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="27012"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , 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:36:38 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 1r0kbe-0006lU-Mp for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 08 Nov 2023 16:36:38 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r0kbR-0000Z0-Py; Wed, 08 Nov 2023 10:36: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 1r0kbP-0000Yn-KP for bug-gnu-emacs@gnu.org; Wed, 08 Nov 2023 10:36:23 -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 1r0kbP-0003Fb-CR for bug-gnu-emacs@gnu.org; Wed, 08 Nov 2023 10:36:23 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r0kc1-0004Ki-Ue for bug-gnu-emacs@gnu.org; Wed, 08 Nov 2023 10:37:01 -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:37: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.169945781816647 (code B ref 66993); Wed, 08 Nov 2023 15:37:01 +0000 Original-Received: (at 66993) by debbugs.gnu.org; 8 Nov 2023 15:36:58 +0000 Original-Received: from localhost ([127.0.0.1]:46157 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r0kby-0004KQ-HI for submit@debbugs.gnu.org; Wed, 08 Nov 2023 10:36:58 -0500 Original-Received: from mxout5.mail.janestreet.com ([64.215.233.18]:56307) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r0kbw-0004KE-7E for 66993@debbugs.gnu.org; Wed, 08 Nov 2023 10:36:56 -0500 In-Reply-To: <9d460f36-6035-da54-3abc-12171ac8977f@gutov.dev> (Dmitry Gutov's message of "Wed, 8 Nov 2023 15:26:11 +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:273995 Archived-At: Dmitry Gutov writes: > On 08/11/2023 14:22, Eli Zaretskii wrote: >>> 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? > > It could indeed be written from kill-emacs-hook, or just the next time > an opportunity presents. I like the idea of writing the file from kill-emacs-hook. That seems cleaner than writing the file at random times. Alternatively, I suppose if we had a periodic timer that writes the file, that timer could also do the somewhat useful maintenance work of calling project-forget-zombie-projects. Or maybe we could just call that from kill-emacs-hook too? Just a thought. Separately: Currently, even without any locking issues, if there are multiple Emacsen then project-list-file just contains the project--list of the last one to write. So they're constantly clobbering each others' added and removed projects. If we do the writes more rarely, then we could try to read project-list-file first and add or remove the projects that were added or removed during the life of this Emacs instance, instead of just blindly writing out project--list. Then if there are multiple Emacsen around, their changes to project--list won't clobber each other, they'll just be cleanly merged. Does that sound reasonable? Either way, I can implement this.