From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#66993: [PATCH] project.el: avoid asking user about project-list-file lock Date: Wed, 8 Nov 2023 02:24:13 +0200 Message-ID: <7089f7f2-3000-75fe-768a-dd12d979d81c@gutov.dev> References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14776"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 To: Spencer Baugh , 66993@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Nov 08 01:25:48 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 1r0WOA-0003br-6R for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 08 Nov 2023 01:25:47 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r0WNw-0002ob-Uf; Tue, 07 Nov 2023 19:25:33 -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 1r0WNn-0002oH-WE for bug-gnu-emacs@gnu.org; Tue, 07 Nov 2023 19: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 1r0WNn-0001Qu-Nk for bug-gnu-emacs@gnu.org; Tue, 07 Nov 2023 19:25:23 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r0WOP-00056c-IJ for bug-gnu-emacs@gnu.org; Tue, 07 Nov 2023 19:26:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 08 Nov 2023 00:26: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.169940310319544 (code B ref 66993); Wed, 08 Nov 2023 00:26:01 +0000 Original-Received: (at 66993) by debbugs.gnu.org; 8 Nov 2023 00:25:03 +0000 Original-Received: from localhost ([127.0.0.1]:43758 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r0WNT-00055A-Az for submit@debbugs.gnu.org; Tue, 07 Nov 2023 19:25:03 -0500 Original-Received: from out3-smtp.messagingengine.com ([66.111.4.27]:45797) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r0WNP-00054X-PR for 66993@debbugs.gnu.org; Tue, 07 Nov 2023 19:25:02 -0500 Original-Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 1A2105C00A6; Tue, 7 Nov 2023 19:24:16 -0500 (EST) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Tue, 07 Nov 2023 19:24:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm2; t= 1699403056; x=1699489456; bh=WFjNGQp5wP+GHv+Ereg0FwS3zBVKSJ03vy9 Qa767QzU=; b=i3gMzJ9DxCKDi4sLCMgW+G6XiXAncr+YQcdxh+UTZLRQ6J9CQWh EW3vwqNv6zBzYNqlQGGW/lxgDOBEiat72KCT9NlxS1DFfWGLse5ufQ1sRu3Y+OgK kS9W7jJ1IHrq4bH+1OVm+RGOqjNaPyBAORuz5MCcClNUeMHbUPtA0es75OZQMGLb nvYjlqcq5P/om8tIXk7bmwD5QtGBdEmfoUjLvsBWrg1ZcsDIQQJukAKS/yIhALcu C/S7vzjTBb+mY4aUYuivI409AOnOvvJL0tNoIjOrHyDzG3S/WB8xtc2V9NbShKwA RfZpX2vr5g2yDNPAohSR8jXZ6YTUjCPuIuw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1699403056; x= 1699489456; bh=WFjNGQp5wP+GHv+Ereg0FwS3zBVKSJ03vy9Qa767QzU=; b=H 8pFkS/K5lVpUH7r4shnXYWvkNefgglXRl4TZdeiUJLXTmT3n+Fvv331n6+yYuzBW 7F0us0hZ9HhcU22+KhP6g5Zuu7dGEaeUwnNyR8P9fFhtzin7HUBq7pigmoHQuzIf KnIzuxLdniWZO24LZWt7NH2P6Lu4lCu9b5KSO2tuHwHQjr3T5NnhytIMLeFoTArh /oygEAVKl3X5RodDDOMXU+LOKvRWQrioqM42LDOlzVjHGYIslal/HLQIeatliJ6g 0ZSaZ8yT1Bno+S1d8gvFol+SRXsBR32eYz5lNLx32Uvg7h0ljL96vEPS/y5WUX/z IksmvmI8muxPQzK+cW5ng== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedruddukedgvdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvfhfhjggtgfesthejredttdefjeenucfhrhhomhepffhmihht rhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrdguvghvqeenucggtffrrghtth gvrhhnpeeghedthedujeeiteeutddtjeekheejteeukeehffdutdejuedvfeevueeviedu udenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegumh hithhrhiesghhuthhovhdruggvvh X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 7 Nov 2023 19:24:14 -0500 (EST) Content-Language: en-US In-Reply-To: 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:273954 Archived-At: On 07/11/2023 23:28, Spencer Baugh wrote: > - project-mode-line will call this on mode-line update Hopefully this will never result in writes to disk made more often than once per user command, or buffer switch, etc. > - (write-region nil nil filename nil 'silent)))) > + ;; If project-list-file is locked by some other Emacs, fail to > + ;; write rather than prompting the user. > + (ignore-error file-locked > + (cl-letf (((symbol-function 'ask-user-about-lock) > + (lambda (file opponent) > + (signal 'file-locked (list file opponent))))) > + (write-region nil nil filename nil 'silent)))))) I wonder if all cl-letf uses like this will survive native compilation, for example. Or will break over time due to internal changes in the function. 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)))))) ;;;###autoload (defun project-remember-project (pr &optional no-write)