all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "João Távora" <joaotavora@gmail.com>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: Philip Kaludercic <philipk@posteo.net>,
	Manuel Uberti <manuel.uberti@inventati.org>,
	58839@debbugs.gnu.org
Subject: bug#58839: [Patch] Re: bug#58839: 29.0.50; project-kill-buffer fails when Eglot is running
Date: Sat, 29 Oct 2022 02:39:34 +0100	[thread overview]
Message-ID: <87v8o3wgq1.fsf@gmail.com> (raw)
In-Reply-To: <8e31a89d-e35e-6dd0-a8e3-f0b9684c8bfa@yandex.ru> (Dmitry Gutov's message of "Sat, 29 Oct 2022 04:09:13 +0300")

Dmitry Gutov <dgutov@yandex.ru> writes:

> Sorry, I don't have Eglot checked out, or the time to test out the
> patch.

If you missed it, Eglot has been merged in lisp/progmodes/eglot.el.
There's not much point in testing that your patch: I can tell you right
away it doesn't work.

> I suppose. But the current criterion depends on the value of
> default-directory, and that makes it a match.

This criterion is wrong.  It makes mistakes.  But a criterion that is
"default-directory and is not hidden", though probably still not ideal,
but is definitely better.

>> If you agree that
>> there are such cases, then it should become clear that the buffer in
>> question must be at the top of that list.
>
> I'm not sure. Intuitively, I'd say that this buffer belongs to the
> project because it "services" the project. But if it were to work for
> several projects at the same time, I suppose I could say it doesn't
> belong to any particular one.

It indeed indirectly services just that one project: but it's also just
another object.  Eglot has lots of objects, variables etc., that
"service the project" and project.el fortunately isn't crazy to to touch
them.  The buffer in question is an implementation detail of jsonrpc.el.
It's not a buffer of interest in any way for the user or project.el's
manipulations.  And it's only a buffer because buffer's are Emacs'
common way of communicating with external entities, and jsonrpc.el uses
that technique.  But it could use some other way, say another
process-filter or function calls into C code of a dynamic library.
There would also be objects that indirectly "service" the project, but
not buffers.

>> There are more hints that the concept of "buffer belonging to a project"
>> was not fully thought through, even in cases unrelated to this bug
>> report.
>> * Take the *scratch* buffer.  It has a default-directory.  Does this
>>    also make *scratch* belong to a project?  It doesn't make any sense to
>>    me that it would.  Yet it is caught by project-buffers.
>
> *scratch* is not that special - you can create similar buffers at
>  will. So there are two ways of looking at that question. One can
>  create a "scratch" for a project, and it will be part of that
> project.
>
> If "~" (the usual value of default-directory in the original
> *scratch*) belongs to a project, then *scratch* also does.

I M-x cd in *scratch* all the time.  It's a global scratch pad,
now accessible via scratch-buffer everywhere.

>> * project-buffers also catches the one-time *Completions* buffers, the
>>    kind produced by hitting TAB after C-x p b.  If you type C-x p b
>>    again, it quite comically offers the stale *Completions* buffer as a
>>    candidate to switch to.
>
> We could make an exception for that too.
>
>> But back to *scratch*.  Somehow *scratch* is not killed by M-x
>> project-kill-buffers.  I think it's because it doesn't have a
>> buffer-file-name.  But then neither does the Eglot/Jsonrpc's "background
>> buffers"!  It seems it is being targeted merely because it uses
>> fundamental-mode, a most reasonable mode to use for exchanging messages
>> via standard streams.
>> I guess this means that the hack below is enough to fix the issue,
>> but
>> it is also decidedly silly.
>
> It's not much better than adding a function to
> kill-buffer-query-functions that returns nil. And/or behaves
> accordingly to eglot-autoshutdown.

You should think your solution through before comparing with the ones
provided so far, which have been tested.  Where in the source code would
you even set kill-buffer-query-functions?  Eglot code in jsonrpc.el??
Not to mention duplicating the eglot-autoshutdown check in unrelated
places is pretty ugly.

>> So please consider fixing this in project.el.  As Manuel pointed out,
>> the venerable ibuffer.el's ibuffer-kill-filter-group also kills project
>> buffers and handles this whole thing very well.  We should just take a
>> hint from it.
>
> I'm unable to find that message.

In the original conversation: 

https://github.com/joaotavora/eglot/discussions/822#discussioncomment-2053395





  reply	other threads:[~2022-10-29  1:39 UTC|newest]

Thread overview: 86+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-28 12:56 bug#58839: 29.0.50; project-kill-buffer fails when Eglot is running Philip Kaludercic
2022-10-28 17:17 ` bug#58839: [Patch] " João Távora
2022-10-28 17:28   ` Philip Kaludercic
2022-10-28 17:36     ` João Távora
2022-10-28 18:14     ` Dmitry Gutov
2022-10-28 18:20       ` Philip Kaludercic
2022-10-28 18:30         ` João Távora
2022-10-28 18:40         ` Dmitry Gutov
2022-10-29  0:15           ` João Távora
2022-10-29  1:09             ` Dmitry Gutov
2022-10-29  1:39               ` João Távora [this message]
2022-10-29 11:27                 ` Dmitry Gutov
2022-10-29 12:16                   ` João Távora
2022-10-29 14:32                     ` Philip Kaludercic
2022-10-29 20:38                       ` João Távora
2022-10-29 22:01                         ` Philip Kaludercic
2022-10-29 22:49                           ` João Távora
2022-10-30  6:28                             ` Eli Zaretskii
2022-10-30 12:40                               ` João Távora
2022-10-30 15:58                               ` Dmitry Gutov
2022-10-30 16:39                                 ` Eli Zaretskii
2022-10-30 19:13                                   ` Dmitry Gutov
2022-10-30 19:54                                     ` Eli Zaretskii
2022-10-30 21:15                                       ` Dmitry Gutov
2022-10-31  9:53                                 ` João Távora
2022-10-31 11:56                                   ` João Távora
2022-10-31 17:11                                     ` Dmitry Gutov
2022-10-31 20:36                                       ` João Távora
2022-10-31 22:26                                         ` Dmitry Gutov
2022-10-31 22:51                                           ` João Távora
2022-10-31 14:35                                   ` Philip Kaludercic
2022-10-31 17:33                                     ` Dmitry Gutov
2022-10-31 23:19                                     ` João Távora
2022-11-01 10:51                                       ` Philip Kaludercic
2022-11-01 13:22                                       ` Dmitry Gutov
2022-11-01 13:39                                         ` João Távora
2022-10-31 17:24                                   ` Dmitry Gutov
2022-10-31 20:58                                     ` João Távora
2022-10-31 22:51                                       ` Dmitry Gutov
2022-11-01 10:48                                         ` Philip Kaludercic
2022-11-01 10:59                                           ` João Távora
2022-11-01 11:23                                             ` Dmitry Gutov
2022-11-01 11:39                                               ` João Távora
2022-11-01 15:27                                                 ` Dmitry Gutov
2022-11-01 16:23                                                   ` João Távora
2022-11-01 22:24                                                     ` Dmitry Gutov
2022-11-02  7:40                                                       ` João Távora
2022-11-01 11:27                                             ` Philip Kaludercic
2022-11-01 11:59                                               ` João Távora
2022-11-01 13:03                                                 ` Philip Kaludercic
2022-11-01 13:37                                                   ` João Távora
2022-11-01 14:00                                                     ` Philip Kaludercic
2022-11-01 14:11                                                       ` João Távora
2022-11-01 14:36                                                         ` Philip Kaludercic
2022-11-02  7:19                                                           ` João Távora
2022-11-02  7:29                                                             ` Philip Kaludercic
2022-11-02  7:48                                                               ` João Távora
2022-11-02  8:21                                                                 ` Philip Kaludercic
2022-11-02  8:41                                                                   ` João Távora
2022-11-02  9:06                                                                     ` Philip Kaludercic
2022-11-02  9:52                                                                       ` João Távora
2022-11-02 11:31                                                                         ` Philip Kaludercic
2022-11-01 15:26                                               ` Dmitry Gutov
2022-11-01 18:44                                                 ` Philip Kaludercic
2022-11-01 19:50                                                   ` Dmitry Gutov
2022-11-01 20:10                                                     ` Philip Kaludercic
2022-11-01 22:40                                                       ` Dmitry Gutov
2022-11-01 11:36                                         ` João Távora
2022-11-01 22:23                                           ` Dmitry Gutov
2022-11-02  7:34                                             ` João Távora
2022-11-02  8:36                                               ` Philip Kaludercic
2022-11-02  8:50                                                 ` João Távora
2022-11-02  9:13                                                   ` Philip Kaludercic
2022-11-02 14:00                                                     ` João Távora
2022-11-02 14:42                                                       ` Philip Kaludercic
2022-11-02 17:32                                                         ` Juri Linkov
2022-11-03 17:30                                                           ` Juri Linkov
2022-11-03 18:19                                                             ` João Távora
2022-11-02 18:16                                                         ` João Távora
2022-11-04  1:13                                           ` Dmitry Gutov
2022-11-04 11:21                                     ` Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-05  0:53                                       ` Dmitry Gutov
2022-10-29  6:38               ` Philip Kaludercic
2022-10-29 10:59                 ` Dmitry Gutov
2022-10-29 11:12                   ` João Távora
2022-10-29 11:05                 ` João Távora

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v8o3wgq1.fsf@gmail.com \
    --to=joaotavora@gmail.com \
    --cc=58839@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    --cc=manuel.uberti@inventati.org \
    --cc=philipk@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.