Replies: 9 comments 15 replies
-
Hi. If you can demonstrate what you say in somw kind of reproducible
example so we can really see what's happening, what preconditions and
commands are involved, etc... Then I think it should be fixed here, yes.
Eglot should not block other packages' functionality that have nothing to
do with its mission.
…On Sun, Jan 23, 2022, 11:44 phikal ***@***.***> wrote:
Hi,
it seems that Eglot prevents project from killing a project in one go,
when a server is running. The first call will kill a few buffers and the
server, then the second invocation will kill the remaining buffers. Should
this be fixed upstream or here?
—
Reply to this email directly, view it on GitHub
<#822>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAC6PQ3FTWAC5URFULP7HRDUXPSZ5ANCNFSM5MTHWCSA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
João Távora ***@***.***> writes:
Hi. If you can demonstrate what you say in somw kind of reproducible
example so we can really see what's happening, what preconditions and
commands are involved, etc... Then I think it should be fixed here, yes.
Eglot should not block other packages' functionality that have nothing to
do with its mission.
1. Open any Eglot-capable project
2. Open a few files (at least two)
3. Attempt to close all buffers (C-x p k runs the command
project-kill-buffers)
More often than not, I get an issue like this (I believe the order of
opening files and enabling eglot might have something to do with it, but
I haven't manged to pin-point it yet):
~~~
Kill 14 buffers in ~/src/sgo/? (y or n) y
[eglot] error sending textDocument/didClose: (error Process EGLOT (sgo/c-mode) not running) [5 times]
[eglot] Asking EGLOT (sgo/c-mode) politely to terminate
[jsonrpc] Server exited with status 13
down-list: Process EGLOT (sgo/c-mode) not running
~~~
and this stack trace:
~~~
Debugger entered--Lisp error: (error "Process EGLOT (sgo/c-mode) not running")
process-send-string(#<process EGLOT (sgo/c-mode)> "Content-Length: 123\15\n\15\n{\"jsonrpc\":\"2.0\",\"method\":\"...")
#f(compiled-function (arg1 &rest rest) "Send MESSAGE, a JSON object, to CONNECTION." #<bytecode -0xa9aa719e0332102>)(#<eglot-lsp-server eglot-lsp-server-155a370eac2e> :method :textDocument/didClose :params (:textDocument (:uri "file:///home/me/src/sgo/sgo.c")))
apply(#f(compiled-function (arg1 &rest rest) "Send MESSAGE, a JSON object, to CONNECTION." #<bytecode -0xa9aa719e0332102>) #<eglot-lsp-server eglot-lsp-server-155a370eac2e> (:method :textDocument/didClose :params (:textDocument (:uri "file:///home/me/src/sgo/sgo.c"))))
jsonrpc-connection-send(#<eglot-lsp-server eglot-lsp-server-155a370eac2e> :method :textDocument/didClose :params (:textDocument (:uri "file:///home/me/src/sgo/sgo.c")))
jsonrpc-notify(#<eglot-lsp-server eglot-lsp-server-155a370eac2e> :textDocument/didClose (:textDocument (:uri "file:///home/me/src/sgo/sgo.c")))
(condition-case err (jsonrpc-notify (eglot--current-server-or-lose) :textDocument/didClose (list ':textDocument (eglot--TextDocumentIdentifier))) ((debug error) (message "[eglot] error sending textDocument/didClose: %s" err) nil))
eglot--signal-textDocument/didClose()
kill-buffer(#<buffer sgo.c>)
project-kill-buffers()
funcall-interactively(project-kill-buffers)
call-interactively(project-kill-buffers nil nil)
command-execute(project-kill-buffers)
~~~
And not all buffers were closed.
… On Sun, Jan 23, 2022, 11:44 phikal ***@***.***> wrote:
> Hi,
>
> it seems that Eglot prevents project from killing a project in one go,
> when a server is running. The first call will kill a few buffers and the
> server, then the second invocation will kill the remaining buffers. Should
> this be fixed upstream or here?
>
> —
> Reply to this email directly, view it on GitHub
> <#822>, or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAC6PQ3FTWAC5URFULP7HRDUXPSZ5ANCNFSM5MTHWCSA>
> .
> Triage notifications on the go with GitHub Mobile for iOS
> <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
> or Android
> <https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
>
> You are receiving this because you are subscribed to this thread.Message
> ID: ***@***.***>
>
--
Philip Kaludercic
|
Beta Was this translation helpful? Give feedback.
-
@phikal, do you have Just in case, before enabling (advice-add 'project-kill-buffers
:before
(lambda ()
(ignore-errors (eglot-shutdown (eglot-current-server))))
'((name . "my-project-kill-buffers"))) |
Beta Was this translation helpful? Give feedback.
-
Now that Eglot has been merged upstream, has the situation improved to fix this issue? |
Beta Was this translation helpful? Give feedback.
-
João Távora ***@***.***> writes:
Or maybe:
4. `project.el` stops killing hidden buffers. They are an
implementation detail. By definition, since they are hidden, the user
can't have meant to kill them with `M-x project-kill-buffers`, since
she doesn't know about their existence.
I don't think so, when using C-x p k I usually want to get rid of
everything that Emacs has loaded that is related to a project, that
would include background processes that I would expect to have killed.
Perhaps `project-kill-buffers' is the wrong name for what I am thinking
of, but it certainly was the intention when the command was added.
… Yeah, I think this makes the most sense.
|
Beta Was this translation helpful? Give feedback.
-
João Távora ***@***.***> writes:
> I don't think so, when using C-x p k I usually want to get rid of
> everything that Emacs has loaded that is related to a project, that
Do you also want it to wipe out elements of `file-name-history` just because they too are related to a project? Probably not.
No, as you imply this is obviously not what I am talking about. I was
precisely trying to avoid implying this with my phrasing.
> Perhaps `project-kill-buffers' is the wrong name for what I am thinking
> of, but it certainly was the intention when the command was added.
For me it makes much more sense for this command to kill the buffers that would clog up `C-x b` and `ibuffer` and so on.
Eglot's hidden buffers are not a member of this set.
These processes can grow to use a lot of RAM or CPU power, which is not
something I want to have lying around in the background.
Also, your intended use is in very nature with having
`eglot-autoreconnect` set to `nil`, which is the default and a very
useful feature for slow-to-start servers.
So you may very well set `eglot-autoreconnect` to `t`, which you do,
and if `project.el` stops concerning itself with internal data
structures everything will work the way you want.
What I think should be done is that "C-x p k" should be able to
communicate with Eglot (e.g. vie a hook) and prompt the user if they
want to keep the server around or not. If they decide to kill the
server, it should be done before the buffers are killed so that killing
a project doesn't fail midway. If they decide to keep the server, then
the server buffer shouldn't be killed.
|
Beta Was this translation helpful? Give feedback.
-
It's the eternal space-time tradeoff. If you prefer spending more time when Everything will work exactly the way you want (so long as project.el
The way for Eglot to communicate to everybody (which includes project.el) |
Beta Was this translation helpful? Give feedback.
-
João Távora ***@***.***> writes:
> These processes can grow to use a lot of RAM or CPU power, which is not
> something I want to have lying around in the background.
It's the eternal space-time tradeoff. If you like prefer spending more time when
you re-visit a file set `eglot-autoshutdown` to `t`!
Everything will work exactly the way you want (so long as project.el
does what it should).
I have that variable customised to t, but I still experience this issue.
This might indicate that the behaviour I am describing is a bug, in
which case I'd move the discussion from here to a new Emacs bug report.
> What I think should be done is that "C-x p k" should be able to
> communicate with Eglot (e.g. vie a hook) and prompt the user if they
> want to keep the server around or not. If they decide to kill the
> server, it should be done before the buffers are killed so that killing
> a project doesn't fail midway. If they decide to keep the server, then
> the server buffer shouldn't be killed.
The way for Eglot to communicate to *everybody* (which includes project.el)
the message "_don't mess with this private buffer_" exists already: hidden
buffers.
I am uncertain if hidden buffer are necessarily "private", as they are
part of the list that `buffer-list' returns.
|
Beta Was this translation helpful? Give feedback.
-
Continue discussion at: Emacs bug 58839. https://debbugs.gnu.org/cgi/bugreport.cgi?bug=58839 |
Beta Was this translation helpful? Give feedback.
-
Hi,
it seems that Eglot prevents project from killing a project in one go, when a server is running. The first call will kill a few buffers and the server, then the second invocation will kill the remaining buffers. Should this be fixed upstream or here?
[EDIT by @joaotavora: Continued at Emacs bug 58839: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=58839]
Beta Was this translation helpful? Give feedback.
All reactions