Merge pull request #707 from toctan/js2-mode

js2-mode is awesome
This commit is contained in:
Bozhidar Batsov 2014-10-11 08:53:42 +03:00
commit 2440f7fda9

View file

@ -33,16 +33,25 @@
;;; Code:
(require 'prelude-programming)
(prelude-require-packages '(js2-mode json-mode))
(eval-after-load 'js-mode
(require 'js2-mode)
(add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))
(add-to-list 'auto-mode-alist '("\\.pac\\'" . js2-mode))
(add-to-list 'interpreter-mode-alist '("node" . js2-mode))
(eval-after-load 'js2-mode
'(progn
(defun prelude-js-mode-defaults ()
;; electric-layout-mode doesn't play nice with smartparens
(setq-local electric-layout-rules '((?\; . after))))
(setq-local electric-layout-rules '((?\; . after)))
(setq mode-name "JS2")
(js2-imenu-extras-mode +1))
(setq prelude-js-mode-hook 'prelude-js-mode-defaults)
(add-hook 'js-mode-hook (lambda () (run-hooks 'prelude-js-mode-hook)))))
(add-hook 'js2-mode-hook (lambda () (run-hooks 'prelude-js-mode-hook)))))
(provide 'prelude-js)