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

From: Juri Linkov <[email-masked]>
Date: Sun, 30 Jun 2024 19:38:59 +0300

> 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.
>
> 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.
>
> The attached patch detects that with:
>
> +    (when (member '(project-mode-line project-mode-line-format) mode-line-format)
>
> but I'm also totally fine with:
>
> +    (when (version<= "30" emacs-version)
>
> Or I guess we could sidestep the issue if project.el itself ensured,
> when loaded, that mode-line-format contains project-mode-line.  eglot
> itself does this with eglot--mode-line-format, running the following at
> load time:
>
>   (add-to-list 'mode-line-misc-info
>              `(eglot--managed-mode (" [" eglot--mode-line-format "] ")))
>
> Juri, any opinion?

bindings.el already contains '(project-mode-line project-mode-line-format),
so checking this with (member '(project-mode-line project-mode-line-format)
mode-line-format) looks fine.

OTOH, I'm not sure if using (setq-local project-mode-line t)
would be appreciated by users.  I think your initial patch
was more correct with (bound-and-true-p project-mode-line).