Questions tagged [js2-mode]

An improved JavaScript mode for GNU Emacs that emulates many desirable features of IDEs.

You can download it here.

Features:

  • Variable (adjustable) indentation
  • Accurate syntax highlighting
  • Highlighting of syntactic errors and many semantic errors
  • Strict-mode warning reporting (such as duplicate var declaration)
  • Smart line-wrapping in comments and strings
  • Typing helpers (e.g. matching quotes/brackets)
  • Code-folding (collapse element as {...})
  • Supports JavaScript 1.5, 1.6 (including E4X), 1.7 and 1.8
  • Customizable colors, or use font-lock defaults
  • Many customization options

Note - this mode is for GNU Emacs, version 22 and higher. It does not support XEmacs.

js2-mode was written by Steve Yegge. You can find more information on js2-mode at the official website: http://code.google.com/p/js2-mode/

22 questions
1
vote
1 answer

What does "extern" mean in JavaScript?

I just started to use js2-mode in Emacs, and I found some variables like js2-global-externs and js2-additional-externs. The doc string says it is "A list of any extern names you'd like to consider always declared." I don't understand what "extern"…
user159
  • 1,343
  • 2
  • 12
  • 20
1
vote
2 answers

The js2-mode.el compilation error

I am getting an error when I compile js2-mode.el using byte-compile-file command in emacs. js2-mode.el:6778:21:Error: Lisp nesting exceeds `max-lisp-eval-depth' How do I get rid of this?
sudeepdino008
  • 3,194
  • 5
  • 39
  • 73
1
vote
1 answer

Use swank-js without js2-mode as major mode in emacs

I don't want to use js2-mode as major mode when editing js files. But I find I use swank-js very often(with magnar's slime-js setting). Of course I know that swank-js depends on js2-mode Can I just (require 'js2-mode)(means not as major mode) and…
Saddle Point
  • 3,074
  • 4
  • 23
  • 33
0
votes
1 answer

Go to definition emacs evil with xref-js2

I'm trying to switch to emacs from vim. I've installed js2-mode, xref-js2 and evil of course. And when I try to go to definition with M-. I get the message: "Previous command was not evil repeat:..." and previous command. So is there any way (work…
gi4c0
  • 31
  • 5
0
votes
0 answers

How emacs js2-mode jump to definition open in other window?

In js2-mode, M-. runs the command js2-jump-to-definition, this works great. But I want it go to the definition in other window. I find the code js2-jump-to-definition in Github. What is the easiest way to make it open in other window? (defun…
Xiaorong Liao
  • 1,201
  • 14
  • 14
0
votes
1 answer

Emacs js2-mode Syntax Error

I am using emacs (js2-mode) for coding javaScript. Here is a simple code snippet where emacs always shows me a syntax error: The "{" and "return a" are always colored…
ThinkPad
  • 9
  • 1
  • 1
  • 2
0
votes
1 answer

Returning values in functions that don't need to return a value

I'm trying out js2-mode, which is a kind of javascript IDE in emacs. One of the features is syntax error highlighting and style warnings. Since turning it on, I've noticed that I'm getting this one warning all over my code: anonymous function does…
harumph
  • 169
  • 3
  • 10
1
2