MrMeeSeeks
MrMeeSeeks

Reputation: 91

gtags produces empty GTAGS file with pygments

I am trying to run gtags on a python code base with a pygments plug-in parser, but the GTAGS file produced is empty and the GRTAGS references stuff like "str" which just seems wrong to me.

Here are relevant parts of the .globalrc:

default:\
    :tc=native:tc=pygments:
pygments:\
    :tc=pygments-parser:tc=htags:

and pygments-parser is pretty straightforward, I guess. Global is version 6.6.2. I have read this might be a problem with ctags, which pygment uses for definition tags, however gtags --explain does not mention any usage of ctags - should it? The .globalrc does not specify any configuration of ctags, but judging by the pygments plug-in manual this should not be necessary as pygments uses it internally. Is that correct? What could be the cause

Upvotes: 1

Views: 2229

Answers (2)

Queue
Queue

Reputation: 1

I encountered a similar issue:

  1. Gtags couldn't recognize programming languages other than the ones it has basic support for, including .py and .vim, among others.
  2. When I set --gtagslabel to pygments, it generated an empty GTAGS file.

Check the EXUBERANT_CTAGS path in pygments_parser.py and ensure that ctags is exactly located there.

Upvotes: 0

Arkadiusz Drabczyk
Arkadiusz Drabczyk

Reputation: 12393

I also use global (GNU GLOBAL) 6.6.2. I don't have my own .globalrc. The following method described in /usr/share/gtags/PLUGIN_HOWTO.pygments works for me:

$ export GTAGSCONF=/usr/share/gtags/gtags.conf
$ export GTAGSLABEL=pygments
$ gtags
$ ls -Al G*
-rw-r--r-- 1 ja users  32768 May 28 22:22 GPATH
-rw-r--r-- 1 ja users 458752 May 28 22:22 GRTAGS
-rw-r--r-- 1 ja users 253952 May 28 22:22 GTAGS

After doing that I can use gtags mode inside Emacs to jump to a function definition and calls.

EDIT: I checked that in order for this to work I need to have a working ctags binary in my $PATH, it's also described in the help file I mentioned:

Make sure python and ctags can be invoked in your command line.
$ type python
python is /usr/bin/python
$ type ctags
ctags is /usr/local/bin/ctags

Upvotes: 1

Related Questions