Subject: bug#70724: 29.2.50; eglot-reconnect errors when the project is deleted

From: Spencer Baugh <[email-masked]>
Date: Thu, 21 Nov 2024 14:46:18 -0500

(Sending again after unarchiving the bug...)

Unfortunately the revised patch pushed by Joao is still broken for me,
because fetching project-name isn't guaranteed to work if the project
doesn't exist.

How about this instead?

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index 092a9c6b9a5..502cb7bbb24 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -1518,13 +1518,13 @@ eglot--connect
   "Connect to MANAGED-MODES, LANGUAGE-IDS, PROJECT, CLASS and CONTACT.
 This docstring appeases checkdoc, that's all."
   (let* ((default-directory (project-root project))
-         (nickname (project-name project))
-         (readable-name
+         (nickname
           (progn
             (unless (file-exists-p default-directory)
               ;; could happen because of bug#70724 or just because
-              (eglot--error "Project '%s' is gone!" nickname))
-            (format "EGLOT (%s/%s)" nickname managed-modes)))
+              (eglot--error "Project '%s' is gone!" default-directory))
+            (project-name project)))
+         (readable-name (format "EGLOT (%s/%s)" nickname managed-modes))
          server-info
          (contact (if (functionp contact) (funcall contact) contact))
          (initargs