-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement autoshutdown when killing last buffer (#305) #305
Conversation
This should close issue joaotavora#217, also cf. joaotavora#270. * eglot.el: New defcustom `eglot-autoshutdown' (default nil). (eglot--managed-mode-onoff): Shutdown if so configured and no managed buffers left.
b2a174e
to
443b52e
Compare
This is not working nicely yet, b/c of the order w.r.t. the didClose notification... I will think about the cleanest way to handle that and re-open the PR then; sorry. |
I don't understand why would anyone want to keep |
Good question but I think your answer is a reasonable case. Anyway, if we introduce this, I think we should default it to t. And, yes, improve documentation. |
Well, whenever I add a feature that changes some long-standing behavior, I start w/ it defaulting to off. Personally, I turn it on, of course, or I would not have tried to add this in the first place. Once I get this working smoothly, I will gladly set the default to |
This is the correct choice in 99% of cases. But in this one I think @nemethf has a good point. |
lsp-mode in the past had the auto-close behavior. In August 2018, it introduced I vote for keeping the server alive as the default. |
I would rather to not just add a workaround (like swapping the order in the hook), but to think thoroughly about a good way to deal with these issues. Sth about the -onoff proxy feels off to me. Hope to get to it soon! |
This should close issue joaotavora#217, also cf. joaotavora#270. * eglot.el: New defcustom `eglot-autoshutdown' (default t). (eglot--managed-mode): Signal didClose before possibly triggering autoshutdown. (eglot--managed-mode-onoff): Shutdown if so configured and no managed buffers left.
Actually, after studying some of the code, the cleanest fix for now is to make sure that didClose is sent before calling @joaotavora, I think you counted my default setting as a "vote" for the keep-alive case, that's really quite the opposite of my opinion --- as I tried to explain above, I only kept the old behavior as I did not want to discuss the default at that point. :) But since we're discussing anyway, I vote to autoshutdown, and will put that into the code as well. The "slow-startup" argument seems based on the assumption that people keep their Emacs instance running, but often kill buffers "just so", and I'd say that's not typical Emacs usage. When I kill a buffer, I am done with it for the foreseeable future, that's when I want the server to be shut down. I would still like to simplify the onoff mechanism and integrate the cache/book-keeping into the regular minor mode function (which should make it less fragile to keep a consistent state), but that's a different PR... |
Which makes sense, let's first get this working and then discuss the default. I'll try to evaluate your technical arguments later in the day. |
Continued at #309. |
This should close issue #217, also cf. #270.
(eglot--managed-mode-onoff): Shutdown if so configured and no managed
buffers left.