From 2c2aec71fb5079a2075627a09de748c4fd57fa9e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Wed, 2 May 2018 12:04:56 +0100 Subject: [PATCH] Don't switch to possibly dead buffer in sentinel * eglot.el (eglot--process-sentinel): Don't with-current-buffer. --- lisp/progmodes/eglot.el | 44 ++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 44023b721d0..22ff0318ca6 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/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)))) -- 2.39.2