Hierarchical GTAGS TAG file

320 views Asked by At

One liner: I am looking for a "Hierarchical" Tags file setup whereas if global cannot find the TAGSDB in the GTAGSDBPATH directory then it climbs up the dir chain till it finds another.

long liners:

I have this project file structure

/vob/project-name/src/ ==> The ROOT of the project src directory

Under this directory there are subdirs like: ./utils, ./common, ./iplib, ./ipv6lib, ./subsystem1, ./subsystem2 etc

I work on subsystem1

The big tags file is HUGE.

I have..

setenv  GTAGSROOT /vobs/project-name/src
setenv  GTAGSDBPATH /vobs/project-name/src  

These take 40mins to build.

I also have a tags file in ./subsystem1/sre

Currently I have two shell files:

toptags :

setenv  GTAGSROOT /vobs/project-name/src
setenv  GTAGSDBPATH /vobs/project-name/src  

bottomtags:

setenv  GTAGSROOT /vobs/project-name/src/subsystem1/src
setenv  GTAGSDBPATH /vobs/project-name/src/subsystem1/src

In this way, I can build the TOP project file rarely and the bottomtags every now and then as there is where the churn is.

Also, currently, when I do a (setq ggtags-update-on-save nil) then each time I write a file three processes are spawned off that do not die. I got a stern e-mail for sysadmin for keeping 150 processes standing.

1

There are 1 answers

0
Pradhan On

locate-dominating-file is just what you need.

(locate-dominating-file default-directory GTAGS-FILE-NAME)

will give you the name of the closest enclosing directory containing a file called GTAGS-FILE-NAME, or nil if there is no such directory.