From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= 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 09:53:50 +0000 Message-ID: <87v8o0uxn5.fsf@gmail.com> 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> 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="28020"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , 58839@debbugs.gnu.org, manuel.uberti@inventati.org, philipk@posteo.net To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Oct 31 10:53:22 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 1opRTt-00076z-Pf for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 31 Oct 2022 10:53:21 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1opRTg-00067N-BE; Mon, 31 Oct 2022 05:53:08 -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 1opRTa-000679-R9 for bug-gnu-emacs@gnu.org; Mon, 31 Oct 2022 05:53: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 1opRTa-00060o-KD for bug-gnu-emacs@gnu.org; Mon, 31 Oct 2022 05:53:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1opRTa-0004TK-7L for bug-gnu-emacs@gnu.org; Mon, 31 Oct 2022 05:53:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 31 Oct 2022 09:53:02 +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.166720997217173 (code B ref 58839); Mon, 31 Oct 2022 09:53:02 +0000 Original-Received: (at 58839) by debbugs.gnu.org; 31 Oct 2022 09:52:52 +0000 Original-Received: from localhost ([127.0.0.1]:39586 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1opRTP-0004Sv-WD for submit@debbugs.gnu.org; Mon, 31 Oct 2022 05:52:52 -0400 Original-Received: from mail-wr1-f47.google.com ([209.85.221.47]:34635) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1opRTM-0004Sf-R5 for 58839@debbugs.gnu.org; Mon, 31 Oct 2022 05:52:50 -0400 Original-Received: by mail-wr1-f47.google.com with SMTP id k8so15193314wrh.1 for <58839@debbugs.gnu.org>; Mon, 31 Oct 2022 02:52:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2F0/j7sytqCwyqPb67kDkK0cw5qtV+3clP5lHm1eOA8=; b=LacIoYt+c0wmFz7oDopBo2VrCKfsKdaNaM+wLPG0jiAVHjTGr93Gsg4DfUHR3I2jv+ stFEEpqwXpJhebVqTXiWyCirbE9GaseauC5HWUgnMlvW7muRA4roKR113yub6VgZQXbj Wr38mnO0ta9AvbTdV+b0eCcGqiwvghj6reZ4XBfxg9SNQ6sh803AukrIQz6l+UlCTFJd 5J3ewp/WjXDgzagyRHwhknXRjbUiM+PgmhZIOEXlqncs02pHm5h26H7hElLa4l29PMs8 Q1qqvmB2UwdxCl4yf7UpMY9lvf5wVHFjPP6viMpwnLZ7yYDszhaKRhdqOFLcS5MJ+Ncf w8jQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=2F0/j7sytqCwyqPb67kDkK0cw5qtV+3clP5lHm1eOA8=; b=5oxEnizm9gElPv9PiRPBbypSaJRR/y1GOdpgv8yxnHJ1rQB46mX66ysblfdmG8xgkU A7rPhkI20FkcNCy8+ohLdLoRZCT8yisVyNVGy6Uytq9gxbtCxGAIZYWeOyzH/KjeOZ0Z 2VRu7ZvsHxYsSMJ6yOmAQCbYLvwULDxYOwXpV1h7IlwpRQ7pn88aMOTERAqF/ucGBfwe t0MDoTOpVBAJexLqKxTcQipAc091a7yW3otojb7ZZ2aU6QoAQXP97dR2/Mv4FqgBd/Gd 8wehgQ1dft/u8TAZGym4s6o79EFXoDYpy/iuYfrmZJl4vLhAJut/6q+N5znRBn2mpsQd bb6w== X-Gm-Message-State: ACrzQf2d0AGz+op6QNDQHhuawBx9dkC4153Z0+VMO98ViuZblAodfilf 1MmEWJtq6GjNHmboFMGMuOo= X-Google-Smtp-Source: AMsMyM7xBkeZ9tN/eS4yv8T1aNB9UZ1TGy0/aVWnUZaYFhz4sCacHME3D11Q+fBrqcBbtKOHE5198Q== X-Received: by 2002:a05:6000:1f1a:b0:236:ce27:230a with SMTP id bv26-20020a0560001f1a00b00236ce27230amr1868531wrb.469.1667209962631; Mon, 31 Oct 2022 02:52:42 -0700 (PDT) Original-Received: from krug (87-196-74-89.net.novis.pt. [87.196.74.89]) by smtp.gmail.com with ESMTPSA id m17-20020a5d56d1000000b0022cc6b8df5esm6621063wrw.7.2022.10.31.02.52.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Oct 2022 02:52:42 -0700 (PDT) In-Reply-To: <46ff0065-5645-ef1e-2621-242fb6a73f98@yandex.ru> (Dmitry Gutov's message of "Sun, 30 Oct 2022 17:58:18 +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: , Original-Sender: "bug-gnu-emacs" Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:246673 Archived-At: 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. 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. 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. 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. 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