HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
mooz
js2-mode
Emacs Lisp2011–2019
mooz / js2-mode

js2-mode

Improved JavaScript editing mode for GNU Emacs

9Distinct people
11Mentions
1Explicit recommenders
1.3KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Improved JavaScript editing mode for GNU Emacs

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

Yeah. My favorite example is JS-2 mode[1]. It's a brilliant mode for editing JavaScript released by Steve Yegge. However, it had some shortcomings and (minor) bugs; Yegge did…

tikhonj used a recommendation phrase. One indexed comment matches. This is a phrase match, not a verdict.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 3:56:07 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year11 dated mentions

Observed mentions: 2011-10-31 23:08:38 UTC to 2019-08-29 11:50:28 UTC.

01232011-01-01 00:00:00 UTC to 2012-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments20112012-01-01 00:00:00 UTC to 2013-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments2013-01-01 00:00:00 UTC to 2014-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2014-01-01 00:00:00 UTC to 2015-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2015-01-01 00:00:00 UTC to 2016-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments20152016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 1 mentions; 1 submissions, 0 comments2019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2019

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20112011-01-01 00:00:00 UTC2012-01-01 00:00:00 UTC202
20122012-01-01 00:00:00 UTC2013-01-01 00:00:00 UTC303
20132013-01-01 00:00:00 UTC2014-01-01 00:00:00 UTC000
20142014-01-01 00:00:00 UTC2015-01-01 00:00:00 UTC202
20152015-01-01 00:00:00 UTC2016-01-01 00:00:00 UTC000
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC202
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC000
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC110
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC101

What Hacker News says

11 sources
The issue tracker for js2-mode illustrates that such a parsing approach is no guarantee of real-world accuracy either. https://github.com/mooz/js2-mode/issues The goal just shifts from having a semi-accurate regexp tokenizer, to having the language mode's complex parser match the complex parser of the language it targets—which will pretty much never happen, unless the language is exquisitely simple, like maybe restricted dialects of Scheme... or Brainfuck.
In How I fixed a bug in Atom
> I've never used a language mode that worked properly in all cases. You need a full parser for that to happen, most mode authors don't bother[0]. JS2-mode (https://github.com/mooz/js2-mode/) does that (or attempts to). Most syntactic colorisers are souped-up tokenisers, not actual parsers. It suffices in 99% of cases, but breaks badly elsewhere. [0] it would help if more languages made fast parsing machinery externally available as a convenient API. ALAS, that's rarely the case, even less so for fast parsing machinery which doesn't throw the information you need for syntactic coloration out the window.
In How I fixed a bug in Atom
Yes, tit the default mode is through regexs, and most of the modes use it. But I think the OP's point was you are not limited by it, besides semantic (which I haven't never bothered to setup, there is js2-mode[0] as examples of modes that don't use regexps to operate on the language. There is even js2-refactor[1] built on top of it. You can read about js2-mode origin story here[2], and you would see that lack of threads in elisp hindered its development. [0]: https://github.com/mooz/js2-mode [1]: https://github.com/magnars/js2-refactor.el [2]: http://steve-yegge.blogspot.com/2008/03/js2-mode-new-javascr...
In Taking it to Th’emacs
tikhonj·Apr 23, 2012Recommendation phrase
Yeah. My favorite example is JS-2 mode[1]. It's a brilliant mode for editing JavaScript released by Steve Yegge. However, it had some shortcomings and (minor) bugs; Yegge did not have time to support it any more. [1]: http://code.google.com/p/js2-mode/ Then somebody cloned it on GitHub[2], changed the indentation, fixed some bugs and added some features. In the past, using JS-2 mode was a bit of a compromise--intelligence at the cost of weird behavior. Now there is no compromise at all. [2]: https://github.com/mooz/js2-mode
In Open sourcing all my private projects
Like dangrossman said, use console.log. Check out these videos from Paul Irish on using console effectively: http://www.youtube.com/watch?v=4mf_yNLlgic http://www.youtube.com/watch?v=nOEw9iiopwI Since you are an emacs user, you may want to try mooz's community fork of Yegge's js2-mode https://github.com/mooz/js2-mode Haven't tried it myself, but you may also want to look at Moz Repl in emacs. http://www.emacswiki.org/emacs/MozRepl Finally, check out Christian Johansen's and Magnar Sveens .emacs.d for some ideas on how to set up your emacs for javascript. https://github.com/magnars/.emacs.d https://github.com/cjohansen/.emacs.d For TDD, you 3 main options worth checking out are: Buster.js looks really promising and does both server-side and client-side testing. If you don't like buster.js for whatever reason, Mocha is a popular node.js ser
Read the rest
ver-side testing option and Jasmine is a popular client-side testing option.
In Ask HN: JavaScript Dev Tools
Since everyone is chiming in with ways to prevent this sort of thing, here is another: js2 mode for Emacs[1]. This is a mode originally written by Steve Yegge and then modified by some other people (be sure to get that version) that actually parses the code and, among other things, highlights global variables in a different color than local ones. I find this, along with the other things js2 does, helps prevent a whole host of annoying JavaScript issues, as I type. [1]: https://github.com/mooz/js2-mode
In How One Missing `var` Ruined our Launch

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.