unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Spencer Baugh <sbaugh@janestreet.com>
To: "João Távora" <joaotavora@gmail.com>
Cc: Dmitry Gutov <dmitry@gutov.dev>, Eli Zaretskii <eliz@gnu.org>,
	Juri Linkov <juri@linkov.net>,
	71823@debbugs.gnu.org, Spencer Baugh <sbaugh@catern.com>
Subject: bug#71823: 31.0.50; project-mode-line and eglot duplicate project-name in mode-line
Date: Wed, 03 Jul 2024 10:47:43 -0400	[thread overview]
Message-ID: <ierfrsqa5ww.fsf@janestreet.com> (raw)
In-Reply-To: <CALDnm52o+n+UpCy0Xh5mpQSAsfqV-gJY_aiviK70-8TmXE+a+g@mail.gmail.com> ("João Távora"'s message of "Wed, 3 Jul 2024 14:59:18 +0100")

João Távora <joaotavora@gmail.com> writes:

> On Wed, Jul 3, 2024 at 2:17 PM Spencer Baugh <sbaugh@janestreet.com> wrote:
>>
>> João Távora <joaotavora@gmail.com> writes:
>>
>> > On Sun, Jun 30, 2024, 13:51 <sbaugh@catern.com> wrote:
>> >
>> >  João Távora <joaotavora@gmail.com> writes:
>> >  > On Sat, Jun 29, 2024, 15:24 Spencer Baugh <sbaugh@janestreet.com> 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.

Sure, so here are some possible solutions:

A. Check (member '(project-mode-line project-mode-line-format) mode-line-format)
B. Check (version<= "30" emacs-version)
C. project.el itself could ensure, 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 "] ")))
D. Add a project-minor-mode like you suggest which puts the project in
   the mode-line.

Do any of these seem acceptable?

I personally prefer C.

> I also don't understand the other changes (i.e. to the menu) but
> that's OK.

The project-name in the eglot mode line entry had the server menu
attached to it.  Since the project-name is no longer present, the server
menu isn't accessible.  To make the server menu accessible again, it's
added to the main eglot menu.

> 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.

Making eglot-mode-line-format customizable is an orthogonal change,
which gives different benefits.

To be clear, the problem I want to fix is "there's two mode-line entries
(project-mode-line-format, eglot--mode-line-format) which include
project-name, so project-name shows up twice".

Yes, making those entries customizable allows the user to solve the
problem by customizing the entries.

But I don't want to delegate the responsibility of solving this problem
to the user, I want the problem to just be gone: the entries should just
not duplicate project-name.





  reply	other threads:[~2024-07-03 14:47 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-28 14:13 bug#71823: 31.0.50; project-mode-line and eglot duplicate project-name in mode-line Spencer Baugh
2024-06-28 14:15 ` Spencer Baugh
2024-06-28 14:40   ` Eli Zaretskii
2024-06-28 17:49     ` João Távora
2024-06-28 22:08       ` Spencer Baugh
2024-06-29  7:12         ` Eli Zaretskii
2024-06-29 11:59           ` Dmitry Gutov
2024-06-29 12:43             ` Eli Zaretskii
2024-06-30  6:50             ` Juri Linkov
2024-06-30 10:25               ` João Távora
2024-06-29 12:05           ` João Távora
2024-06-29 12:17             ` Dmitry Gutov
2024-06-29 12:21               ` João Távora
2024-06-29 12:41                 ` Spencer Baugh
2024-06-29 14:24                   ` Spencer Baugh
2024-06-30  0:25                     ` João Távora
2024-06-30 12:51                       ` sbaugh
2024-06-30 14:53                         ` João Távora
2024-06-30 15:05                           ` João Távora
2024-07-03 13:17                           ` Spencer Baugh
2024-07-03 13:59                             ` João Távora
2024-07-03 14:47                               ` Spencer Baugh [this message]
2024-07-03 14:57                                 ` João Távora
2024-07-03 15:12                                   ` Spencer Baugh
2024-07-03 16:03                                     ` João Távora
2024-07-03 17:10                                       ` sbaugh
2024-07-05 12:04                                         ` João Távora
2024-07-15 13:30                                           ` Spencer Baugh
2024-06-30 16:38                         ` Juri Linkov
2024-07-03 13:00                           ` Spencer Baugh

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=ierfrsqa5ww.fsf@janestreet.com \
    --to=sbaugh@janestreet.com \
    --cc=71823@debbugs.gnu.org \
    --cc=dmitry@gutov.dev \
    --cc=eliz@gnu.org \
    --cc=joaotavora@gmail.com \
    --cc=juri@linkov.net \
    --cc=sbaugh@catern.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).