I am generating a tags file for emacs for my Ruby on Rails project with the following command:
ctags -f TAGS --extra=-f --languages=-javascript --exclude=.git --exclude=log -e -R . $(rvm gemdir)/gems/
When I try to find tags (Using M-.) some tags are working fine, but with lots of other tags I get errors like:
tag-find-file-of-tag-noselect: File /Users/simao/Documents/sp/ofe/° ¡ not found
etags-goto-tag-location: Rerun etags: `^class Tools::FilteringSteps' not found in /Users/simao/Documents/sp/ofe/lib/geo_db.rb
How are you generating tags for your RoR projects with emacs? Did you ever see this problem before?
This is the output of ctags --version
Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
Compiled: Mar 9 2012, 15:47:35
Addresses: <[email protected]>, http://ctags.sourceforge.net
Optional compiled features: +wildcards, +regex
My emacs version:
GNU Emacs 24.0.95.1 (x86_64-apple-darwin, NS apple-appkit-1038.36) of 2012-04-02
Yeah, yeah, yeah. ;-)
Why would you care about not using ctags in the first place? Ctags is a great project and it does support many (like 50) languages. But Ruby support is very weak, the parser is not in good condition and it has not been changed 4 years now.
Unfortunately all the others (I found 2) Ruby ctags generators are either outdated (no Ruby 1.9+ support) or very slow. But there is a solution! It is called ripper-tags. https://github.com/tmm1/ripper-tags
gem install ripper-tags
cd your_project/
ripper-tags -R # for vim
ripper-tags -R -f TAGS # for emacs
This project leverages built-in Ruby parser API called Ripper. It is fast and it works as expected. It is almost as fast as ctags, but giving the most accurate results. Warning: It does NOT support Ruby 1.8.
If you like ripper-tags and you want to have all tags generated automatically upon gem installation, you can check out my gem-ripper-tags which does that. Unfortunately it does not support Emacs at the moment (patch accepted - quite easy to do). More info at: https://github.com/lzap/gem-ripper-tags
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With