[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 1.2 afa5439 027/101: Kill server's output and events buffers from
From: |
Christian Johansson |
Subject: |
[elpa] 1.2 afa5439 027/101: Kill server's output and events buffers from eglot-shutdown (#66) |
Date: |
Thu, 29 Apr 2021 15:08:54 -0400 (EDT) |
tag: 1.2
commit afa5439af2ccc4733372afb11139141d20042539
Author: mkcms <k.michal@zoho.com>
Commit: João Távora <joaotavora@gmail.com>
Kill server's output and events buffers from eglot-shutdown (#66)
* eglot.el
(Package-Requires): Require jsonrpc 1.0.5
(eglot-shutdown): Kill events and stderr buffers of the
server, unless new PRESERVE-BUFFERS argument is non-nil.
eglot-reconnect): Preserve buffers on shutdown.
* eglot-tests.el (eglot--call-with-dirs-and-files): Call
eglot-shutdown with non-nil PRESERVE-BUFFERS arg.
---
eglot-tests.el | 2 +-
eglot.el | 20 +++++++++++++-------
2 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/eglot-tests.el b/eglot-tests.el
index 510573b..26ddf1f 100644
--- a/eglot-tests.el
+++ b/eglot-tests.el
@@ -65,7 +65,7 @@
(setq cleanup-events-et-cetera-p t))
(unwind-protect
(let ((eglot-autoreconnect nil))
- (mapc #'eglot-shutdown
+ (mapc (lambda (server) (eglot-shutdown server nil nil t))
(cl-remove-if-not #'jsonrpc-running-p new-servers)))
(when cleanup-events-et-cetera-p
(cl-loop for serv in new-servers
diff --git a/eglot.el b/eglot.el
index e37ec94..70a725c 100644
--- a/eglot.el
+++ b/eglot.el
@@ -7,7 +7,7 @@
;; Maintainer: João Távora <joaotavora@gmail.com>
;; URL: https://github.com/joaotavora/eglot
;; Keywords: convenience, languages
-;; Package-Requires: ((emacs "26.1") (jsonrpc "1.0.2"))
+;; Package-Requires: ((emacs "26.1") (jsonrpc "1.0.5"))
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
@@ -237,11 +237,14 @@ lasted more than that many seconds."
(defvar eglot--servers-by-project (make-hash-table :test #'equal)
"Keys are projects. Values are lists of processes.")
-(defun eglot-shutdown (server &optional _interactive timeout)
+(defun eglot-shutdown (server &optional _interactive timeout preserve-buffers)
"Politely ask SERVER to quit.
Forcefully quit it if it doesn't respond within TIMEOUT seconds.
-Don't leave this function with the server still running."
- (interactive (list (eglot--current-server-or-lose) t))
+If PRESERVE-BUFFERS is non-nil (interactively, when called with a
+prefix argument), do not kill events and output buffers of
+SERVER. Don't leave this function with the server still
+running."
+ (interactive (list (eglot--current-server-or-lose) t nil current-prefix-arg))
(eglot--message "Asking %s politely to terminate" (jsonrpc-name server))
(unwind-protect
(progn
@@ -253,9 +256,12 @@ Don't leave this function with the server still running."
;; Turn off `eglot--managed-mode' where appropriate.
(dolist (buffer (eglot--managed-buffers server))
(eglot--with-live-buffer buffer (eglot--managed-mode-onoff server nil)))
- ;; Now ask jsonrpc.el to shutdown server (which in normal
+ ;; Now ask jsonrpc.el to shut down the server (which under normal
;; conditions should return immediately).
- (jsonrpc-shutdown server)))
+ (jsonrpc-shutdown server (not preserve-buffers))
+ (unless preserve-buffers
+ (mapc #'kill-buffer
+ `(,(jsonrpc-events-buffer server) ,(jsonrpc-stderr-buffer
server))))))
(defun eglot--on-shutdown (server)
"Called by jsonrpc.el when SERVER is already dead."
@@ -408,7 +414,7 @@ managing `%s' buffers in project `%s'."
INTERACTIVE is t if called interactively."
(interactive (list (eglot--current-server-or-lose) t))
(when (jsonrpc-running-p server)
- (ignore-errors (eglot-shutdown server interactive)))
+ (ignore-errors (eglot-shutdown server interactive nil 'preserve-buffers)))
(eglot--connect (eglot--major-mode server)
(eglot--project server)
(eieio-object-class-name server)
- [elpa] 1.2 be464f2 005/101: Add entry for haskell-ide-engine in eglot-server-programs (#49), (continued)
- [elpa] 1.2 be464f2 005/101: Add entry for haskell-ide-engine in eglot-server-programs (#49), Christian Johansson, 2021/04/29
- [elpa] 1.2 0694579 009/101: Fix typo in willSaveWaitUntil RPC request (#51), Christian Johansson, 2021/04/29
- [elpa] 1.2 f4f93d3 014/101: Fix placement of diagnostics with same start and end positions, Christian Johansson, 2021/04/29
- [elpa] 1.2 01ec85f 011/101: Implement TextDocument/rangeFormatting, Christian Johansson, 2021/04/29
- [elpa] 1.2 d1cfc9e 008/101: Work around Emacs bugs 32237, 32278 (#53), Christian Johansson, 2021/04/29
- [elpa] 1.2 e33fadb 012/101: * eglot.el (eglot-client-capabilities): Fix a typo., Christian Johansson, 2021/04/29
- [elpa] 1.2 ee372b4 022/101: * eglot.el (advice-add jsonrpc-request): Add &allow-other-keys, Christian Johansson, 2021/04/29
- [elpa] 1.2 9bf88ee 031/101: Allow tests to be run with custom jsonrpc.el, Christian Johansson, 2021/04/29
- [elpa] 1.2 cf3376a 034/101: Close #64: handle edits to same position in the correct order, Christian Johansson, 2021/04/29
- [elpa] 1.2 5e30066 032/101: Update README.md, Christian Johansson, 2021/04/29
- [elpa] 1.2 afa5439 027/101: Kill server's output and events buffers from eglot-shutdown (#66),
Christian Johansson <=
- [elpa] 1.2 d6b49d8 028/101: * README.md (Build Status): Show status for master, Christian Johansson, 2021/04/29
- [elpa] 1.2 c2e05a3 030/101: Close #68: Implement asynchronous server connection, Christian Johansson, 2021/04/29
- [elpa] 1.2 3432d21 037/101: Per #74: Fix eglot-capabilities when querying for multiple features, Christian Johansson, 2021/04/29
- [elpa] 1.2 6eac51f 061/101: Sort references and definitions by line number, Christian Johansson, 2021/04/29
- [elpa] 1.2 88a4f8c 044/101: Actually add snippet example gif referenced in README.md, Christian Johansson, 2021/04/29
- [elpa] 1.2 29d641b 066/101: Handle case when project was not found in eclipse.jdt.ls contact, Christian Johansson, 2021/04/29
- [elpa] 1.2 2971683 075/101: Rework test macros for hopefully more stable testing, Christian Johansson, 2021/04/29
- [elpa] 1.2 3b3c1db 036/101: Close #73: Prompt for server in interactive eglot-shutdown, Christian Johansson, 2021/04/29
- [elpa] 1.2 a1cc0ad 043/101: * README.md (Obligatory animated gif section): Add snippet gif., Christian Johansson, 2021/04/29
- [elpa] 1.2 3532bd0 064/101: Per #63: Add support for eclipse.jdt.ls server, Christian Johansson, 2021/04/29