In followup to my post Introducing Emacs Power for Scala Development, here’s how to set up a new project and get started.
First, some words about assumptions: I’m doing these steps on my OSX machine that already has Scala 2.10 installed. You can get that from the Scala-lang website.
You’ll also need git (command-line version), which you can get from the git site itself, if you don’t have it installed already.
I’m running OSX, with 32GB of RAM on a MacPro, but I use this same setup on my Macbook Air, it doesn’t take hardly any horsepower at all.
First, you’ll need Emacs itself. You want at least version 24.2 or later, or most of this won’t work. The version that comes from http://emacsformacosx.com/ is probably best. Aquamacs doesn’t work.
Download the .dmg from the above site and install as default, nothing fancy. If you’re running *nix, get the version appropriate for your distro. If you’re running Windows, I can’t help you, despite your great need.
In a plug for my own Github project, you’ll next need emacs-for-scala installed. This is basically my .emacs.d directory, along with a nice cheatsheet for remembering key bindings, and a bunch of add-ons I’ve found useful for Scala development.
Installing is pretty straightforward. Just pull from https://github.com/michaelpnash/emacs-for-scala.git into a handy directory, then copy the entirety of the .emacs.d directory from there into your home directory. If you already have an .emacs.d, you might want to back it up first – don’t try merging this one over the top of it, it won’t be pretty.
Getting a Project from Github (matrix-decider)
Now you need a Scala project to work with.
Falling back on shameless self-promotion, I’ll again suggest one of mine, Matrix-Decider. You can get it by cloning from here: https://github.com/michaelpnash/matrix-decider.git
If you want to learn more about it, I recommend the links below this article, but any Scala project will do for our purposes here.
Again, use any handy directory, it shouldn’t matter.
Generate an Ensime project file
At this point you can follow along with the attached video: It shows how to generate an Emsime project file, then how to fire up Emacs and point Ensime at the proper project. Then it describes how to open dirtree to easily and quickly navigate your project files, and how to open and access your scala files, and what you should see when building.
I suggest you open the video in full screen mode, and make sure you select HD 720 mode so you can see the text clearly.
In later videos we’ll see how to navigate easily between classes and objects and files in your Scala project.
Don’t forget all the key-bindings are documented right here for easy reference.