GNU bug report logs - #70724
29.2.50; eglot-reconnect errors when the project is deleted

Previous Next

Package: emacs;

Reported by: Spencer Baugh <sbaugh <at> janestreet.com>

Date: Thu, 2 May 2024 19:38:01 UTC

Severity: normal

Found in version 29.2.50

Done: Dmitry Gutov <dmitry <at> gutov.dev>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: João Távora <joaotavora <at> gmail.com>
To: Spencer Baugh <sbaugh <at> janestreet.com>
Cc: Dmitry Gutov <dmitry <at> gutov.dev>, Eli Zaretskii <eliz <at> gnu.org>, app-emacs-dev <at> janestreet.com, 70724 <at> debbugs.gnu.org
Subject: bug#70724: 29.2.50; eglot-reconnect errors when the project is deleted
Date: Thu, 21 Nov 2024 19:49:13 +0000
On Thu, Nov 21, 2024 at 7:19 PM Spencer Baugh <sbaugh <at> janestreet.com> wrote:
>
>
> 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.

project was passed non-nil to eglot-connect, yes?  A non-nil project
should still be able to identify itself even if its support in the filesystem
is missing, IMHO.

Anyway, this patch is slightly simpler (same idea)

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index e5c27de81fc..1e9a8a36343 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -1518,13 +1518,11 @@ 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
-          (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)))
+         (nickname (if (file-exists-p default-directory)
+                       (project-name project)
+                     ;; could happen because of bug#70724 or just because
+                     (eglot--error "Project at `%s' is gone!"
default-directory)))
+         (readable-name (format "EGLOT (%s/%s)" nickname managed-modes))
          server-info
          (contact (if (functionp contact) (funcall contact) contact))
          (initargs





>
> 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



-- 
João Távora




This bug report was last modified 184 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.