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

From: João Távora <[email-masked]>
Date: Thu, 21 Nov 2024 20:14:24 +0000

Explain your scenario, please.  And note that if you take the rug from
underneath Eglot it will error, period.  That's by design.   I'm not
willing to contort the code to do  anything more than provide a
more or less understandable error message for such (relatively rare)
rug pulling.  IOW sentinels erroring is part of Emacs life and not a
bug in itself,  it's the error message that I'm willing to help ensure is
clear.

Please provide a backtrace and say if it's obtained with the very
same recipe in the beginning of the bug report.

João

On Thu, Nov 21, 2024 at 7:55 PM Spencer Baugh <[email-masked]> wrote:
>
> Spencer Baugh <[email-masked]> writes:
> > João Távora <[email-masked]> writes:
> >> 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
> >
> > That looks good to me.
>
> Actually, wait, sorry, neither this nor your initial revised patch fixes
> this bug at all.  The process sentinel still errors because
> eglot-reconnect errors.  We need to actually not try to reconnect when
> the project is gone.

-- 
João Távora