1

I use Emacs to write web app in Rails + Angularjs.

Since angularjs api doc is not so great, I've to check angularjs source code frequently.

It's easy to locate ruby method code in irb console.

Is it possible to easily locate js source code from node console or emacs?

I also open to other editors and other solution. But no IDE, cause my computer is Ubuntu.

Edit: http://docs.angularjs.org/api has view_source feature. It can help me locate the source easily. But only for angularjs1.2.0rc1

5
  • 1
    are you looking for tags? (gnu.org/software/emacs/manual/html_node/emacs/Tags.html) ? Commented Aug 14, 2013 at 3:52
  • @akonsu, not exactly, similar as tags, but I prefer solution focus on javascript, not a general solution Commented Aug 14, 2013 at 6:18
  • Tern (by Marijn Haverbeke) works quite well for me. Commented Aug 14, 2013 at 10:22
  • js2-mode integrates with imenu - I'd try to investigate this approach. This might be better then tags because js2-mode has a better understanding of the source structure. But I didn't explore this possibility in detail. Commented Aug 14, 2013 at 11:24
  • @huaiyuan, I try Tern several month ago, but not installed successfully on my local. Maybe I need to review it again Commented Aug 15, 2013 at 1:41

1 Answer 1

3

Exuberant ctags supports javascript among others, and with the -e option (or when using etags) generates an Emacs-compatible TAGS file.

(There's also jsctags, but last I heard this did not provide Emacs support.)

Once you have a compatible TAGS file, see the Wiki for usage details.

Take careful note that Emacs provides its own ctags & etags binaries, which are different to the ones provided by Exuberant ctags (in particular the former does not support javascript, but the latter is more comprehensive in general). Make sure that you're running the program you think you're running. (If you pass the --version flag, "Exuberant Ctags" will declare itself as such.)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.