Subject: Re: bug#71823: 31.0.50; project-mode-line and eglot duplicate project-name in mode-line

From: João Távora <[email-masked]>
Date: Wed, 3 Jul 2024 14:59:18 +0100

On Wed, Jul 3, 2024 at 2:17 PM Spencer Baugh <[email-masked]> wrote:
>
> João Távora <[email-masked]> writes:
>
> > On Sun, Jun 30, 2024, 13:51 <[email-masked]> wrote:
> >
> >  João Távora <[email-masked]> writes:
> >  > On Sat, Jun 29, 2024, 15:24 Spencer Baugh <[email-masked]> wrote:
> >  >
> >  >  Or, here's an alternative idea, more aggressive:
> >  >
> >  >  What if Eglot just sets project-mode-line=t in eglot-managed buffers, and removes the project-name from the Eglot entry
> >  >  entirely?
> >  >
> >  >  Then the language identifier would be the major mode, the project identifier would be project-mode-line, and the eglot
> >  status
> >  >  indicator would just be for the status of the server.
> >  >
> >  > Works for me, it's in line with Eglot's policy of setting other modes when managing buffers. Show a patch.
> >
> >  Attached.
> >
> >  I do think this is a great way to resolve this - now that
> >  project-mode-line exists, using it deletes one small bit of
> >  eglot-specific functionality, which is in line with the Eglot design
> >  philosophy.
> >
> > Yes.
> >
> >  The only issue is that this was only added to mode-line-format in Emacs
> >  30, so we can only use it in Emacs 30 or later.
> >
> > No, that's not an issue, or rather your solution isn't the way to solve it. In trunk Eglot use everything that is in trunk Emacs. In
> > released Eglot versions name sure you depend on capable versions of core GNU Elpa packages, a set which already includes
> > project.el. So basically version bumps solves it.
>
> Yes, certainly.  That's why I bumped the required version of project.el
> in the Package-Requires.
>
> But, loading a newer version of project.el doesn't add the
> project-mode-line entry to mode-line-format.  That's done in
> bindings.el, and can't be updated.  So we still need to do something
> else to accomodate an Emacs 29 user with an updated eglot.el and
> project.el.

Hmm, I don't like it I must say.  I thought there would be some kind
of project-mode-line-mode to call that would do what it has to do
to put the project in the mode-line.  Like this it feels too hacky
and intrusive into project.el's and binding.el's implementation.

I also don't understand the other changes (i.e. to the menu) but
that's OK.  I'm going back to my previous recommendation of redesigning
Eglot's  eglot--mode-line-format into eglot-mode-line-format in the likeness
of other packages (Flymake for example).   If I'm going to carefully
review and test changes to Eglot's mode-line machinery like the ones
you are presenting here, it might as well be the most useful changes
possible.

That change should fix this and other problems.  Until then, I don't think
this is an extremely serious problem.

João