clone from mooz's js2-mode