From: Eshel Yaron Date: Thu, 24 Oct 2024 12:07:28 +0000 (+0200) Subject: (eglot--connect): Guard against dead buffers X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=aeb929a9ed1e1ae3df1c6a018632e13f66c728e1;p=emacs.git (eglot--connect): Guard against dead buffers --- diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index f03f5c2940d..72a4549aa8d 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -1635,13 +1635,14 @@ This docstring appeases checkdoc, that's all." (setf (eglot--server-info server) serverInfo) (jsonrpc-notify server :initialized eglot--{}) (dolist (buffer (buffer-list)) - (with-current-buffer buffer - ;; No need to pass SERVER as an argument: it has - ;; been registered in `eglot--servers-by-project', - ;; so that it can be found (and cached) from - ;; `eglot--maybe-activate-editing-mode' in any - ;; managed buffer. - (eglot--maybe-activate-editing-mode))) + (when (buffer-live-p buffer) + (with-current-buffer buffer + ;; No need to pass SERVER as an argument: it has + ;; been registered in `eglot--servers-by-project', + ;; so that it can be found (and cached) from + ;; `eglot--maybe-activate-editing-mode' in any + ;; managed buffer. + (eglot--maybe-activate-editing-mode)))) (setf (eglot--inhibit-autoreconnect server) (cond ((booleanp eglot-autoreconnect)