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: Wed, 02 Nov 2022 14:00:50 +0000 Message-ID: <87cza5sbfx.fsf@gmail.com> References: <87sfj8umwb.fsf@posteo.net> <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> <787a4362-7ff5-7dbb-9118-16e4bee5f328@yandex.ru> <87edunvhf2.fsf@gmail.com> <6d4d9e72-1bae-4d64-b7c1-c2b9c11e396f@yandex.ru> <6c9811d7-ad05-2d2d-0c34-9b4c1fa09305@yandex.ru> <87a659u7vo.fsf@gmail.com> <8735b1bvnz.fsf@posteo.net> <87mt99spsk.fsf@gmail.com> <87r0ylafdl.fsf@posteo.net> 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="7284"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , manuel.uberti@inventati.org, 58839@debbugs.gnu.org, Dmitry Gutov To: Philip Kaludercic Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Nov 02 15:16:36 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 1oqEXk-0001dh-4d for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 02 Nov 2022 15:16:36 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oqEHk-0003As-E8; Wed, 02 Nov 2022 10:00:04 -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 1oqEHj-0003Aj-6j for bug-gnu-emacs@gnu.org; Wed, 02 Nov 2022 10:00:03 -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 1oqEHi-00074e-LU for bug-gnu-emacs@gnu.org; Wed, 02 Nov 2022 10:00:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oqEHi-0005fv-Gw for bug-gnu-emacs@gnu.org; Wed, 02 Nov 2022 10:00: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: Wed, 02 Nov 2022 14:00: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.166739758921769 (code B ref 58839); Wed, 02 Nov 2022 14:00:02 +0000 Original-Received: (at 58839) by debbugs.gnu.org; 2 Nov 2022 13:59:49 +0000 Original-Received: from localhost ([127.0.0.1]:46876 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oqEHU-0005f1-QS for submit@debbugs.gnu.org; Wed, 02 Nov 2022 09:59:49 -0400 Original-Received: from mail-wm1-f49.google.com ([209.85.128.49]:36800) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oqEHS-0005dv-3n for 58839@debbugs.gnu.org; Wed, 02 Nov 2022 09:59:47 -0400 Original-Received: by mail-wm1-f49.google.com with SMTP id c3-20020a1c3503000000b003bd21e3dd7aso1354171wma.1 for <58839@debbugs.gnu.org>; Wed, 02 Nov 2022 06:59:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:user-agent :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=c+gtgLx7+FM25kMavdsdyEKPs4qpG3svZJ0epApx19Y=; b=aL7K7IvOBFn3vTVHHNC5NpBQgJA7WQ9QfkKBZc060Jy1aRY8j4kTFIy4r6t/k/m2l+ SAZuUB8ITlv4cWmHWSgeuUX7wVMF6tw8Zjd7rC1h0CP5/B1ure/dy71wf0KP0/41DSNY 10PUekrMwhtNdG7hqFQ5HZxqY+/0dOw/FZ7clttHmPjxuZbcXJyG3wN+Kwz/qNv894hd goM4L4FamNDZqq5a/tsggiGJVxVENPVrm0lT0+wQ/fp84Omgl+lJYMYX4cH1nYjNYXMl KfsAhq2cKXscL9rmzrwgSwMFue4RtOMT103XMMXNzqZxKywVQuQW3tjKy70mQa+RWGKz dmhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:user-agent :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=c+gtgLx7+FM25kMavdsdyEKPs4qpG3svZJ0epApx19Y=; b=jA9yifs21r6C49FpS3n+1b9G+/OZ6ykepNIQ7FasgACwaXC3AjILhlR0+9RuQ9X6SL u7iyW0qLRpnZ+jT5bbZHRxvDYHVtmwBNYUAK6m6X7M9mvcwfzMdPjLKV685PeD6DKUHS 0rXdaVKj7lUuLA9chnnmV88zdMKTZdT3XuY85YK0vq+9DKjYk4Pd/0M420NeBNhsAEgB chcdksKNYKbpDnr7MbKcGs3uFlleye06UF4FDIvi4sLgDj3MYQsPnsrhgPXEoW4y3pVB I/8aB36WJ/s/NtHrsIoNkRMs8te8q1NKYFB16wcrzv/rK0yi0W9rkRbW9KYCM/qSfhe5 76Sw== X-Gm-Message-State: ACrzQf147eB3XtRA7MAVtb3FoIT/JBbQtYOa1TBN+RJV1g9nZ+24VGi2 NrJiilFSmh5wxTJdvx33+WU= X-Google-Smtp-Source: AMsMyM73/fW+z2EwJD0t/61PriZArr5Obt9SHJ/SHbND+4C64oafQ7zKOVBSbY+iSWDWxXVVTEcfzw== X-Received: by 2002:a05:600c:3550:b0:3cf:4c20:5856 with SMTP id i16-20020a05600c355000b003cf4c205856mr15911295wmq.188.1667397579806; Wed, 02 Nov 2022 06:59:39 -0700 (PDT) Original-Received: from krug ([87.196.80.27]) by smtp.gmail.com with ESMTPSA id b6-20020adfee86000000b0023677fd2657sm12931313wro.52.2022.11.02.06.59.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Nov 2022 06:59:39 -0700 (PDT) In-Reply-To: <87r0ylafdl.fsf@posteo.net> (Philip Kaludercic's message of "Wed, 02 Nov 2022 09:13:10 +0000") 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:246869 Archived-At: Philip Kaludercic writes: > Jo=C3=A3o T=C3=A1vora writes: > >> Philip Kaludercic writes: >> >>>> Not sure. This started has a report of hidden buffer being incorrectly >>>> killed by project.el.=20=20 >>> >>> The issue that was reported was that Eglot/jsonrpc raised an error that >>> broke `project-kill-buffer'. This could have also all been solved by >>> wrapping a `with-demoted-errors' around `kill-buffer'. >> >> No. It couldn't. The error is there to show you among other things >> that the LSP connection isn't being shut down correctly, which is not >> something to paper over. And even if you did paper over the error, you >> would break eglot-autoshutdown. I've explained that at least 3 times >> already in the beginning of this discussion. > > That was not my concern, my concern was that project-kill-buffer > broke. I continue to not see a reason why project.el should be > considered broken because of this, and not jsonrpc/eglot. It was always broken since the way it was created. Eglot's precedes it, I've also explained this. You can't kill a internal hidden buffer just because you can see it anymore than you unintern some "--" symbol in obarray simply because you can see it and don't like its inelegant name, or you think it's taking too much RAM. I can't really explain this any other way. > This is probably best solved by reading code. Can you point me to a few > functions/section/etc. that would help me clarify the situation. > I haven't made up my mind, I am just trying to understand all > perspectives, and get a better overview over the issue. OK, one last time. First, the above principle of encapsulation has nothing to do with LSP or Eglot or Jsonrpc. Specifically in Eglot, as I already explained, eglot.el and jsonrpc.el colaborate so that jsonrpc.el holds a network process to communicate with the LSP server. It uses a buffer for more convenient and efficient parsing of messages. That buffer is out of bounds for Eglot (and anyone else). Eglot doesn't know or care that a buffer is being used, it only actuate on the handle using operations of jsonrpc.el's API. According to user options, Eglot provides controlled shutdown and reconnection using these operations. All of this has worked for a long time and predates project.el's buffer collection/killing/switching logic. If you or some Lisp package finds and destroys the hidden implementation detail, all the above is broken. Therefore packages like project.el that do it are buggy in that regard.