From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#72019: [PATCH] Add project argument to project-kill-buffers Date: Wed, 10 Jul 2024 17:32:56 +0300 Message-ID: <8634ohnwpz.fsf@gnu.org> References: <86ed81o5oc.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40080"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 72019@debbugs.gnu.org To: Spencer Baugh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jul 10 16:34:21 2024 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 1sRYOh-000ABd-Ve for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 10 Jul 2024 16:34:20 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sRYOM-0005OV-RX; Wed, 10 Jul 2024 10:33:58 -0400 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 1sRYOK-0005OF-Tt for bug-gnu-emacs@gnu.org; Wed, 10 Jul 2024 10:33:57 -0400 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 1sRYOK-0007Nf-J6 for bug-gnu-emacs@gnu.org; Wed, 10 Jul 2024 10:33:56 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sRYOP-0004V7-N0 for bug-gnu-emacs@gnu.org; Wed, 10 Jul 2024 10:34:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 10 Jul 2024 14:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72019 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 72019-submit@debbugs.gnu.org id=B72019.172062203917292 (code B ref 72019); Wed, 10 Jul 2024 14:34:01 +0000 Original-Received: (at 72019) by debbugs.gnu.org; 10 Jul 2024 14:33:59 +0000 Original-Received: from localhost ([127.0.0.1]:56888 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sRYOM-0004Up-Fr for submit@debbugs.gnu.org; Wed, 10 Jul 2024 10:33:59 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:57644) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sRYO6-0004UG-4w for 72019@debbugs.gnu.org; Wed, 10 Jul 2024 10:33:56 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sRYNu-0007Fw-8a; Wed, 10 Jul 2024 10:33:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=mihEuHutWlJMrh0ChnV7MljSC718MF81Jm6Fd0U8p3Y=; b=qPf1aZNERHpk77/E7jGY CyHZXwzHUHyV3b4WXzYdrNd0QQxTPzQ6EEKelFggImhkXMyM7NWjwBnFC6RWhcNpvyNbuDzbaVuiq fko795bzSI20seGwxIxZQH8zZKaVbQfJmbTbKzp2nFK4h8lZtHsSMYgo1hRfLCkVOhgMCXVRPHC7c OmMfUhFbYFMVTQGuv8XIWH7Z2COxENLHXU3yDoJ9XjLu+txZMBERKjVcLuoOO59zEjhBEpohpDZfa QjClW3BsTP1LUDu0j4+NvaR+s6s1AV1igtlQaSdSgD7wWtNfZgYhP+PHMpvEYTTGjvk7nfl0/TnR4 n4zup8akBthsrA==; In-Reply-To: (message from Spencer Baugh on Wed, 10 Jul 2024 09:27:06 -0400) 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:288680 Archived-At: > From: Spencer Baugh > Date: Wed, 10 Jul 2024 09:27:06 -0400 > Cc: 72019@debbugs.gnu.org > > On Wed, Jul 10, 2024, 7:19 AM Eli Zaretskii wrote: > > > From: Spencer Baugh > > Date: Tue, 09 Jul 2024 14:31:11 -0400 > > > > Previously, project-kill-buffers always called (project-current t). A > > Lisp program could change what project project-kill-buffers operated > > on by binding project-current-directory-override. However, in some > > edge cases (for example, if the project was deleted between looking it > > up and calling project-kill-buffers) this might fail to detect a > > project, and so (project-current t) would prompt the user. > > > > To avoid this, accept the project to kill buffers for as an argument. > > That sounds like sweeping some minor bug under the carpet, or worse. > Why is it a good idea to silently second-guess what is TRT in these > marginal cases? Up front, I'd say asking the user is a safer bet. > > Suppose if some Lisp program runs (project-current t) to select a project to operate on, then does some > things, then runs project-kill-buffers. The p-k-b call should never prompt for a project again - it's intended to > operate on the project that was already selected. If the project that was already selected has disappeared, an > error is better than a confusing second prompt which might lead to the user selecting another different > project and killing all the buffers in that project. If the Lisp program wants to catch that error, it can. In my book, prompting the user with the like of Project FOO disappeared, continue killing its buffers? is better than silently doing the (potentially) wrong thing. IOW, when something that isn't supposed to happen did happen, let the human figure out the mess. Relying on project.el to signal an error is better, but might not be the best idea, either, because the error message is likely to be confusing and/or non-specific.