]> git.eshelyaron.com Git - emacs.git/commitdiff
Add new command eglot-shutdown-all
authorbc² <odanoburu@users.noreply.github.com>
Mon, 15 Mar 2021 09:49:07 +0000 (06:49 -0300)
committerGitHub <noreply@github.com>
Mon, 15 Mar 2021 09:49:07 +0000 (09:49 +0000)
Also closes https://github.com/joaotavora/eglot/issues/644
Co-authored-by: João Távora <joaotavora@gmail.com>
Copyright-paperwork-exempt: yes

* NEWS.md: mention new command

* README.md (Commands and keybindings): mention new command.  Tweak
documentation for eglot-shutdown and eglot-reconnect.

* eglot.el (eglot-shutdown): Tweak docstring.
(eglot-shutdown-all): New command.

GitHub-reference: close https://github.com/joaotavora/eglot/issues/643

lisp/progmodes/eglot.el

index 79b90886f6c0bf965952f87ef5ce4dd8206f8538..0341ffdecc657cc8389aa2df3afe9395ba7bcc3d 100644 (file)
@@ -652,11 +652,12 @@ Interactively, read SERVER from the minibuffer unless there is
 only one and it's managing the current buffer.
 
 Forcefully quit it if it doesn't respond within TIMEOUT seconds.
-Don't leave this function with the server still running.
+TIMEOUT defaults to 1.5 seconds.  Don't leave this function with
+the server still running.
 
 If PRESERVE-BUFFERS is non-nil (interactively, when called with a
 prefix argument), do not kill events and output buffers of
-SERVER.  ."
+SERVER."
   (interactive (list (eglot--read-server "Shutdown which server"
                                          (eglot-current-server))
                      t nil current-prefix-arg))
@@ -670,6 +671,13 @@ SERVER.  ."
     (jsonrpc-shutdown server (not preserve-buffers))
     (unless preserve-buffers (kill-buffer (jsonrpc-events-buffer server)))))
 
+(defun eglot-shutdown-all (&optional preserve-buffers)
+  "Politely ask all language servers to quit, in order.
+PRESERVE-BUFFERS as in `eglot-shutdown', which see."
+  (interactive (list current-prefix-arg))
+  (cl-loop for ss being the hash-values of eglot--servers-by-project
+           do (cl-loop for s in ss do (eglot-shutdown s nil preserve-buffers))))
+
 (defun eglot--on-shutdown (server)
   "Called by jsonrpc.el when SERVER is already dead."
   ;; Turn off `eglot--managed-mode' where appropriate.