[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: project.el: git submodules?

From: Doug Davis
Subject: Re: project.el: git submodules?
Date: Tue, 12 May 2020 15:44:25 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Gary Oberbrunner <address@hidden> writes:

> In my case at least, you're right and my submodule is seriously
> confused. It has a .git/ dir which disagrees with the ../.git/modules
> one. That's what was causing my problem. I've been doing a lot of work
> in that submodule (multiple upstream repos, merges, pushes, etc.) and
> perhaps something I did made it create that.
> Apparently the correct way to do this is "git rev-parse
> --show-superproject-working-tree". See
> https://stackoverflow.com/questions/7359204 for more info. (And in
> fact that does work in my case even with my messed-up .git dir in the
> submodule.)

For potentially complex setups it might be worth defining a personal
project discovery scheme, write a function compatible with it, and add
that function to `project-find-functions'.

Personal example: the first time I spun up `eglot' in a project that was
composed of submodules I ran into the issue that project.el didn't find
the top level repository as the project where the language server should
be initialized (this was quite some time ago, I guess before submodule
support was added to project.el).

Since I was already a projectile user, the solution (which I found
thanks to a comment on an eglot GitHub issue) was to add a new function
to `project-find-functions' which just queried projectile for what it
determined to be the project root. This was possible at the time because
projectile will search up the directory tree for a .projectile file to
define a project root, and I was already using that discovery mechanism
for that particular repository.

I was lazy and used projectile as a middle-step, but I think it would be
pretty straight forward to write a function to search for .emacs-project
files or something.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]