Subject: bug#70408: 30.0.50; Eglot and Project integration

From: Ergus <[email-masked]>
Date: Mon, 15 Apr 2024 23:40:27 +0200

Hi:

Recently we have been discussing the possibility to improve project.el
in order to recognize/interact a bit more smartly with common modern
build infrastructures (i.e meson and cmake).

These build systems generally are also capable to generate the
compile_commands.json for clangd in the build directory independently of
its location (generally out of sources).

The current extension for project.el is capable to recognize the build
directory to execute project-compile. The approach works well in the
tests and I added a small POC code to modify the
`glot-workspace-configuration' variable on the fly.

This integration of project.el is pretty useful and simplifies the
configurations required to make eglot work a bit more consistently by
detecting the database more accurately.

The only limitation I am facing at the moment with this is that
project.el initializes lazily (when a project-something command is
called) and generally eglot seems to be designed to autostart as a mode
hook.

So the issue has two parts:

1. Is it desirable or are the eglot developers somehow interested in the
integration with project.el? If so, what are the key features of
interest.

2. Do you have some suggestion about how to initialize the eglot server
to properly update the `glot-workspace-configuration' on the fly?

My very primitive proof of concept code:

https://github.com/Ergus/project-multi-mode/blob/822316d82007e1b68c9a8dfcfbe205cb63b4f545/project-multi-mode.el#L194

Best,