aboutsummaryrefslogtreecommitdiffstats
path: root/emacs/.emacs.d/init.org
diff options
context:
space:
mode:
Diffstat (limited to 'emacs/.emacs.d/init.org')
-rw-r--r--emacs/.emacs.d/init.org38
1 files changed, 38 insertions, 0 deletions
diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org
index 9b311b9..74ab5f5 100644
--- a/emacs/.emacs.d/init.org
+++ b/emacs/.emacs.d/init.org
@@ -195,6 +195,15 @@ Computing Environment".
(setq auto-save-list-file-prefix (oni:data-location "auto-save-list/.saves-"))
#+END_SRC
+*** Additional file type mappings
+
+ Load =*.js= files with [[JavaScript IDE mode]]. ~js2-mode~ is a better
+ JavaScript mode than plain old ~js-mode~.
+
+ #+BEGIN_SRC emacs-lisp
+ (add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))
+ #+END_SRC
+
* Typographic style
Emacs being a text editor has options on how to handle your text.
@@ -1134,6 +1143,35 @@ Computing Environment".
(add-hook 'lisp-mode-hook 'company-mode)
#+END_SRC
+** JavaScript IDE mode
+ :PROPERTIES:
+ :header-args: :tangle "init/oni-js2-init.el"
+ :END:
+
+ Since ~js2-mode~ isn't loaded when Emacs starts put the
+ configuration in a different file so that it doesn't cause a
+ slowdown in startup time.
+
+ #+BEGIN_SRC emacs-lisp :tangle yes
+ (with-eval-after-load 'js2-mode (load "oni-js2-init"))
+ #+END_SRC
+
+ Keep the byte-compiler happy by requiring ~js2-mode~, by this time
+ it will have been loaded anyway.
+
+ #+BEGIN_SRC emacs-lisp
+ (require 'js2-mode)
+ #+END_SRC
+
+ Silence warnings about trailing commas in JavaScript code. I usually
+ write code that goes through Babel or something similar and doesn't
+ actually die when a trailing comma is present. Also this should
+ really be handled by a linter such as eslint.
+
+ #+BEGIN_SRC emacs-lisp
+ (setq js2-strict-trailing-comma-warning nil)
+ #+END_SRC
+
* Applications
- [[file:init/dired-init.org][Dired]] :: The Emacs file manager. Very powerful, and I don't use it