Search code examples
emacsglobalctags

Universal ctags with emacs


Sorry I am trying to configure ctags with emacs but I am in trouble.

I compiled global with this configure:

./configure --with-universal-ctags=/usr/local/bin/ctags

and I executed make && make install. Then I changed the default target in the file .globalrc from native to new-ctags. Finally I executed ggtags-create-tags within emacs. Unfortunately I got the error

‘gtags’ non-zero exit: gtags: execvp failed.
 gtags: unexpected EOF.

Can anyone help me, thanks


Solution

  • Using universal ctags is as simple as:

    1. Run over a project (-R is to walk the project recursively, and -e is to use Emacs-compatible syntax):

      $ ctags -eR
      

      Alternatively if you like to only include files with certain extensions, you can use -a (append, creates a file if doesn't exist) option with find utility, like:

      $ find -name "*.cpp" -print -or -name "*.h" -print -or -name "*.hxx" -print -or -name "*.cxx" -print | xargs ctags -ea
      
    2. Run M-x visit-tags-table in Emacs, and navigate to the created TAGS file.