emacs-devel
[Top][All Lists]
Advanced

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

Re: [SPAM UNSURE] Re: Unified project interface


From: Stephen Leake
Subject: Re: [SPAM UNSURE] Re: Unified project interface
Date: Sun, 07 Jun 2015 20:35:59 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (windows-nt)

Dmitry Gutov <address@hidden> writes:

> On 06/05/2015 04:03 PM, Stephen Leake wrote:
>
>> 1) You are editing a LaTeX file containing documentation for a Python
>> module implemented in Python and C++. You want to find all 
>> mentions/references
>> related to feature "foo", in LaTeX, Python, and C++ source files. So you
>> invoke project-find-regexp, which searches for *.tex, *.py, *.hhp, *.cpp
>> in project-source-directories.
>
> project-find-regexp? Do you imagine we'll need a separate command like
> that?

Yes, that's the point. That's how you distinuish between multi-language
and single-language searches.

>> There are a couple of implementation options here:
>>
>> - implement project-source-directories as the union of
>>    xref-source-directories for all backends listed in a project file
>
> This sounds like you envision a one-backend-per-language kind of
> situation. 

Yes, for xref.

> I think that there should be just one backend there, set in
> a minor mode, that knows enough about this mixed project's structure,
> to know where to search.

I don't see how that would be better; that minor mode would end up doing
what I'm suggesting the "project" code do.

>> - implement xref-source-directories as a subset of
>>    project-source-directories for each backend.
>>
>> I'm inclined to the latter; it's closer to what ada-mode does now.
>
> Could you explain what that means exactly? How is it implemented?

I don't have a working example of this precise structure now. What I'm
imagining is a "project file" that lists source directories without
regard to language. To be concrete, imagine a project with the following
structure:

/root
    src
        *.c files

    doc
        *.tex files

    build
        foo.prj -- the project file
        *.make files


foo.prj contains (among other things):

src_dir=../src
src_dir=../doc
src_dir=.

So project-source-directories is the list ("root/src" "root/doc"
"root/build").

If we are in a .c buffer, and we request xref-source-directories, the
code looks thru project-source-directories for directories that contain
c files, and returns only ("root/src"). This could be an expensive
check, so we'd want to cache the results.

Alternately, foo.prj could have:

language=c
language=tex
language=make

src_dir(c)=../src
src_dir(tex)=../doc
src_dir(make)=.

(You could get fancier and use "latex" as a language name, and have
another statement that maps that to ".tex". Which is needed for C and
Ada anyway, since they use two file extensions; .h/.c, .ads/.adb).

That imposes the requirement on the user that they know what files are
where.

Note that the directories do not have to be language exclusive; they are
here just for clarity.

-- 
-- Stephe



reply via email to

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