This page is no longer maintained — Please continue to the home page at

Scala, SBT and Emacs.

No replies
Joined: 2009-01-03,
User offline. Last seen 42 years 45 weeks ago.
FWIW to the emacs+scala+sbt users out there.

---------- Forwarded message ----------
From: Ray Racine <ray [dot] racine [at] gmail [dot] com>
Date: Mon, Apr 12, 2010 at 9:30 AM
Subject: Re: [sbt] Re: Looking for sbt/emacs [or vim]/jrebel/Lift setup instructions
To: simple-build-tool [at] googlegroups [dot] com

Luke's approach of spawning sbt in shell with compile mode works better than my original approach of running it as a "compile" command.  The error marker does not get lost.   He also cleaned up numerous things with coloring and ansi issues.  I've fixed a few broken things with sbt-clear, added the capability for finding the parent project when using sbt sub-projects etc.
For SBT support. - Grab the code from github. - Put the sbt elisp directory into your load-path. - (require 'sbt)  - Assuming the command 'sbt' is in your executable path then, first ensure your active buffer is a scala code file in your sbt  project and an "alt-x sbt" in emacs launches it.  - Use sbt's "~compile" action to do incremental compilation. - Use 'alt-x sbt-clear' to clear the compile window every now and then.  (I plan on an "auto" clean up capability real soon now.)
There are also some changes I've done to deal indentation for bracketless blocks, case statements, anonymous functions etc for emacs scala-mode.  In fact for me with the Scala idioms I use, I rarely if ever have a situation where emacs indentation is not doing the "right thing", YMMV.
In addition, I can't recommend highly enough giving ECB a whirl.  My Scala setup looks like this:

On Sat, Apr 10, 2010 at 12:38 PM, Ray Racine <ray [dot] racine [at] gmail [dot] com> wrote:
Very cool, by spawning sbt straight in a shell buffer the error tracking doesn't appear to get lost.

On Fri, Apr 9, 2010 at 10:28 PM, Luke Amdor <luke [dot] amdor [at] gmail [dot] com> wrote:
I've done a little bit of work on sbt-emacs integration. My work is up
at . Not too much there and is
severely lacking in documentation.

My usual workflow is just start up an interactive sbt comint buffer
via the "sbt" command and starting ~compile or ~test and then just
work away. It can also use the "unit-test" package and display a green
or red dot in the mode-line based on whether the command is failing or
passing, very nice for TDD.

It also has compilation-shell integration show you can use next-error
to jump to errors.

I dunno, it works pretty well for me. Let me know what you find.


On Apr 7, 1:18 pm, David Pollak <feeder [dot] of [dot] the [dot] be [dot] [dot] [dot] [at] gmail [dot] com> wrote:
> Folks,
> I'm trying to set up sbt to work with Emacs (or Vim as an alternative) with
> JRebel and Lift.
> What's I'm specifically looking to do is:
>    - Jump-to-error such that sbt interacts with the editor in such a way
>    that I can go to errors flagged in the output of sbt
>    - sbt continuous compilation
>    - Running/Stopping Jetty/Lift from sbt via JRebel such that as the
>    classes are recompiled, JRebel picks up the changes
> I'm not overly clueful with Emacs, so detailed updates to my .emacs file
> would be helpful.
> I appreciate what people can tell me.
> Thanks,
> David

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland