Refactor js2-mode-hooks into one function

This commit is contained in:
Ivan Malison 2015-08-13 00:49:31 -07:00
parent 327cc90288
commit a5ccfdca4a

View File

@ -1734,6 +1734,8 @@ window is active in the perspective."
(uuid (imalison:uuid))) (uuid (imalison:uuid)))
(insert (format "console.log('%s//////////%s//////////');" identifier-string uuid)) (insert (format "console.log('%s//////////%s//////////');" identifier-string uuid))
(setq imalison:identifier-count (+ imalison:identifier-count 1)))) (setq imalison:identifier-count (+ imalison:identifier-count 1))))
(defun imalison:js2-mode-hook ()
;; Sensible defaults
(setq js2-bounce-indent-p nil (setq js2-bounce-indent-p nil
js2-basic-offset 4 js2-basic-offset 4
js2-indent-level 4 js2-indent-level 4
@ -1741,21 +1743,20 @@ window is active in the perspective."
js2-highlight-level 3 js2-highlight-level 3
js2-include-node-externs t js2-include-node-externs t
js2-mode-show-parse-errors nil js2-mode-show-parse-errors nil
js2-mode-show-strict-warnings nil) js2-mode-show-strict-warnings nil
;; jshint-configuration-path "~/Uber/dispatch"
(add-hook 'js-mode-hook 'js2-minor-mode)
(add-hook 'js2-mode-hook (lambda () (tern-mode t)))
(add-hook 'js2-mode-hook 'skewer-mode)
(add-hook 'js2-mode-hook (lambda () (setq js-indent-level 4
indent-tabs-mode nil indent-tabs-mode nil
js2-indent-level 4 js2-indent-level 4
js2-basic-offset 4 js2-basic-offset 4
js2-indent-switch-body t))) js2-indent-switch-body t)
(add-hook 'js2-mode-hook (lambda () (edconf-find-file-hook) ;; Make sure that editorconfig takes precedence
(tern-mode t)
(when nil (skewer-mode)) ;; TODO: reenable
(setq imenu-create-index-function (setq imenu-create-index-function
(lambda () (lambda ()
(imalison:flatten-imenu-index (imalison:flatten-imenu-index
(js2-mode-create-imenu-index)))))) (js2-mode-create-imenu-index)))))
(add-hook 'js2-mode-hook 'imalison:js2-mode-hook)
(add-hook 'js2-mode-hook 'js2-imenu-extras-mode))) (add-hook 'js2-mode-hook 'js2-imenu-extras-mode)))
(use-package js2-refactor (use-package js2-refactor