Posts

Showing posts from February, 2015

Quick scala experimenting in emacs

Sometimes it is very handy to do a quick coding session in some scripting language - when experimenting with new language feature, trying out some idea or just throwing together some math. Until recently, there was no way to use Scala for this. While it had script execution feature, it was very slow - could take several seconds on each script restart. This happened because you had to load and initialize scala compiler every time - and it's not a small beast. Somewhere between 2.9 and 2.11, situation changed to better - now, instead of tearing compiler up and down, "scala script.scala" silently starts a compile server in the background, and subsequent scripts are sent to it, cutting down script execution time to less than a second. It would get even better if there was a way to run the script directly from my emacs session, without going to terminal. Turns out, it's easy to do. Just place the following function in your init.el: (defun run-current-file () &quo