Subject: Re: bug#60557: [PATCH] Fix eglot prompt when connection already exists

From: João Távora <[email-masked]>
Date: Sat, 14 Jan 2023 17:22:38 +0000

On Sat, Jan 14, 2023 at 6:03 AM Evgeni Kolev <[email-masked]>
wrote:
>
> Hi João, thank you for the detailed reply.
>
> Could you confirm I correctly understand proposal 2.1)? Example
interactions:
>
> - M-x eglot RET ;; eglot guesses correctly the CONTACT
> - live connection exists?
>     - no - new connection
>     - yes - disconnect + new connection

Correct.

> - M-x eglot /some/path RET ;; eglot can't guess so prompts the user
> - live connection exists?
>     - no - new connection
>     - yes - disconnect + new connection

Correct, according to 2.1.

> If I understand correctly, 2.1) always disconnects + reconnects.

Yes, that is correct.

> Regarding 2.2), I don't fully understand it - could you clarify how
> 2.2) is different from the _user's_ perspective?

In 2.2, the user is *first* prompted yes/no to make a new connection.
Only then is the user potentially asked to enter new contact
information.  In 2.1, this order is reversed.

If the user answers "no", the order in 2.1 does not make much
 sense because the work that the user has put in to enter a new
contact is mostly wasted.  This is why 2.2 is preferrable, even if
its implementation is probably slightly more complicated.

> I'm also thinking about option 3) making M-x eglot able to detect a
> change in CONTACT:
>
> - M-x eglot RET
> - live connection exists?
>     - no - new connection
>     - yes - new CONTACT provided?
>         - no - reconnect to old CONTACT
>         - yes - disconnect + new connection to new CONTACT

I think this is too complicated.

João