leoliu / ggtags

Emacs frontend to GNU Global source code tagging system.
http://elpa.gnu.org
577 stars 56 forks source link

GTAGSLIBPATH not searched #215

Closed rytis-paskauskas closed 2 years ago

rytis-paskauskas commented 2 years ago

Hello, I have a situation where I am working on "my" project, referencing external API/libs that live on a separate tree. I have an issue with looking up API's defs from my project using vanilla ggtags (no globalrc or gtags.conf or emacs customizations). cd /lib; gtags; export GTAGSLIBPATH=/lib cd /my/project; gtags At this point I should be good to go. Indeed, using command line global works as expected, e.g.: $ global -d esp_chip_info yields a list of locations in /lib. But from within emacs, I am unable to get this information with M .. M . [RET] esp_chip_info yields only a couple of locations in /my/project, where this function is called. But the search does not continue into the library, so at the end I don't have any useful info. In summary:

  1. ggtags gets me the references, but not definitions (which is fine, but not sufficient by itself).
  2. ggtags does not continue searching into the library, presumably because point 1 search returned a non empty result.

From what I understand, this logic corresponds to what the package creators had in mind, so it is intended / correct (?) behavior. But the consequences are that the definitions not found. Is it a bug/feature or there's something wrong with the default setup?

For whatever it's worth there is a mention of GSYMS, which does not exist: 2 objects located (using '/my/project/GSYMS').

rytis-paskauskas commented 2 years ago

Apparently the GTAGSLIBPATH had not propagated to Emacs. The issue was resolved with the help of M-x getenv, M-x setenv.