off topic but does anyone on OSX 10.7 use Exuberent Ctags successfully?

873 views
Skip to first unread message

localredhead

unread,
Jan 24, 2012, 1:47:46 PM1/24/12
to Rails On Emacs
I have lurked a bit in the emacs IRC trying to find an answer to this
but I am not having much luck. The general consensus is to use grep.
I can do this but I would rather use the tags table to jump to
functions and files.

One thing I use more than anything is `jump to function`. I can live
without it but not having it makes me miss my Intellij because that
feature alone really enhances project navigation. I tend to jump to
other files very quickly for reference points and without the ability
to do this my work flow is affected.

That being said - to get this working I need to generate a valid ctags
file, however on OSX 10.7 when I build the ctags file with `-e` and
then try to use it with `M - .` I get a stack overflow error matching
the regexp. When I search for an answer to this issue is I quickly
get annoyed thanks to our favorite troubleshooting website - Stack
Overflow.

Any help would be most appreciated!
-Levi


localredhead

unread,
Jan 24, 2012, 1:51:10 PM1/24/12
to Rails On Emacs
In retrospect I could care less about the CTAGS file as long as I can
jump to a function in a source file with 1 command without opening a
split-pane buffer. If there is a way to do this (even using grep)
that would suffice!

-Levi

Jacob Tjørnholm

unread,
Jan 24, 2012, 2:09:50 PM1/24/12
to emacs-o...@googlegroups.com
Hi, 

In retrospect I could care less about the CTAGS file as long as I can
jump to a function in a source file with 1 command without opening a
split-pane buffer.  If there is a way to do this (even using grep)
that would suffice!


You mean jumping to a method in the current buffer? Sorry for the plug, but I wrote about exactly that a few years ago: 

I'm not sure if this is what you wanted...if not, how would you go about referencing the method you want? There are bound to be a lot of ambiguous names, especially in the controllers :)

As for jumping between files, I usually keep all files loaded and switch buffers with ido-switch-buffer. I'm pretty sure it takes <1 second per switch on average. IDO is just awesome. 

/Jacob


Johan Andersson

unread,
Jan 24, 2012, 2:10:15 PM1/24/12
to emacs-o...@googlegroups.com
What kind of ctags executable are you using? The one that comes with OSX? Try installing Ctags via Homebrew. See https://github.com/mxcl/homebrew/blob/master/Library/Formula/ctags.rb

localredhead

unread,
Jan 24, 2012, 2:18:50 PM1/24/12
to Rails On Emacs
I was using the one in Homebrew but it has the same issue - I then
uninstalled it and built the executable from source, only to run into
the same issue. Short story - I think I've tried them all. I even
went back to an older version at one point.

It just seems that the etags mode of ctags does not generate a valid
tags file for emacs consumption. Many of the classes referenced in
the tags file have no data and look like this:

app/models/deal_influence.rb,59
class DealInfluence < ActiveRecord::Base DealInfluence 1,0


On Jan 24, 11:10 am, Johan Andersson <johan.rej...@gmail.com> wrote:
> What kind of ctags executable are you using? The one that comes with OSX?
> Try installing Ctags via Homebrew. Seehttps://github.com/mxcl/homebrew/blob/master/Library/Formula/ctags.rb

Johan Andersson

unread,
Jan 24, 2012, 2:24:02 PM1/24/12
to emacs-o...@googlegroups.com
I use Ctags from Homebrew with Mactag (https://github.com/rejeep/mactag) and that works just fine! The ctags executable that comes with OSX has never worked for me though...

theturingmachine

unread,
Jan 26, 2012, 7:07:31 AM1/26/12
to Rails On Emacs
I use this one: Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren
Hiebert, and it works fine...installed with homebrew

When you install emacs with homebrew (at least from head) it installs
it's own version of ctags which is less powerful (no ruby support for
example) so I had to reinstall them after emacs.

Jacob Tjørnholm

unread,
Jan 26, 2012, 7:15:53 AM1/26/12
to emacs-o...@googlegroups.com
I have the exact same version of ctags installed (from homebrew), but the generated tags do NOT work with this Emacs: "GNU Emacs 23.2.1 (x86_64-apple-darwin, NS apple-appkit-1038.29)", downloaded from http://emacsformacosx.com/

I get the same error as Levi (OP). 

/Jacob

localredhead

unread,
Jan 26, 2012, 8:29:49 PM1/26/12
to Rails On Emacs
I built a new rails development environment in Arch because I need to
do a clean install on my OSX box.

Once I got everything installed and configured I hit the same problem
with the ctags file. It is not related to OSX at all - I don't know
what I am doing wrong but following the common instructions that is
sprinkled around the internet does not generate a valid CTAGS file
from Ruby source. I've tried different methods of generation and
every time I try to use the tags table I get the stack overflow error
processing the tags file.

::sigh:: If I didn't know that functionality existed I could probably
live without it... but this really bugs me. Thanks for the input
everyone - I suppose I'll try again once emacs 24 actually drops.

-Levi

On Jan 26, 4:15 am, Jacob Tjørnholm <cho...@gmail.com> wrote:
> I have the exact same version of ctags installed (from homebrew), but the
> generated tags do NOT work with this Emacs: "GNU Emacs 23.2.1
> (x86_64-apple-darwin, NS apple-appkit-1038.29)", downloaded fromhttp://emacsformacosx.com/

theturingmachine

unread,
Jan 27, 2012, 6:34:58 AM1/27/12
to Rails On Emacs
I don't know for sure your problem, but you may check:

1) The ctags use the -e flag for emacs compatibility...ctags -e ....
2) Inside emacs make sure you use the function visit-tags-table to
tell emacs which tag file to use

Here: https://gist.github.com/1688384 you can see a function I use to
generate the ctags for my ruby projects...hope it gives you some
clues.

Greetings

taranaki

unread,
Feb 1, 2012, 2:02:51 PM2/1/12
to Rails On Emacs
I recently discovered Exuberant Ctags as a solution to poor parsing of
some C++ code by the default etags shipped with emacs. On a linux
server this worked great where the default emacs ctags failed (e.g. to
find class LINKAGE_NAME Foo ...).

Having suffered from reduced functionality (due to more modern code)
of Emacs' ctags for awhile, I was eager to install this on my Mac.
Unfortunately, I'm having the same problems all of your are
describing: it seems that this version of ctags (5.8 in my case) does
not generate a valid emacs TAGS file (emacs version 23.3.1).

I'm about to try building an older version of ctags because this tags
file does indeed look like it has errors. It contains lines such as:
(null),1250
^^ ,738
/var/folders/m7/6b_4vfzx06b9mg52lc9d31r0001jmd/T//tags.VQr715,1130
,etc.

-Cameron

taranaki

unread,
Feb 1, 2012, 3:10:17 PM2/1/12
to Rails On Emacs
I was only able to compile versions 5.6 and greater, but all of them
exhibited the same problems. I have reported a bug on the sourceforge
project. It's possibly a different issue than you're all having with
Ruby parsing, but something is clearly wrong with the generation of
emacs TAGS files on OSX.

Best,
Cameron

localredhead

unread,
Feb 1, 2012, 3:58:58 PM2/1/12
to Rails On Emacs
I also tried to go back to an older version without success.

I do not believe this is an issue related to OSX even though that is
what got us here. The issue is generating a proper emacs CTAGS file
using the latest built binaries from the Exuburent CTAGS source. In
my case I am unable to generate it valid tags of ruby source.

-Levi

theturingmachine

unread,
Feb 2, 2012, 4:11:38 AM2/2/12
to Rails On Emacs
From the excuberant ctags man:

Options:

-e Enable etags mode, which will create a tag file for use with the
Emacs editor. Alternatively, if ctags is
invoked by a name containing the string
"etags" (either by renaming, or creating a link to, the executable),
etags mode will be enabled. This option must appear before
the first file name.

Simão Mata

unread,
Apr 8, 2012, 2:12:22 PM4/8/12
to emacs-o...@googlegroups.com
So anyone got this working?
Still having the same problems with the latest ctags version from brew :|

Le Wang

unread,
Apr 15, 2012, 7:50:46 PM4/15/12
to Rails On Emacs
Nope. Having same problems with homebrew compiled exuberant ctags. I
see taranaki has filed this bug:
http://sourceforge.net/tracker/index.php?func=detail&aid=3482809&group_id=6556&atid=106556

Simao Mata

unread,
Apr 16, 2012, 3:16:43 AM4/16/12
to emacs-o...@googlegroups.com
I also filed a bug report, no response yet.

Anyone had success compiling ctags without homebrew?

Chris TenHarmsel

unread,
Jun 28, 2012, 11:35:45 AM6/28/12
to emacs-o...@googlegroups.com
Have you tried RTags: http://rubygems.org/gems/rtags

I don't use tags to jump around too much, but I know I use rtags to generate my tags file.

localredhead

unread,
Oct 9, 2012, 2:14:24 PM10/9/12
to emacs-o...@googlegroups.com
This works now with emacs 24 on ubuntu 12.04.  I'm using the ctags installed with apt-get and nothing else special.

Anyone have any luck recently on osx lion ?

theturingmachine

unread,
Oct 10, 2012, 5:44:54 AM10/10/12
to emacs-o...@googlegroups.com
I had some problems compiling it as it would generate invalid files.

You should see this bug report.


I did: export CFLAGS=-O0

before compiling and then it worked for me. Also make sure you are not compiling with llvm

localredhead

unread,
Mar 23, 2013, 12:02:27 AM3/23/13
to emacs-o...@googlegroups.com
Thank you for this.

I can confirm that ctags works if you 'export CFLAGS=-O0' and then install ctags using brew.

I put together this bit to build the tags file correctly:

(defun build-ctags ()
  (interactive)
  (message "building project tags")
  (let ((root (eproject-root)))
    (shell-command (concat "bundle show --paths | xargs  ctags -a -e -f TAGS --tag-relative -R app lib spec config bin vendor")))
  (visit-project-tags)
  (message "tags built successfully"))
(setq tags-case-fold-search t)
(setq tags-revert-without-query 1) ;to avoid being asked to load the file.
(defun visit-project-tags ()
  (interactive)
  (let ((tags-file (concat (eproject-root) "TAGS")))
    (visit-tags-table tags-file)
    (message (concat "Loaded " tags-file))))

Sean Gilbertson

unread,
Apr 9, 2013, 10:26:49 AM4/9/13
to emacs-o...@googlegroups.com
The `export CFLAGS=-O0` tip was brilliant and worked great. Thanks!
Reply all
Reply to author
Forward
0 new messages