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,28 +1734,29 @@ 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))))
(setq js2-bounce-indent-p nil (defun imalison:js2-mode-hook ()
;; Sensible defaults
(setq js2-bounce-indent-p nil
js2-basic-offset 4 js2-basic-offset 4
js2-indent-level 4 js2-indent-level 4
js2-basic-offset 4 js2-basic-offset 4
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" indent-tabs-mode nil
(add-hook 'js-mode-hook 'js2-minor-mode) js2-indent-level 4
(add-hook 'js2-mode-hook (lambda () (tern-mode t))) js2-basic-offset 4
(add-hook 'js2-mode-hook 'skewer-mode) js2-indent-switch-body t)
(add-hook 'js2-mode-hook (lambda () (setq js-indent-level 4 (edconf-find-file-hook) ;; Make sure that editorconfig takes precedence
indent-tabs-mode nil (tern-mode t)
js2-indent-level 4 (when nil (skewer-mode)) ;; TODO: reenable
js2-basic-offset 4 (setq imenu-create-index-function
js2-indent-switch-body t))) (lambda ()
(add-hook 'js2-mode-hook (lambda () (imalison:flatten-imenu-index
(setq imenu-create-index-function (js2-mode-create-imenu-index)))))
(lambda ()
(imalison:flatten-imenu-index (add-hook 'js2-mode-hook 'imalison:js2-mode-hook)
(js2-mode-create-imenu-index))))))
(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