]> git.eshelyaron.com Git - emacs.git/commitdiff
(eglot--connect): Guard against dead buffers
authorEshel Yaron <me@eshelyaron.com>
Thu, 24 Oct 2024 12:07:28 +0000 (14:07 +0200)
committerEshel Yaron <me@eshelyaron.com>
Thu, 24 Oct 2024 12:07:28 +0000 (14:07 +0200)
lisp/progmodes/eglot.el

index f03f5c2940da3bb1f9c0aecbeca45959aecd2682..72a4549aa8d07817fda94b03ec597c76d3599669 100644 (file)
@@ -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)