unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dmitry@gutov.dev>
To: Spencer Baugh <sbaugh@janestreet.com>, 70724-done@debbugs.gnu.org
Cc: app-emacs-dev@janestreet.com, "João Távora" <joaotavora@gmail.com>
Subject: bug#70724: 29.2.50; eglot-reconnect errors when the project is deleted
Date: Thu, 6 Jun 2024 23:36:11 +0300	[thread overview]
Message-ID: <8c915fa2-227f-475b-a380-b4f4d83e525f@gutov.dev> (raw)
In-Reply-To: <fe03ba64-8a02-4afd-91f7-a83e81705a46@gutov.dev>

On 04/05/2024 04:09, Dmitry Gutov wrote:
> 
> I think I like this solution (as long as the nil value returned by 
> project-current on this step is appropriately handled).
> 
> Something like:
> 
> diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
> index 6896baf30ce..7b2461c3ce6 100644
> --- a/lisp/progmodes/eglot.el
> +++ b/lisp/progmodes/eglot.el
> @@ -1426,11 +1426,15 @@ eglot-reconnect
>     (interactive (list (eglot--current-server-or-lose) t))
>     (when (jsonrpc-running-p server)
>       (ignore-errors (eglot-shutdown server interactive nil 
> 'preserve-buffers)))
> -  (eglot--connect (eglot--major-modes server)
> -                  (eglot--project server)
> -                  (eieio-object-class-name server)
> -                  (eglot--saved-initargs server)
> -                  (eglot--language-ids server))
> +  (let* ((root (project-root (eglot--project server)))
> +         (project (project-current nil root)))
> +    (if (not project)
> +        (eglot--error "Project in `%s' is gone!" root)
> +      (eglot--connect (eglot--major-modes server)
> +                      project
> +                      (eieio-object-class-name server)
> +                      (eglot--saved-initargs server)
> +                      (eglot--language-ids server))))
>     (eglot--message "Reconnected!"))
> 
>   (defvar eglot--managed-mode) ; forward decl

Okay, I've pushed a slightly revised version of this patch now. It makes 
sense to me, even if some caching issues might remain in project backend(s).

Spencer, please see if it takes care of your scenario.





      parent reply	other threads:[~2024-06-06 20:36 UTC|newest]

Thread overview: 5+ 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-06-06 20:36   ` Dmitry Gutov [this message]

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=8c915fa2-227f-475b-a380-b4f4d83e525f@gutov.dev \
    --to=dmitry@gutov.dev \
    --cc=70724-done@debbugs.gnu.org \
    --cc=app-emacs-dev@janestreet.com \
    --cc=joaotavora@gmail.com \
    --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).