From c721929078212ee2cff3d059ee1203c9ea40c3dd Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Mon, 9 May 2016 21:54:10 +0200 Subject: [PATCH] Configure js2-mode with use-package --- emacs/.emacs.d/init.el | 16 ++++++++++++---- emacs/.emacs.d/init.org | 3 --- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el index 8bb1fcc..52ef982 100644 --- a/emacs/.emacs.d/init.el +++ b/emacs/.emacs.d/init.el @@ -274,7 +274,7 @@ MODE1 is enabled and vice-versa." (append '(("/PKGBUILD$" . sh-mode) (".install$" . sh-mode) ("\\.jl$" . sawfish-mode) - ("\\.js\\(on\\)?$" . js2-mode) + ("\\.json$" . js-mode) ("\\.m\\(ark\\)?d\\(?:o?wn\\)?$" . markdown-mode) ("\\.php[345]?$" . php-mode) ("\\.tm?pl$" . html-mode) @@ -477,6 +477,17 @@ MODE1 is enabled and vice-versa." (use-package apache-mode :ensure t :defer t) +(use-package js2-mode + :ensure t + :mode (("\\.js\\'" . js2-mode) + ("\\.jsx\\'" . js2-jsx-mode)) + :config + (add-hook 'js2-mode-hook 'tern-mode) + (add-hook 'js2-mode-hook 'moz-minor-mode) + (add-hook 'js2-mode-hook 'electric-pair-local-mode) + (add-hook 'js2-mode-hook 'electric-indent-local-mode) + (add-hook 'js2-mode-hook 'flycheck-mode)) + ;;;; Hooks (add-hook 'eshell-first-time-mode-hook 'oni-eshell-set-prompt) @@ -600,9 +611,6 @@ MODE1 is enabled and vice-versa." ;; Reset the `default-directory' to my $HOME in jabber chat buffers. (add-hook 'jabber-chat-mode-hook 'oni:reset-default-directory) -(oni:add-hooks 'js2-mode-hook - #'tern-mode 'moz-minor-mode) - (oni:add-hooks 'lisp-mode-hook 'oni:set-emacs-lisp-symbols 'paredit-mode) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 02fc070..0a45569 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1450,7 +1450,6 @@ (add-hook 'css-mode-hook #'electric-pair-local-mode) (add-hook 'haml-mode-hook #'electric-pair-local-mode) (add-hook 'java-mode-hook #'electric-pair-local-mode) - (add-hook 'js2-mode-hook #'electric-pair-local-mode) (add-hook 'lua-mode-hook #'electric-pair-local-mode) (add-hook 'python-mode-hook #'electric-pair-local-mode) (add-hook 'scss-mode-hook #'electric-pair-local-mode) @@ -1494,7 +1493,6 @@ #+BEGIN_SRC emacs-lisp (add-hook 'css-mode-hook #'electric-indent-local-mode) - (add-hook 'js2-mode-hook #'electric-indent-local-mode) (add-hook 'php-mode-hook #'electric-indent-local-mode) (add-hook 'scss-mode-hook #'electric-indent-local-mode) (add-hook 'sh-mode-hook #'electric-indent-local-mode) @@ -1649,7 +1647,6 @@ (add-hook 'git-commit-mode-hook 'flycheck-mode) (add-hook 'go-mode-hook 'flycheck-mode) (add-hook 'html-mode-hook 'flycheck-mode) - (add-hook 'js2-mode-hook 'flycheck-mode) (add-hook 'lua-mode-hook 'flycheck-mode) (add-hook 'perl-mode-hook 'flycheck-mode) (add-hook 'php-mode-hook 'flycheck-mode)