lang/javascript: general refactor

+ No need for some rjsx-mode hooks, when it is derived from js2-mode
  (thus, js2-mode hooks will run in rjsx-mode).
+ Reorganized package configs with major modes at the top.
+ Fix incorrect usage of add-hook! with three arguments for rjsx-mode.
This commit is contained in:
Henrik Lissner 2018-04-20 02:44:04 -04:00
parent c08f6b25d9
commit 595d6215d2
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 60 additions and 59 deletions

View file

@ -31,6 +31,11 @@ ignore the cache."
(assq packages deps))
(t (error "Expected a package symbol or list, got %s" packages))))))
;;
;; Commands
;;
;;;###autoload
(defun +javascript/repl ()
"Open a Javascript REPL. Meaning either `skewer-repl', if any of the
@ -39,8 +44,8 @@ skewer-*-mode's are enabled, or `nodejs-repl' otherwise."
(call-interactively
(if (and (featurep 'skewer-mode)
(or skewer-mode skewer-css-mode skewer-html-mode))
'skewer-repl
'nodejs-repl)))
#'skewer-repl
#'nodejs-repl)))
;;;###autoload
(defun +javascript/skewer-this-buffer ()
@ -74,6 +79,11 @@ Run this for any buffer you want to skewer."
(if skewer-css-mode (skewer-css-mode -1))
(if skewer-html-mode (skewer-html-mode -1)))))
;;
;; Hooks
;;
;;;###autoload
(defun +javascript|add-node-modules-path ()
"Search the current buffer's parent directories for `node_modules/.bin`.
@ -100,6 +110,11 @@ If it's found, then add it to the `exec-path'."
collect buf)
(kill-process (tide-current-server)))))
;;
;; Advice
;;
;;;###autoload
(defun +javascript*tide-project-root ()
"Resolve to `doom-project-root' if `tide-project-root' fails."