Thursday, March 4, 2010

js2-mode




I recently needed a mode to indent .json files and happened upon the excellent js2-mode by Steve Yegge. It indents like a charm.

One issue I had on emacs23 was that it didn't want to byte-compile, but I found this good solution, run it in batch mode to compile.


emacs --batch --eval '(byte-compile-file "js2-20080616a.el")'


In other news, I made a couple jaws drop yesterday when I showed them my use of emacs keyboard macros. They're simple, but so powerful.

One thing I do all the time with Emacs keyboard macros is to have multiple buffers on the screen, and then move between them, killing and yanking between them. One common workflow I use it to "ls -1 > la.sh" into a file and then use that as a buffer to create commands and munge files. Dired mode with keyboard macros and another buffer also rocks.