emacstagsgnu-global

how to set folder path for gtags


I am new to gtags, and have a question. I have a big project, such as android AOSP, I want gtags to parse some folders, how can I achieve it with gtags? I searched and got solution:

  1. use -f option with gtags, it seems doesn't support folders

Is there any good idea that I can set the folders path and gtags only process those folders?


Solution

  • UPDATE: author of the question came up with a better solution in the comments. I'm adding it here so it's easier to find:

    .. create tag file in the sub-directories I need, and add the directories to GTAGSLIBPATH when loading the project,


    My answer:

    You can limit what gtags indexes by adding list of files/directories to skip keyword in ~/.globalrc or /etc/gtags.conf. Here's a sample gtags.conf file.

    The problem is that often global/gtags packages don't install gtags.conf (at least it's not there in global-5.7.1-2 on ubuntu 12.04), so you'll need to either get it from global source distribution, or use someone else's gtags.conf as a reference. For instance here.

    Something like this should work. Note that leading / means from the top of the tree. Without it gtags will skip matching entries anywhere in the tree.:

    common:\
        :skip=/skip-this-dir/,/lib/and-this/,/include/and-this-one-too/: