Closed CSRaghunandan closed 7 years ago
If I remember correctly, GTAGSLABEL
is only used to choose the target in gtags.conf
, which has something like these lines:
default:\
:tc=native:tc=pygments:
native:\
:tc=gtags:tc=htags:
user:\
:tc=user-custom:tc=htags:
ctags:\
:tc=exuberant-ctags:tc=htags:
pygments:\
:tc=pygments-parser:tc=htags:
.......
If I am not mistaken the ctags executable is specified at compile time, so no amount of setting GTAGSLABEL
will help.
You might want to raise this issue on global's mailing list so that it can work better with universal-ctags
.
I was going through this reddit thread and people have mentioned they got it to work with universal-ctags
. I was thinking, I did something wrong with my setup that messed things up. I followed the exact steps mentioned in that thread, but to no avail :(
I guess you need to compile global
and point to the universal-ctags
executable something like this:
./configure --prefix=${global_install_dir} --with-exuberant-ctags=${my_ctags_bin_location}
I compiled global like so :-
./configure --with-exuberant-ctags=/usr/local/bin/ctags
/usr/local/bin/ctags
points to the universal-ctags
executable. It did not work.
Do I have to remove and compile it again like you mentioned above ? Would it make any difference?
Looks like you compiled it correctly. Try this to see if it global works without using the ggtags
frontend.
$HOME/.globalrc
to your project as file gtags.conf
gtags.conf
default:\
:tc=native:
to
default:\
:tc=ctags:
gtags
Does it work i.e. complete without errors?
Hmm setting default to :tc=ctags:
doesn't seem to work for universal-ctags. Instead I changed default to :tc-new-ctags:
and it seems to work.
BUT, there is one big problem. Even if i make a slight modification for the files and save it, the tags stop working. I see no definitions in it. I've to delete the tags and regenerate them again. This is not how it's supposed to work I guess? Whats going on?
EDIT: Tag files work fine for python-mode
. I was testing with rust-mode
and the problem i mentioned above is in rust-mode
. I'll try for some other modes and report back.
EDIT 2: in js2-mode
it works fine the first time i create it. But after I save it, ggtags-mode
tries to use ctags
backend and it blows up with an error again. Only python-mode
works. somehow, i've no idea how.
On the bright side, I finally got global
to work with universal-ctags
. But, it looks like it has no support in ggtags-mode
:(
That's indeed odd. I suggest report to gnu global mailing list where people would have better idea.
If someone stumbles upon this problem:
GNU Global needs to be compiled with ./configure --with-universal-ctags=/usr/local/bin/ctags
or whereever your universal-ctags binary is. For example, the universal-ctags binary for Gentoo is /usr/bin/exuberant-ctags
[sic] from the package dev-util/ctags
(which gets it's source from https://github.com/universal-ctags/ctags, yes it is really confusing).
ggtags is using the gtagslabel ctags
. You can simulate it's behavior with the command gtags --gtagslabel=ctags
You can use the environment variable GTAGSLABEL
to change this and get this environment variable in emacs somehow. (Some emacsen create their own environment once and then load in from a file. So check if it's really set with M-x getenv
.)
There is this in /etc/gtags.conf
new-ctags:\
:tc=universal-ctags:tc=htags:
and running gtags --gtagslabel=new-ctags
works indeed. So setting GTAGSLABEL=new-ctags should work.
Or, to make it use universal-ctags permanently, you can change the lines in /etc/gtags.conf
from
ctags:\
:tc=exuberant-ctags:tc=htags:
to
ctags:\
:tc=universal-ctags:tc=htags:
Hello,
I'm running on Mac, emacs 25.1-1. I install
global
and installeduniversal-ctags
usingbrew
. But, when I try to generate tags,gtags
exits with an error (because I do not havectags
installed) and emacs is executinggtags
command withctags
label.after browsing a bit, I found out that to use
gtags
with universal tags, we need to specifygtagslabel
asnew-ctags
and as expected, if rungtags --gtagslabel=new-ctags
in shell, the tags are generated. I get an error if i try to use gtags withctags
as label.Even after I added
export GTAGSLABEL=new-ctags
in mybash_profile
, emacs still tries to run gtags withctags
label instead ofnew-ctags
label and I get this error :-How can I fix this problem? Is there a way to instruct ggtags-mode to always use
universal-ctags
?