Emacs: How to generate etags for coffeescript?
Asked Answered
I

2

6

I just found the coffeetags tool and can confirm that it works with vim.

Is there something similar for Emacs? Has anyone managed to get etags working for Emacs with coffeescript?

Impress answered 9/6, 2013 at 16:29 Comment(0)
K
1

Have you tried following recipe? But you may need to use exuberant ctags, not default etags...

Kenay answered 9/6, 2013 at 17:2 Comment(0)
I
6

This it what I've done (thanks to Alex Ott for the link):

  1. Install Exuberant ctags via Emacs package manager
  2. Install ctags
  3. Create a .ctags file in your project root directory (here is the link to the original Gist):

    --langdef=CoffeeScript
    --langmap=CoffeeScript:.coffee
    --regex-CoffeeScript=/(^|=[ \t])*class ([A-Za-z.]+)( extends [A-Za-z.]+)?$/\2/c,class/
    --regex-CoffeeScript=/^[ \t]*@?([A-Za-z.]+):.*[-=]>.*$/\1/f,function/
    --regex-CoffeeScript=/^[ \t]*([A-Za-z.]+)[ \t]+=.*[-=]>.*$/\1/f,function/
    --regex-CoffeeScript=/^[ \t]*([A-Za-z.]+)[ \t]+=[^->\n]*$/\1/v,variable/
    
  4. Generate the TAGS file: ctags -e -R source_folder

Impress answered 9/6, 2013 at 19:4 Comment(2)
ctags does not have the -e option on my vm. Try etas -R source_folder in case you don't either.Extempore
Aren't these definitions better? And by the way, why do you not quote them? The way they're given, they won't work in any shell that I know.Windage
K
1

Have you tried following recipe? But you may need to use exuberant ctags, not default etags...

Kenay answered 9/6, 2013 at 17:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.