From c5d9742872509143db0250a77db705ef78f02cd0 Mon Sep 17 00:00:00 2001 From: brettlangdon Date: Sat, 9 Aug 2014 11:57:50 -0400 Subject: [PATCH] update docs for ast loading/saving --- README.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 69a8bf6..88e63c1 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ jsfmt.el emacs plugin to allow running [jsfmt](https://rdio.github.io/jsfmt) on javascript files. -this is basically a clone of the necessary code from `go-mode` for running `gofmt` but used `jsfmt` instead. +This is basically a clone of the necessary code from `go-mode` for running `gofmt` but used `jsfmt` instead. ## Installing @@ -25,6 +25,18 @@ Add the following to `~/.emacs` to run `jsfmt` before saving file: (add-hook 'before-save-hook 'jsfmt-before-save) ``` +### AST loading/saving +`jsfmt` allows for saving/reading files as AST json files. To support this `jsfmt.el` offers +a way to load `.ast` files as javascript and then save the javascript back to an AST on save. + +To do so, add the folloing to your `.emacs` file: +```lisp +(load "~/.emacs.d/jsfmt") +(add-to-list 'auto-mode-alist '(\"\\.ast$\" . (lambda() + (jsfmt-ast-mode) + (js-mode))))" +``` + ## License The MIT License (MIT) Copyright (c) 2014 Brett Langdon (http://brett.is)