From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.bugs Subject: bug#58839: [Patch] Re: bug#58839: 29.0.50; project-kill-buffer fails when Eglot is running Date: Mon, 31 Oct 2022 14:35:19 +0000 Message-ID: <87k04ggixk.fsf@posteo.net> References: <87sfj8umwb.fsf@posteo.net> <87edur3lil.fsf@posteo.net> <87a65f3j40.fsf@posteo.net> <213f3549-de4e-25a7-5e27-d13893e557bc@yandex.ru> <87zgdfwkle.fsf@gmail.com> <8e31a89d-e35e-6dd0-a8e3-f0b9684c8bfa@yandex.ru> <87v8o3wgq1.fsf@gmail.com> <87ilk2x1si.fsf@gmail.com> <871qqq7l9p.fsf@posteo.net> <87eduqwekz.fsf@gmail.com> <87wn8invbx.fsf@posteo.net> <877d0iw8iq.fsf@gmail.com> <837d0hhlke.fsf@gnu.org> <46ff0065-5645-ef1e-2621-242fb6a73f98@yandex.ru> <87v8o0uxn5.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28590"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , manuel.uberti@inventati.org, 58839@debbugs.gnu.org, Dmitry Gutov To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Oct 31 15:36:21 2022 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 1opVtl-0007HE-01 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 31 Oct 2022 15:36:21 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1opVtT-000261-B9; Mon, 31 Oct 2022 10:36:03 -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 1opVtS-00025u-Hl for bug-gnu-emacs@gnu.org; Mon, 31 Oct 2022 10:36:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1opVtS-0007II-9o for bug-gnu-emacs@gnu.org; Mon, 31 Oct 2022 10:36:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1opVtR-0003wh-RD for bug-gnu-emacs@gnu.org; Mon, 31 Oct 2022 10:36:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 31 Oct 2022 14:36:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58839 X-GNU-PR-Package: emacs Original-Received: via spool by 58839-submit@debbugs.gnu.org id=B58839.166722693415132 (code B ref 58839); Mon, 31 Oct 2022 14:36:01 +0000 Original-Received: (at 58839) by debbugs.gnu.org; 31 Oct 2022 14:35:34 +0000 Original-Received: from localhost ([127.0.0.1]:41466 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1opVsz-0003vz-Hm for submit@debbugs.gnu.org; Mon, 31 Oct 2022 10:35:33 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:45545) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1opVsx-0003vm-CY for 58839@debbugs.gnu.org; Mon, 31 Oct 2022 10:35:32 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 7421F240108 for <58839@debbugs.gnu.org>; Mon, 31 Oct 2022 15:35:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1667226925; bh=MZlxZc0JHQ+eftJCj5ZFUoUGhtdFEKT4qSATCFIXgLU=; h=From:To:Cc:Subject:Autocrypt:Date:From; b=r9S5l5e0vT7u4w/pvBXfF/sdNg6awTU5fv2u6rUPn1BwuogGCVG/uarzUDnGUIgbE IhrJfmjnK7RnTBjZDikT/NTS2l2BxU2Lg71Tsw46BDCg2Z79i9RbZJ/sa420P+QlIN rKkEV3Q3xzXeQ7C7wyv6BIaFjz4EQppvGF0dyYieuL7+Nkl3yaaEqzLs0ba7QCEAUt /pP8KaugVnPYEy2MF/TgtvsIpvk4JbHdRG5i6FYS2mxXe1CstQJ1Tz3MBZgv2a3j79 +piBo/l5cEXlwSvaAutg6E94vfqOT/ta5uFSkTqJ2/yZBBa/6fJXzId1Inf0pGEkFK hGj7TWPBKn24w== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4N1G086zMtz9rxF; Mon, 31 Oct 2022 15:35:20 +0100 (CET) In-Reply-To: <87v8o0uxn5.fsf@gmail.com> ("=?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?="'s message of "Mon, 31 Oct 2022 09:53:50 +0000") Autocrypt: addr=philipk@posteo.net; prefer-encrypt=nopreference; keydata= mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB 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: , Original-Sender: "bug-gnu-emacs" Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:246693 Archived-At: Jo=C3=A3o T=C3=A1vora writes: > Dmitry Gutov writes: > >> Anyway, if we do decide to flip the switch, it should be through >> project-kill-buffer-conditions, so the user can make a different >> choice through customization. > > project-kill-buffer-conditions doesn't work, I've tried it, it has this > fundamental-mode thing there that makes it impossible. Supposedly it is > there to serve some purpose that no-one seems to be able to find a > argumentative basis for. The condition can be written entirely, if we are willing to accept a breaking change. In the case of `project-kill-buffer', this ought to be acceptable if fewer buffers are killed. > It's quite clear that _some_ non-file-visiting buffers can be considered > as belonging to a project's working set. But it's very very easy to > come up with many that cannot be considered so. I have to admit that I am more and more inclined to make the list a opt-in thing, where we explicitly mark those major modes that are tied to a project. > Because "killing buffers" is a destructive operation, being greedy here > is a really bad design decision, as it catches an arbitrary number of > unsuspecting extensions off-guard, which have been using earmuffed > buffers for many years.=20=20 > > All in all, it's like you're making a gun that only backfires 5% of the > time. > > In the little time I've used this feature since the start of this > discussion I have discovered it backfires no small number of occasions: > Eglot, CIDER, *scratch*, *ielm*, *sly-scratch*, *Completions*,... Heck > even *ibuffer* itself is targeted by this. > > Project-kill-buffers is off. Its intention pretty useful, but its > implementation is a blunder. The root cause is this overgreedy > project-buffers. When "killing a project" the echo area asks me if I > want to kill a number of buffers that I didn't even know I had, because > of hidden buffers. This cannot be logical and the only way the > "argument can be made both ways" is out of stubborness. > > JSONRPC's buffers are hidden implementation details: the argument that > they are somehow under the responsibility of project.el just because it > can see them through (buffer-list) is blind tiranny. > > The mini-languages invented in project-kill-buffers-conditions and > project-ignore-buffer-conditions are abominations. If project-buffers > just been conservatively designed, we'd need nothing more than the > existing hooks for the exceptions. *earmuffed* buffers interested in > opting in could declare if it belonged or not in one line.=20=20 What existing hooks? > Just like > > diff --git a/lisp/vc/vc-dispatcher.el b/lisp/vc/vc-dispatcher.el > index dc3ed52650..718bebc7cd 100644 > --- a/lisp/vc/vc-dispatcher.el > +++ b/lisp/vc/vc-dispatcher.el > @@ -179,6 +179,7 @@ vc-setup-buffer > (let ((camefrom (current-buffer)) > (olddir default-directory)) > (set-buffer (get-buffer-create buf)) > + (setq-local project-owned t) > (let ((oldproc (get-buffer-process (current-buffer)))) > ;; If we wanted to wait for oldproc to finish before doing > ;; something, we'd have used vc-eval-after. > > To name one. The above is just the converse of the solution proposed by > Philip before. I would be fine with this in principle, my only worry is backwards compatibility for those who use project.el from ELPA. > Anyway, I've now suggested and presented 2 actually tested, actually > working patches to project.el. I don't have anything more to add. > > Jo=C3=A3o