From e6f86a45211583f099615cd649e69b3c49a14a42 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Mon, 10 Oct 2016 22:28:55 +0200 Subject: [PATCH] Add js-mode configuration --- emacs/.emacs.d/GNUmakefile | 2 +- emacs/.emacs.d/init.org | 18 ++++++++++++++++++ emacs/.emacs.d/init/js-mode-init.org | 10 ++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 emacs/.emacs.d/init/js-mode-init.org diff --git a/emacs/.emacs.d/GNUmakefile b/emacs/.emacs.d/GNUmakefile index 29ea17e..61e7e00 100644 --- a/emacs/.emacs.d/GNUmakefile +++ b/emacs/.emacs.d/GNUmakefile @@ -4,7 +4,7 @@ AUTOLOADS_FILE = site-lisp/site-autoloads.el UNWANTED = $(AUTOLOADS_FILE) site-lisp/flycheck_% site-lisp/flycheck-% 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 $(call tangle,emacs-lisp) diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index c4970c6..82dd919 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -30,6 +30,13 @@ To start off, first I need to enable lexical binding. (add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/"))) #+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. #+BEGIN_SRC emacs-lisp @@ -674,6 +681,17 @@ To start off, first I need to enable lexical binding. * 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 Enable paredit mode. diff --git a/emacs/.emacs.d/init/js-mode-init.org b/emacs/.emacs.d/init/js-mode-init.org new file mode 100644 index 0000000..e7836c1 --- /dev/null +++ b/emacs/.emacs.d/init/js-mode-init.org @@ -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