After playing around with the emacs-snapshot package (version 23.1.91), I've
found out that proj-automake is not compatible with a "non-recursive" automake
Namely, it has no support for files in subdirectories. For example:
bin_PROGRAMS = foo
foo_SOURCES = foo.c dir/bar.c dir/bar.h
Files that are in the same directory where the makefile using them is, have no
problems, but those in subdirectories (./dir/* in the example) happen to appear
as if they were not inluded in any project.
In fact, my project is still more complex, as the project contains as targets a
few dynamic libraries (some of which are built on top of the others) and a few
interfacing programs, all using this kind of subdirectory structure.
What I've found is that these files in the subdirectory have a nil result when
Curiously, at the end of `ede-current-prject'm, there is this code:
(when (ede-directory-project-p ldir)
(setq ans (ede-load-project-file ldir)))
The first call, `ede-directory-project-p', always fails in subdirectories, but
I've found out that `ede-load-project-file' does indeed search upwards in the
directory structure until it finds a suitable project.
Then my question is, when and how is the file-to-project bond made? And how
could this be generalized to support files in subdirectories?
With my complete lack of knowledge of how it is implemented, every time the
target/project is needed I would:
1) Provide a buffer-local variable that indicates a list of targets it belongs
to. If set, nothing else is needed. This variable could be set to a special
value indicating that the current buffer is not part of any project, and no
search is needed.
2) A global list with recently visited project directory roots, such that the
one matching as a prefix of the file of the current buffer, will be set as
the containing project.
3) Starting at the root of the project, it can be recursively parsed in order to
find all targets and their files. Note that theoretically, a source file does
not need to be inside the tree where its target declaration is; i.e., a
target can declare the use of source files residing in the target's parent
directory. Whether or not this makes any sense, is another question.
4) The path of the file in the current buffer is looked up into the project. As
every matching buffer will cache the result (see 1), this operation does not
need to be optimized; i.e., this can simply be a traversal of the project
object, recursively visiting all its targets.
Is this somewhere near the current state?
"And it's much the same thing with knowledge, for whenever you learn
something new, the whole world becomes that much richer."
-- The Princess of Pure Reason, as told by Norton Juster in The Phantom