unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Ergus via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: "João Távora" <joaotavora@gmail.com>
Cc: Dmitry Gutov <dmitry@gutov.dev>, Eli Zaretskii <eliz@gnu.org>,
	70408@debbugs.gnu.org
Subject: bug#70408: 30.0.50; Eglot and Project integration
Date: Tue, 16 Apr 2024 23:51:21 +0200	[thread overview]
Message-ID: <6mr2uvovmws5qbowuqnh332tncdueanvxbucsoazzoykjythsf@k5eo2mzccf5w> (raw)
In-Reply-To: <CALDnm51NwMHwUPWjQwkXXXSc0wRndGKdrqwtfPf6WsmNPYD6Wg@mail.gmail.com>

On Tue, Apr 16, 2024 at 09:30:20PM +0100, João Távora wrote:
>On Tue, Apr 16, 2024 at 5:02 PM Ergus <spacibba@aol.com> wrote:
>
>> project-multi--merge-plist is just a hack function to merge the
>> eglot-workspace-configuration value without overriding the existing
>> sub-values if already set (in case the user sets some sub-values in the
>> dir locals then those takes precedence)
>>
>> Then this restarts eglot
>>
>> IIUC this is equivalent to call `--compile-commands-dir=build` and at
>> the moment is working for me.
>
>This seems extremely complicated, but happy it works for you.
>
The core idea is actually very simple: if project.el detects a
build-dir with compile-commands.json inside then update
eglot-workspace-configuration. The rest is just the api to set directory
local vars (extremely complicated indeed, but that's what it is)

>If during an eglot session something happens that leads to want to update
>the "workspace configuration" for a given session, you can set it and
>then call `eglot-signal-didChangeConfiguration` which is part of Eglot's
>API. No need to restart.  Also note that eglot-workspace-configuration
>can be a function, maybe that's useful to you somehow.
>
This is actually very useful; it is probably the only feature I needed
in the eglot side.

>> At the moment I assume the outer most only; which is the simpler one to
>> setup and implement woth the current project.el support. The main goal I
>> have is OOSC, not nested projects.
>
>OK.  I don't know what OOSC is but if it's somehow related to "out of tree
>builds" 
Out Of Sources Compilation

>I think these are fine, but builds aren't normally not part of a project:
>my
>.gitignore files ignores them.
>
Indeed, but my function in project.el won't.

The code I wrote considers some file-names as root hints (i.e
CMakeLists.txt) and others as build dirs hints (i.e CMakeCache.txt).

My project-find-functions hook searches upwards in the directory trees
for a root hint and in the top most root it searches not recursively for
the build dir hint in the root's sub-directories.

When there are multiple build dirs it asks to the user for which one to
use.

And after that it searches for the compile-commands.json there.

The code also sets a directory-local-var to avoid repeating this search
for all the other files in the future; because I use Tramp extensively
and such searches may slow.

>João





  reply	other threads:[~2024-04-16 21:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87o7aas3sk.fsf.ref@aol.com>
2024-04-15 21:40 ` bug#70408: 30.0.50; Eglot and Project integration Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-16 11:42   ` Eli Zaretskii
2024-04-16 12:33     ` João Távora
2024-04-16 12:55       ` Dmitry Gutov
2024-04-16 13:51         ` João Távora
2024-04-16 16:02           ` Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-16 20:30             ` João Távora
2024-04-16 21:51               ` Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-04-20 11:28           ` Dmitry Gutov
2024-04-20 13:10             ` João Távora
2024-04-16 13:03       ` Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-16 16:36       ` Eli Zaretskii

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=6mr2uvovmws5qbowuqnh332tncdueanvxbucsoazzoykjythsf@k5eo2mzccf5w \
    --to=bug-gnu-emacs@gnu.org \
    --cc=70408@debbugs.gnu.org \
    --cc=dmitry@gutov.dev \
    --cc=eliz@gnu.org \
    --cc=joaotavora@gmail.com \
    --cc=spacibba@aol.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).