Re: The globalrc file,

Suresh Govindachar <[email protected]> Sat, 14 Jun 2014 19:24:43 -0700
Newsgroups gmane.comp.gnu.global.general
Message-ID <[email protected]>
On 6/14/2014 6:32 PM, Tama Communications Corp. wrote:
> First of all, you can distinguish two projects by the current
> directory. This is the normal way of GLOBAL.
> For example, if you have two projects as follows:
>
> Project(1)      /usr/src/prj1
> Project(2)      /usr/src/prj2
>
> You can select one of two projects only by changing directory.
>
> In gvim (1)
> :cd /usr/src/prj1
>
> In gvim (2)
> :cd /usr/src/prj2

Thanks for the insight into ways of using GLOBAL.  Here's how I would 
like to organize my directories:

Source code:

    Project_1:  /c/home/suresh/one/two/prj_1
    Project_2:  /d/new/stuff/prj_2

Global data base:

    /e/some/where/global/prj_1/
    /e/some/where/global/prj_2/

To create global database, I first use find command to create list of 
files with absolute path:

     find   /c/home/suresh/one/two/prj_1  \
                -iname '*.c' -o    \
                -iname '*.cc' -o    \
                -iname '*.cpp' -o    \
                -iname '*.h' -o    \
                -iname '*.hh' -o    \
                -iname '*.hpp'    \
                >> /e/some/where/global/prj_1/the_files

     find  <absolute_path_to_project_2>  \
                -iname '*.c' -o    \
                -iname '*.cc' -o    \
                -iname '*.cpp' -o    \
                -iname '*.h' -o    \
                -iname '*.hh' -o    \
                -iname '*.hpp'    \
                >> /e/some/where/global/prj_2/the_files

Then:

     cd /c/home/suresh/one/two/prj_1
     gtags -f /e/some/where/global/prj_1/the_files   \
              /e/some/where/global/prj_1

Likewise for Project_2.

Question 1:  In the above, is the "cd <project>" required or can the 
command "gtags -f <file> <db directory>" be issued from any directory?
With version 6.2.11, gtags failed without the "cd";  I can try with 6.3 
on Monday.

Using vim.exe I can set-up separate environment variables in two 
consoles as follows:

console 1:

   export GTAGSROOT=/c/home/suresh/one/two/prj_1
   export GTAGSDBPATH=/e/some/where/global/prj_1

console 2:

   export GTAGSROOT=/d/new/stuff/prj_2
   export GTAGSDBPATH=/e/some/where/global/prj_2

Using gvim, in one gvim, I can :cd to /c/home/suresh/one/two/prj_1 and 
in second gvim, :cd to /d/new/stuff/prj_2.

Question 2:  how will global know where the data-base is for each gvim?

(Aside:  I was initially confused by the terminology "GTAGSROOT" -- I 
thought it meant path to directory containing GTAGS, which would be same 
as GTAGSDBPATH;  it took some time to realize that GTAGSROOT refers to 
root of source directory.)

--Suresh