From 976896f2c34034a495c72096daeadeb2a9ab4846 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Thu, 3 May 2018 11:49:24 +0100 Subject: [PATCH] Signal textdocument/didclose * eglot.el (eglot-editing-mode): Signal didClose. (eglot--signalDidClose): New. --- lisp/progmodes/eglot.el | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 12e7fef08c4..85844409f34 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -671,6 +671,7 @@ running. INTERACTIVE is t if called interactively." (eglot-mode 1) (add-hook 'after-change-functions 'eglot--after-change nil t) (add-hook 'flymake-diagnostic-functions 'eglot-flymake-backend nil t) + (add-hook 'kill-buffer-hook 'eglot--signalDidClose nil t) (flymake-mode 1) (if (eglot--current-process) (eglot--signalDidOpen) @@ -679,7 +680,8 @@ running. INTERACTIVE is t if called interactively." (eglot--warn "No process")))) (t (remove-hook 'flymake-diagnostic-functions 'eglot-flymake-backend t) - (remove-hook 'after-change-functions 'eglot--after-change t)))) + (remove-hook 'after-change-functions 'eglot--after-change t) + (remove-hook 'kill-buffer-hook 'eglot--signalDidClose t)))) (define-minor-mode eglot-mode "Minor mode for all buffers managed by EGLOT in some way." nil @@ -832,6 +834,12 @@ running. INTERACTIVE is t if called interactively." (eglot--obj :textDocument (eglot--current-buffer-TextDocumentItem)))) +(defun eglot--signalDidClose () + (eglot--notify (eglot--current-process-or-lose) + :textDocument/didClose + (eglot--obj :textDocument + (eglot--current-buffer-TextDocumentItem)))) + (defun eglot--maybe-signal-didChange () (when eglot--recent-changes (save-excursion -- 2.39.2