From fa64e279146307107a7437cf911b5263cc78d0a3 Mon Sep 17 00:00:00 2001 From: toctan Date: Wed, 9 Jul 2014 20:15:26 +0800 Subject: [PATCH 1/2] js2-mode is awesome --- modules/prelude-js.el | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/modules/prelude-js.el b/modules/prelude-js.el index 3a52794..bc53321 100644 --- a/modules/prelude-js.el +++ b/modules/prelude-js.el @@ -32,17 +32,26 @@ ;;; Code: +(prelude-require-package 'js2-mode) (require 'prelude-programming) -(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) From edd83dc60bbb10c2984e00d9d8e8ba2c0e3506ce Mon Sep 17 00:00:00 2001 From: toctan Date: Sat, 11 Oct 2014 11:34:45 +0800 Subject: [PATCH 2/2] Add json-mode --- modules/prelude-js.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/prelude-js.el b/modules/prelude-js.el index bc53321..709cf19 100644 --- a/modules/prelude-js.el +++ b/modules/prelude-js.el @@ -32,8 +32,8 @@ ;;; Code: -(prelude-require-package 'js2-mode) (require 'prelude-programming) +(prelude-require-packages '(js2-mode json-mode)) (require 'js2-mode)