Add js-mode configuration

This commit is contained in:
Tom Willemse 2016-10-10 22:28:55 +02:00
parent 7bf363a46a
commit e6f86a4521
3 changed files with 29 additions and 1 deletions

View file

@ -4,7 +4,7 @@ AUTOLOADS_FILE = site-lisp/site-autoloads.el
UNWANTED = $(AUTOLOADS_FILE) site-lisp/flycheck_% site-lisp/flycheck-% UNWANTED = $(AUTOLOADS_FILE) site-lisp/flycheck_% site-lisp/flycheck-%
SITE_LISPS = $(addsuffix c,$(filter-out $(UNWANTED),$(wildcard site-lisp/*.el))) SITE_LISPS = $(addsuffix c,$(filter-out $(UNWANTED),$(wildcard site-lisp/*.el)))
all: init.elc $(AUTOLOADS_FILE) $(SITE_LISPS) all: init.elc init/js-mode-init.elc $(AUTOLOADS_FILE) $(SITE_LISPS)
%.el: %.org %.el: %.org
$(call tangle,emacs-lisp) $(call tangle,emacs-lisp)

View file

@ -30,6 +30,13 @@ To start off, first I need to enable lexical binding.
(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/"))) (add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/")))
#+END_SRC #+END_SRC
Add the directory with my mode-specific configuration files to the
load path.
#+BEGIN_SRC emacs-lisp
(add-to-list 'load-path (locate-user-emacs-file "init/"))
#+END_SRC
Add all my vendored packages to the load path. Add all my vendored packages to the load path.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
@ -674,6 +681,17 @@ To start off, first I need to enable lexical binding.
* Major modes * Major modes
Configuration for major modes is specified in dedicated
configuration files.
- [[file:init/js-mode.org][js-mode]] :: JavaScript mode is used by me for json files. js2-mode
doesn't work very nicely with json, always showing syntax
errors.
#+BEGIN_SRC emacs-lisp
(with-eval-after-load 'js (load "js-mode-init"))
#+END_SRC
** Emacs lisp mode ** Emacs lisp mode
Enable paredit mode. Enable paredit mode.

View file

@ -0,0 +1,10 @@
#+TITLE: JavaScript mode
I use js-mode for json files because js2-mode always complains about
syntax errors.
Turn on electric pairing for js-mode buffers.
#+BEGIN_SRC emacs-lisp
(add-hook 'js-mode-hook 'electric-pair-local-mode)
#+END_SRC