diff options
author | Tom Willemse | 2017-12-30 23:02:38 -0800 |
---|---|---|
committer | Tom Willemse | 2017-12-30 23:02:38 -0800 |
commit | 897a674f3230609fc56225c12594a524dfe48352 (patch) | |
tree | f7e4c30408dd46456272e453fc6014d3a955f9c2 /emacs/.emacs.d/init.org | |
parent | b9c50f793e20594ae9c935498b479537e2dfdfce (diff) | |
download | new-dotfiles-897a674f3230609fc56225c12594a524dfe48352.tar.gz new-dotfiles-897a674f3230609fc56225c12594a524dfe48352.zip |
Add js2-mode configuration
Diffstat (limited to 'emacs/.emacs.d/init.org')
-rw-r--r-- | emacs/.emacs.d/init.org | 38 |
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 |