Sunday, September 27, 2009

Install java script mode in emacs

From the terminal

wget http://code.google.com/p/js2-mode/wiki/InstallationInstructions
mv js2-20090723b.el ~/.emacs.d/lisp (js2-20090723b.el is the version at the time of writing)

#in Emacs

M-x byte-compile-file RET js2.el RET

#You need the following lines in your ~/.emacs file:
(add-to-list 'load-path "/export/home/user_name/.emacs.d/lisp") !!!change user_name accordingly!!!
(autoload 'js2-mode "js2" nil t)
(add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))

#make sure the path is in your "load-path" variable:
C-h v:load-path

#Load the mode:
M-x js2-mode

No comments:

Post a Comment