branch: externals/eglot
commit 8e6488f2dbdb55708fb2743aa9e86d583b8f9148
Author: João Távora <[email protected]>
Commit: João Távora <[email protected]>
Don't switch to possibly dead buffer in sentinel
* eglot.el (eglot--process-sentinel): Don't with-current-buffer.
---
eglot.el | 44 ++++++++++++++++++++++----------------------
1 file changed, 22 insertions(+), 22 deletions(-)
diff --git a/eglot.el b/eglot.el
index 44023b7..22ff031 100644
--- a/eglot.el
+++ b/eglot.el
@@ -153,24 +153,23 @@ INTERACTIVE is t if called interactively."
(eglot--protocol-initialize proc interactive)))))))
(defun eglot--process-sentinel (process change)
- (with-current-buffer (process-buffer process)
- (eglot--debug "(sentinel) Process state changed to %s" change)
- (when (not (process-live-p process))
- ;; Remember to cancel all timers
- ;;
- (maphash (lambda (id quad)
- (cl-destructuring-bind (_success _error timeout _env) quad
- (eglot--message
- "(sentinel) Cancelling timer for continuation %s" id)
- (cancel-timer timeout)))
- (eglot--pending-continuations process))
- (cond ((eglot--moribund process)
- (eglot--message "(sentinel) Moribund process exited with status
%s"
- (process-exit-status process)))
- (t
- (eglot--warn "(sentinel) Process unexpectedly changed to %s"
- change)))
- (delete-process process))))
+ (eglot--debug "(sentinel) Process state changed to %s" change)
+ (when (not (process-live-p process))
+ ;; Remember to cancel all timers
+ ;;
+ (maphash (lambda (id quad)
+ (cl-destructuring-bind (_success _error timeout _env) quad
+ (eglot--message
+ "(sentinel) Cancelling timer for continuation %s" id)
+ (cancel-timer timeout)))
+ (eglot--pending-continuations process))
+ (cond ((eglot--moribund process)
+ (eglot--message "(sentinel) Moribund process exited with status %s"
+ (process-exit-status process)))
+ (t
+ (eglot--warn "(sentinel) Process unexpectedly changed to %s"
+ change)))
+ (delete-process process)))
(defun eglot--process-filter (proc string)
"Called when new data STRING has arrived for PROC."
@@ -371,7 +370,8 @@ identifier. ERROR is non-nil if this is an error."
(error-fn
(or error-fn
(cl-function
- (lambda (&key code message)
+ (lambda (&key data code message &allow-other-keys)
+ (setf (eglot--status process) '("error" t))
(eglot--warn
"(request) Request id=%s errored with code=%s: %s"
id code message)))))
@@ -446,9 +446,9 @@ INTERACTIVE is t if caller was called interactively."
process
:initialize
`(:processId ,(emacs-pid)
- :rootPath ,(concat "file://"
- (expand-file-name (car (project-roots
-
(project-current)))))
+ :rootPath ,(concat
+ (expand-file-name (car (project-roots
+ (project-current)))))
:initializationOptions []
:capabilities (:workspace (:executeCommand
(:dynamicRegistration t))
:textDocument (:synchronization
(:didSave t))))