Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 298
plm Avatar asked Jul 18 '17 21:07

plm


People also ask

How do I use ctags in Emacs?

To use ctags with emacs, you must supply the '-e' parameter to instruct ctags to generate an emacs tag file. The commands below are often sourced into a Makefile and then run with a CompileCommand. Ctags also has a recursive option, '-R' . This is the most common (and simple) usage.

How do I use tags in Emacs?

' ( 'find-tag' ) – find a tag, that is, use the Tags file to look up a definition. If there are multiple tags in the project with the same name, use ` C-u M-. ' to go to the next match. 'M-x find-tag-other-window' – selects the buffer containing the tag's definition in another window, and move point there.

Does ctags work with rust?

DESCRIPTION. rusty-tags creates tags for source code navigation using ctags for a cargo(1) project, all of its direct and indirect dependencies and the Rust standard library. It can be run anywhere inside a cargo project.


1 Answers

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.

like image 147
Hi-Angel Avatar answered Sep 21 '22 14:09

Hi-Angel