unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "João Távora" <joaotavora@gmail.com>
To: Spencer Baugh <sbaugh@janestreet.com>
Cc: Dmitry Gutov <dmitry@gutov.dev>, Eli Zaretskii <eliz@gnu.org>,
	app-emacs-dev@janestreet.com, 70724@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	[thread overview]
Message-ID: <CALDnm53F7xOVJiR-hjhAeCZwa7Wf8ztpF_7r_8Enz-CQ4YHvWg@mail.gmail.com> (raw)
In-Reply-To: <ierplmotmxh.fsf@janestreet.com>

On Thu, Nov 21, 2024 at 7:19 PM Spencer Baugh <sbaugh@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





  parent reply	other threads:[~2024-11-21 19:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-02 19:37 bug#70724: 29.2.50; eglot-reconnect errors when the project is deleted Spencer Baugh
2024-05-04  1:09 ` Dmitry Gutov
2024-05-18  8:31   ` Eli Zaretskii
2024-05-19 15:08     ` Dmitry Gutov
2024-11-21 19:46       ` Spencer Baugh via Bug reports for GNU Emacs, the Swiss army knife of text editors
     [not found]       ` <ierplmotmxh.fsf@janestreet.com>
2024-11-21 19:49         ` João Távora [this message]
2024-11-21 19:52           ` Spencer Baugh via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-21 19:55             ` Spencer Baugh via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-21 20:14               ` João Távora
2024-11-21 20:51                 ` Spencer Baugh via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-21 23:36                   ` João Távora
2024-06-06 20:36   ` Dmitry Gutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CALDnm53F7xOVJiR-hjhAeCZwa7Wf8ztpF_7r_8Enz-CQ4YHvWg@mail.gmail.com \
    --to=joaotavora@gmail.com \
    --cc=70724@debbugs.gnu.org \
    --cc=app-emacs-dev@janestreet.com \
    --cc=dmitry@gutov.dev \
    --cc=eliz@gnu.org \
    --cc=sbaugh@janestreet.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).