Javascript & Emacs

Javascript & Emacs

So far I found there are no 'excellent' javascript mode, but instead there are 2 more/less good modes. The most recommended to edit .js files is js2-mode.el which I took from js2 Google Code and another one called javascript.el which is also highly recommended by many devs.

So far I did not formed final preferences and use both. To make fast switching in HTML mode I assigned keys C-c h for html-mode and C-c j for javascript-mode. While keep js2-mode as auto mode for editing .js2 files.

Very strange to see so powerful editing with lack of support of Javascript mode by default. While all understand it well, it seems there are not so many Lisp developers which also happen to program Javascript…

(setq load-path (cons "/home/alex/.emacs.d/js2-mode/build" load-path))
(autoload 'js2-mode "js2" nil t)
(add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))

(autoload 'javascript-mode "javascript" nil t)
(define-key global-map  "\C-cj" 'javascript-mode)

Comments

Comments powered by Disqus