<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7445852099420692591</id><updated>2011-11-27T17:07:53.732-08:00</updated><category term='scala emacs maven'/><title type='text'>The Grey Lens Man's View</title><subtitle type='html'>A view of software, code, and enterprise IT through a grey, and grizzled lens.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://thegreylensmansview.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7445852099420692591/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://thegreylensmansview.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>RayRacine</name><uri>http://www.blogger.com/profile/12063637186335293030</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>3</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7445852099420692591.post-4634398154605545186</id><published>2011-06-11T07:16:00.000-07:00</published><updated>2011-06-11T16:43:32.316-07:00</updated><title type='text'>Making Scala  (The Language) Scalable</title><content type='html'>&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;b&gt;Building Large Systems&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;span class="Apple-style-span"&gt;Say "Scala" and one receives any number of interesting reactions.  From Kurtz, "The Types! The Types!" to Ordersky " ... it's in fact a rather simple language to program in."&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;Building large systems requires a robust typing language.  Yet, typing is not sufficient alone, more is needed.  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;Undoubtedly Scala's Cosmological Type Horizon will  continue to expand indefintely (&lt;span class="Apple-style-span" style="background-color: white; font-size: 13px; line-height: 19px;"&gt;Λ &amp;gt; 1) &lt;/span&gt;and justifiably so.   In Scalaland, Typing, yea we got that.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;However, it is Scala - The Scalable Language, and not say Typla - The Typeful Language.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="background-color: white; color: #212324; font-size: small;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="background-color: white; color: #212324; font-size: small;"&gt;"The name Scala stands for “scalable language.” The language is so named because it was designed to grow with the demands of its users. You can apply Scala to a wide range of programming tasks, from writing small scripts to building large systems."&lt;/span&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;Building large systems - comprehensible, changeable, manageable and maintainable ones that work thank you very much.  At the end of the day isn't that what all of this is about?&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;b&gt;Scala Bringing A Knife To A Gunfight?&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;Scala's extant weapons of scale are the package, the class, the object, the trait, and package object.  Set the package object aside for the moment and examine the remaining constructs.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;If Scala's syntax are the words, declarations and definitions the sentences then traits, classes, and objects are the paragraphs.  What is missing are the analogous constructs for chapters, books and dare I say sets and volumes?  Packages, imposed upon Scala by Java, offer name scoping and importation, but lack the gravitas to get the job done.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;Template nesting allows for vertical structuring.  Traits and open/free/abstract declarations allow for horizontal structuring, interfacing and more.  Scala has well thought out qualified access modifiers, public, private,  protected, sealed. &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;Very solid feature set for ... Smala, a small and medium scaling language.  Best in class.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span"&gt;But All I Want To Do Is X&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;Parse a bit of &lt;a href="http://xerces.apache.org/xerces2-j/javadocs/api/index.html"&gt;XML&lt;/a&gt;, create an &lt;a href="http://www.scala-lang.org/api/current/index.html#scala.actors.package"&gt;Actor&lt;/a&gt;, a &lt;a href="http://scala-tools.org/mvnsites/liftweb-2.4-M1/#net.liftweb.builtin.snippet.package"&gt;web&lt;/a&gt; page, sort and iterate through a simple &lt;a href="http://www.scala-lang.org/api/current/index.html#scala.collection.package"&gt;sequence&lt;/a&gt; of instances.   What is the problem?  Too much information.   The exposed surface area far exceeds the general needs of the user of these libraries.  I just want to use your really well crafted library, is the endoscopy really necessary?&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;Ok the examples are admittedly rather poor ones.  But the idea conveyed should resonate. &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;The common theme is a top level package(s), multiple subpackages, traits, types, objects, classes, dozens of them if not a couple hundred which ultimately exposes a rather small, maybe use specific, surface area (API).   Probably a small team, or dedicated person will be responsible for delivering one of these structures and its interface.  A large system will be composed from a myriad of these pyramidal package structures working together to form a large scale software system.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;b&gt;Packages Are Not Modules&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span"&gt;Modularization is the solution to large scale software systems.  Modularization, in the sense of information hiding and modularizing around design decisions.  For this packages are not sufficient; neither are classes, objects or traits.  &lt;/span&gt;&lt;a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.53.2290&amp;amp;rep=rep1&amp;amp;type=pdf"&gt;Import is not inheritance – why we need both: modules and classes.&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;b&gt;Scalable Languages Require Modules&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;If one accepts the argument so far, then a scalable language requires modules, Scala claims to be scalable language from conceptualization, ergo Scala's modules must... wait a minute.  Where'd they go?&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;Exactly the point.   Of course the Scala team know all about modules, their need and ways to implement them. &amp;nbsp;It is only a question of&amp;nbsp;perceived&amp;nbsp;necessity and priority of implementation. &amp;nbsp;An interesting exercise is to grep the scala code base and search the language specification for the word "module".   Fairly prevalent isn't it? &amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;Maybe they've concluded template nesting with stable and dependent type paths is the solution.  No new constructs are required, that all the necessary machinery is in place.   But as recently as Scala 2.8 I believe they were hunting bigger game.  It's those package objects.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;b&gt;Package Objects&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;A simplistic view of package objects is to view them as a scoped global (to package) namespace in which one places implicits, vals and types.  A powerful concept in and of itself.  The &lt;a href="https://github.com/scala/scala/blob/master/src/library/scala/package.scala"&gt;scala package object&lt;/a&gt; demonstrates things nicely.  This is where Lists, allowing &lt;i&gt;List (1,2,3) &lt;/i&gt;anywhere, appear as if they were built &lt;i&gt;into&lt;/i&gt; the language, not as something built &lt;i&gt;atop&lt;/i&gt; the language implemented as just another library (somewhere else).&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;Vehicles of package convenience yes, but not the foundation for scaling million line software systems.   Or are they?&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;b&gt;Package Objects As Module Interface(s)&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;A tantalizing teaser of enhanced package objects can be found on the&lt;a href="http://www.scala-lang.org/docu/files/packageobjects/packageobjects.html"&gt; Scala website&lt;/a&gt;.  The most interesting part is here.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span"&gt;An interesting question is what should happen when the name of a top-level class or object in a package is redefined in the associated package object. For the moment, this is simply forbidden. But if we wanted to allow this, it would make sense to take the definition in the package object as the public interface of the definition in the package itself. Code from within the package could see the full definition, but code from outside the package could only see what's defined in the package object. That way, package objects could evolve into the backbone of a fairly advanced module system, which allows to flexibly combine interfaces with implementations.&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;Fully evolved package objects would act as module interface definitions.   An exposed surface area of implicits, classes, objects, traits and types.  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;The corresponding Scaladoc generation is focused on use(rs) via the module interface.  The existent package Scaladoc remains comprehensive for library maintainers, extenders and power users.   Possibly multiple modules interface definitions such as simple and full.  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;Consider the collections library with both a simple module interface containing just  the top level collection classes, objects and public methods.  And a second, full module interface exposing the complete bones and guts for extension and reuse outside the core package(s).&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;Sealed module interfaces, opaque versus transparent, intra-module requires plus provides declarations.  Components?  Module initialization code.  Such a top level initialization layer could allow for object parameters, objects with constructors, where the static instantiating information is defined in the module interface definition for object singleton instances etc.  Scoped custom application specific predefs.  Lots of possibilities.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;b&gt;Scala What's Next?&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span"&gt; Scala is one of the most advanced languages around&lt;/span&gt;&amp;nbsp;with new &lt;span class="Apple-style-span"&gt;types as well as the promoted effort on parallel/concurrent libraries/DSLs are certain. &lt;/span&gt;Within the year, Scala's nick name will be Prala, the parallel processing language.  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;But I don't think it can truly call itself Scala - The Scalable Language without the addition of an advanced module system.   For me, this would be my #1 feature request for Scala 3.0&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7445852099420692591-4634398154605545186?l=thegreylensmansview.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thegreylensmansview.blogspot.com/feeds/4634398154605545186/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thegreylensmansview.blogspot.com/2011/06/making-scala-scalable.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7445852099420692591/posts/default/4634398154605545186'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7445852099420692591/posts/default/4634398154605545186'/><link rel='alternate' type='text/html' href='http://thegreylensmansview.blogspot.com/2011/06/making-scala-scalable.html' title='Making Scala  (The Language) Scalable'/><author><name>RayRacine</name><uri>http://www.blogger.com/profile/12063637186335293030</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7445852099420692591.post-340992709707951395</id><published>2009-03-21T10:28:00.000-07:00</published><updated>2009-03-21T13:33:15.101-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scala emacs maven'/><title type='text'>Stone Tools and Scala Development - Part II Building</title><content type='html'>&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;Maven2+Scala-Maven-Plugin+ScalaTest+Emacs&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In this post I'll fly through how I use Maven in combo with Emacs to build Scala programs.&lt;br /&gt;&lt;br /&gt;But first, a couple of additional notes on Part 1, where I covered the basics of how I use Emacs to edit Scala source files.&lt;br /&gt;&lt;br /&gt;My one only commenter (thanks Normen) seemed to find the blog useful but skipped the ctags setup.  I highly recommend that anyone doing a trial of Emacs for Scala development do the ctags setup, build your tag file and then Alt-. over a type in your source.  You just can't code without this.&lt;br /&gt;&lt;br /&gt;This function and Alt-/ like completion are often used as reasons why people pick the heavier IDE's over Emacs even though they like the raw editing power of Emacs.  They often don't know one can achieve decent support for these features in Emacs as well.  Admittedly the IDEs are semantic in analysis where Emacs is syntactic.  Ctags, completion and yas-snippets get you close to these capabilities and you can flat out edit code as well.&lt;br /&gt;&lt;br /&gt;Second, I posted a small patch to the scala-tools list for a very annoying indentation issue which was just applied in the Scala repository.  So either grab the patch from &lt;a href="http://www.nabble.com/EMACS-Scala-Mode-Indentation-Patch-td22525898.html"&gt;Nabble scala-tools &lt;/a&gt; or pull the recent Emacs mode code from subversion.  Note the first patch post was incorrect and a correct patch was posted later in the chain.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_oWj1gNpT_Vg/ScUs4oe6v7I/AAAAAAAAAHA/csSxj18oE18/s1600-h/Screenshot-15.png"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 200px;" src="http://4.bp.blogspot.com/_oWj1gNpT_Vg/ScUs4oe6v7I/AAAAAAAAAHA/csSxj18oE18/s320/Screenshot-15.png" alt="" id="BLOGGER_PHOTO_ID_5315704286632132530" border="0" /&gt;&lt;/a&gt;I customized my colors a bit, and for me editing Scala code looks like this.  The lower left corner shows the results of compiling my project from inside Emacs via Maven2 and the Scala Maven plugin.&lt;br /&gt;&lt;br /&gt;Maven in and of itself is a big topic and I am not a Maven maven by any means.  So I'm only covering the specifics of using Maven + Scala + Emacs.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;The Setup&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;First we want to run Maven inside of Emacs to take advantage of the using Emacs to move from compiler errors to the location of the error in the source code.  A google search located a small but nice bit of elisp to run maven from inside Emacs.   I modified it somewhat for Scala purposes.  Here it is in its entirety.&lt;br /&gt;&lt;blockquote&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;;; Simple but effective Maven2 support.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;(require 'compile)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;(defvar mvn-command-history nil&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  "Maven command history variable")&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;(defvar scala-compile-error-regex&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  '("^\\[WARNING\\] \\([a-zA-Z0-9/-]+[.]scala\\):\\([0-9]+\\): error:" 1 2 nil 2 nil))&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;(defun mvn-compile-buffer-name (mode)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; "*Maven Compile*")&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;(set 'scala-compile-error-regex  '("^\\[WARNING\\] \\([a-zA-Z0-9/-]+[.]scala\\):\\([0-9]+\\): error:" 1 2 nil 2 nil))&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;(set 'compilation-buffer-name-function 'mvn-compile-buffer-name)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;(set 'compilation-error-regexp-alist (list scala-compile-error-regex))&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;(set 'compilation-mode-font-lock-keywords&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;     '(("^\\[ERROR\\] BUILD FAILURE"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    (0 compilation-error-face))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;       ("^\\[WARNING\\]"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    (0 compilation-warning-face))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;       ("^\\(\\[INFO\\]\\)\\([^\n]*\\)"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    (1 compilation-info-face)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    (2 compilation-line-face))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;       ("^\\[ERROR\\]"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    (0 compilation-error-face))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;       ("\\(Failures\\): [1-9][0-9]*,"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    (0 compilation-error-face))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;       ("\\(Failures\\): 0"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    (0 compilation-info-face))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;       ("\\(Errors\\): [1-9][0-9]*,"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    (0 compilation-error-face))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;       ("\\(Errors\\): 0"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    (0 compilation-info-face))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;       ("\\(Skipped\\): [1-9][0-9]*,"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    (0 compilation-error-face))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;       ("\\(Skipped\\): 0"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    (0 compilation-info-face))      &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;       ("Tests run: [0-9]+"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    (0 compilation-warning-face))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;       ("T E S T S"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    (0 compilation-warning-face))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;       ("Compilation finished at [^\n]+"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    (0 compilation-info-face))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;       ("^Compilation \\(exited abnormally\\|interrupt\\|killed\\|terminated\\|segmentation fault\\)\\(?:.*with code \\([0-9]+\\)\\)?.*"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    (0 '(face nil message nil help-echo nil mouse-face nil) t)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    (1 compilation-error-face)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    (2 compilation-error-face nil t))))&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;(defun mvn-at-root (path)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  "Determine if the given path is root."&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  (equal path (mvn-parent-path path)))&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;(defun mvn-parent-path (path)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  "The parent path for the given path."&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  (file-truename (concat path "/..")))&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;(defun mvn-pom-at-path-p (path)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  "Does a pom.xml exist in the given path."&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  (file-exists-p (concat path "/pom.xml")))&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;(defun mvn-find-path-to-pom ()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  "Move up the directory tree for the current buffer until root or a pom.xml is found."&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  (let ((fn (buffer-file-name)))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    (let ((path (file-name-directory fn)))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;      (while (and (not (mvn-pom-at-path-p path))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;          (not (mvn-at-root path)))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    (setf path (file-truename (mvn-parent-path path))))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;      path)))&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;(defun mvn-master (&amp;amp;optional args)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  (interactive)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  "Determine the potential master pom by checking if there is a pom in a pom's parent directory. nil if no parent pom else the path to the parent."&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  (let ((pom-path (mvn-find-path-to-pom)))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    (let ((parent-pom-path (file-truename (concat pom-path "/.."))))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;      (if (not (mvn-pom-at-path-p parent-pom-path))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;      (message "No master pom found.")&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;      (compile (read-from-minibuffer "Command: "&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;                     (concat "mvn -o -f " parent-pom-path "/pom.xml clean install")&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;                     nil nil 'mvn-command-history))))))&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;(defun mvn (cmd)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  "Runs maven in the current project. Starting at the directoy where the file being vsisited resides, a search is&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;   made for pom.xml recsurively. A maven command is made from the first directory where the pom.xml file is found is then displayed&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  in the minibuffer. The command can be edited as needed and then executed. Errors are navigate to as in any other compile mode"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  (interactive "n0-clean 1-install 2-install,bundle:install 3-compile 4-test : ")&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  (let ((path (mvn-find-path-to-pom)))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    (let ((goal (case cmd&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;          ((0) "clean")&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;          ((1) "install")&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;          ((2) "install bundle:install")&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;          ((3) "compile")&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;          ((4) "test"))))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;      (if (not (file-exists-p (concat path "/pom.xml")))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;      (message "No pom.xml found")&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    (compile (read-from-minibuffer "Command: "&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;                       (concat "mvn -o -f " path (concat "/pom.xml " goal))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;                       nil nil 'mvn-command-history))))))&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;;; String pattern for locating errors in maven output. This assumes a Windows drive letter at the beginning&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;;;(add-to-list&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;;; 'compilation-error-regexp-alist&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;;; '("^\\([a-zA-Z]:.*\\):\\[\\([0-9]+\\),\\([0-9]+\\)\\]" 1 2 3))&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;                  &lt;/blockquote&gt;&lt;br /&gt;First, the color coding stuff is sort of nice.  It colorizes compile and unit test errors to red and passed tests to green, informational output to yellow/orange and that sort of thing.  It also defines regular expressions which identify scala compiler errors and extraction of the file and line numbers for Emacs' compile.el.&lt;br /&gt;&lt;br /&gt;Cut and paste the above in a file mvn.el, put it in your site-lisp directory and modify your .emacs file as follows.  Here I repeat my Scala-mode setup as well to show where we bind the F6 key to a function which runs Maven from Emacs.&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;blockquote&gt;&lt;span style=";font-family:courier new;font-size:85%;"  &gt;;;;;;;;;;;;;&lt;br /&gt;;; MAVEN 2&lt;br /&gt;;;;;;;;;;;;;&lt;br /&gt;&lt;br /&gt;(let ((path "/usr/local/share/emacs/site-lisp/mvn"))&lt;br /&gt;(setq load-path (cons path load-path))&lt;br /&gt;(load "mvn.el"))&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;;;;;;;;;;;;;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;;; SCALA &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;;;;;;;;;;;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;(let ((path "/usr/local/share/emacs/site-lisp/scala"))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  (setq load-path (cons path load-path))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  (load "scala-mode-auto.el"))&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;(defun scala-turnoff-indent-tabs-mode ()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  (setq indent-tabs-mode nil))&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;;; scala mode hooks&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;(add-hook 'scala-mode-hook 'scala-turnoff-indent-tabs-mode)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;;; Maven bound to &lt;f6&gt;&lt;/f6&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;(add-hook 'scala-mode-hook&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;      '(lambda ()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;         (define-key scala-mode-map '[f6] 'mvn)))&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Using mvn.el&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;As I've indicated, this post is not about using Maven2 and the Scala plugin which is covered quite well in a number of places.  See the &lt;a href="http://scala-tools.org/mvnsites/maven-scala-plugin/"&gt;scala-tools site&lt;/a&gt; on how to setup a Maven+Scala project.  My focus is using a Maven+Scala from within Emacs and that is done easily enough.&lt;br /&gt;&lt;br /&gt;So at this point I am assuming that you have a working pom.xml, and in the standard Maven file layout have one or more Scala source files and if you issue a "mvn install" command from the command line your code builds just fine.  To achieve this level of enlightenment I again refer you to the  &lt;a href="http://scala-tools.org/mvnsites/maven-scala-plugin/"&gt;scala-tools site&lt;/a&gt;.  In addition, I'm assuming you've installed the mvn.el file and setup your .emacs as discussed.&lt;br /&gt;&lt;br /&gt;So now lets switch from running Maven from a command line to within Emacs.&lt;br /&gt;&lt;br /&gt;Fire up Emacs and open a Scala source file.  You have to be in active buffer which contains a Scala source file.  Press F6.  You should see a small list of Maven goals in the interactive buffer.   Pick a number and hit return.  And now you have a small Maven command.  You can change it by editing it or just hit return to run it.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_oWj1gNpT_Vg/ScU5GdzUwdI/AAAAAAAAAHI/9fiowHya2dk/s1600-h/Screenshot-16.png"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 200px;" src="http://1.bp.blogspot.com/_oWj1gNpT_Vg/ScU5GdzUwdI/AAAAAAAAAHI/9fiowHya2dk/s320/Screenshot-16.png" alt="" id="BLOGGER_PHOTO_ID_5315717718422634962" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;A *Maven-Compile* buffer should appear within which scrolling Maven output is happening.  A typical run for me (notice the complete lack of errors :) ) looks like this.&lt;br /&gt;&lt;br /&gt;OK I know what you're thinking.  Pretty colors, but what's the big deal.  Well first the mvn.el script uses Emacs' compile.el  so we can leverage pre-existing functionality to navigate to the compile errors.&lt;br /&gt;&lt;br /&gt;Click on an error and you jump to it the source file.  Alternatively you can move the cursor over the error msg and hit return.  ctrl-x ` navigates to the next error.  All this and more is available and explained in detail &lt;a href="http://www.gnu.org/software/emacs/manual/html_node/emacs/Compilation-Mode.html"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;mvn.el Insight&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;A couple of notes on mvn.el.  Its not very complex and gains much of its power from Emacs compile.el for error navigation.&lt;br /&gt;&lt;br /&gt;So what is really happening when the F6 key is pressed?  Well first the directory of the Scala source file is determined.  Then we look to see if a pom.xml is present, if not we recursively move up the directory tree until one is found or report an error if one is not found.  Using the compile command found in compile.el, which does all the heavy lifting, Maven is launched with the located pom.xml and the selected goal.&lt;br /&gt;&lt;br /&gt;For "advanced" Maven users who have a top level pom.xml with sub-projects or modules with their own pom.xml there is an interactive command which move up the directory tree and finds the top most pom.xml.  &lt;span style="font-style: italic;"&gt;alt-x mvn-master &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;So there it is.  The basics of using using Maven+ScalaPlugin+Emacs for Scala program development.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 153, 0);font-size:130%;" &gt;Next post.  Scala + OSGi + Maven + Felix + Emacs&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Note: I added the "pick a number" thing awhile back, didn't particularly care for it, and never got around to removing it, and got sort of used to it.  I just F6 3 RTN without much thinking.  But the mvn.el is easily modified.  See mvn-master for the old way.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7445852099420692591-340992709707951395?l=thegreylensmansview.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thegreylensmansview.blogspot.com/feeds/340992709707951395/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thegreylensmansview.blogspot.com/2009/03/stone-tools-and-scala-development-part.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7445852099420692591/posts/default/340992709707951395'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7445852099420692591/posts/default/340992709707951395'/><link rel='alternate' type='text/html' href='http://thegreylensmansview.blogspot.com/2009/03/stone-tools-and-scala-development-part.html' title='Stone Tools and Scala Development - Part II Building'/><author><name>RayRacine</name><uri>http://www.blogger.com/profile/12063637186335293030</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_oWj1gNpT_Vg/ScUs4oe6v7I/AAAAAAAAAHA/csSxj18oE18/s72-c/Screenshot-15.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7445852099420692591.post-2265351398773664360</id><published>2009-02-17T14:10:00.000-08:00</published><updated>2009-02-17T20:44:51.732-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scala emacs maven'/><title type='text'>Stone Tools and Scala Development - Part I Editing</title><content type='html'>I see great potential in Scala, the programming language.&lt;br /&gt;&lt;br /&gt;Scala is a good thing.  Scala deserves to win, it deserves to supplant Java in enterprise IT because it is better.  If their exists some law of nature dictating that the universe must maintain itself in good kilter and balance every "worse is better" thing with a better thing then Scala will succeed.&lt;br /&gt;&lt;br /&gt;Currently the language and compiler exceeds any IDEs capability to properly host it.  And a huge proportion of developers have never experienced anything other then the all mothering Eclipse, Netbeans, or Microsoft IDE.  Without the skeletal support of the IDE they are rendered near impotent, become jelly like, puddle and quiver back and forth producing nary a line of code.&lt;br /&gt;&lt;br /&gt;Thankfully there are Scala plugins for Netbeans, Intellij and Eclipse.  Yet there exists no more gnashing teeth on the Scala mailing list then concerning the relative immaturity of these plugins.&lt;br /&gt;&lt;br /&gt;Amazingly these days, so interlinked is the concept of computer language and its IDE(s) many no longer see them as less then monolithic.  Scala, the language, sucks because the IDE support sucks.&lt;br /&gt;&lt;br /&gt;Fortunately, frankly surprisingly, one sees continued steady effort and work invested in improving these plugins.  Surprisingly because it is a near thankless job and borders on pure drudgery.  We salute you.&lt;br /&gt;&lt;br /&gt;Until these tools mature, I claim it is possible to eek out a development existence, even a highly productive one using nothing more then the stone tools of a compiler, editor, make-like system, unix utilities and the command line.    Some even view this as the superior, even ultimate IDE.&lt;br /&gt;&lt;br /&gt;Here is how I roll with my stone tools for Scala development.&lt;br /&gt;&lt;br /&gt;First off Linux.  All of details below assume a Linux system.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;Editing Scala Code With Emacs.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I know, we all heard it a 1000 times about those emacs gods who transcend the very laws of nature through advanced enlightenment with emacs which simply escapes us low karmic souls.&lt;br /&gt;&lt;br /&gt;It's true, if you invest in emacs long enough it starts to pay off like a rigged slot machine.  Put you have to feed it a lot of quarters first.  I'm far from an emacs guru, but I've reached a point down the 7-fold path where I can't live without it and marvel how I ever did.&lt;br /&gt;&lt;br /&gt;Get the latest emacs.  Emacs was moribund for years but has experience a renaissance recently.  The vastly improved font handling is worth it alone.  It is once again better then XEmacs IMHO. Get good ol' emacs, I build it from cvs and it's easy.  Standard configure, make, dance and if I remember the README gives an option to bypass configure with the proper Make incantation.&lt;br /&gt;&lt;br /&gt;Here is my base .emacs stuff.&lt;br /&gt;&lt;br /&gt;(global-font-lock-mode t)&lt;br /&gt;&lt;br /&gt;(windmove-default-keybindings)&lt;br /&gt;&lt;br /&gt;(setq use-file-dialog nil)&lt;br /&gt;&lt;br /&gt;;; "y or n" instead of "yes or no"&lt;br /&gt;(fset 'yes-or-no-p 'y-or-n-p)&lt;br /&gt;&lt;br /&gt;;; Highlight regions and add special behaviors to regions.&lt;br /&gt;;; "C-h d transient" for more info&lt;br /&gt;(setq transient-mark-mode t)&lt;br /&gt;&lt;br /&gt;;; Display line and column numbers&lt;br /&gt;(setq line-number-mode    t)&lt;br /&gt;(setq column-number-mode  t)&lt;br /&gt;&lt;br /&gt;(global-set-key "\C-c\C-w" 'backward-kill-word)&lt;br /&gt;&lt;br /&gt;;; Remove unnecessary gui stuff&lt;br /&gt;(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))&lt;br /&gt;(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))&lt;br /&gt;(if (fboundp 'menu-bar-mode) (menu-bar-mode 1))&lt;br /&gt;&lt;br /&gt;(blink-cursor-mode 0) ;; no blink&lt;br /&gt;&lt;br /&gt;(set-background-color "black")&lt;br /&gt;(set-face-background 'default "black")&lt;br /&gt;(set-face-background 'region "black")&lt;br /&gt;(set-face-foreground 'default "white")&lt;br /&gt;(set-face-foreground 'region "gray60")&lt;br /&gt;(set-foreground-color "white")&lt;br /&gt;(set-cursor-color "red")&lt;br /&gt;&lt;br /&gt;This will give you a clean, black background based emacs with maximum screen space, but leaving the main menu, which I found on someones (thank you) emacs blog.&lt;br /&gt;&lt;br /&gt;Next install the Scala folks provided scala-mode for emacs.  They did a nice job.&lt;br /&gt;&lt;br /&gt;svn co http://lampsvn.epfl.ch/svn-repos/scala/scala-tool-support/trunk/src/emacs&lt;br /&gt;&lt;br /&gt;Follow the readme and install.  The yasnippit stuff is not bad, but I don't use it extensively, but give it a whirl and decide yourself.&lt;br /&gt;&lt;br /&gt;For the record here is what my .emacs file looks like after I installed the provided scala-mode and yasnippit for scala.&lt;br /&gt;&lt;br /&gt;;;;;;;;;;;;;&lt;br /&gt;;; SCALA&lt;br /&gt;;;;;;;;;;;;&lt;br /&gt;&lt;br /&gt;(let ((path "/usr/local/share/emacs/site-lisp/scala"))&lt;br /&gt;(setq load-path (cons path load-path))&lt;br /&gt;(load "scala-mode-auto.el"))&lt;br /&gt;&lt;br /&gt;(defun scala-turnoff-indent-tabs-mode ()&lt;br /&gt;(setq indent-tabs-mode nil))&lt;br /&gt;&lt;br /&gt;;; scala mode hooks&lt;br /&gt;(add-hook 'scala-mode-hook 'scala-turnoff-indent-tabs-mode)&lt;br /&gt;&lt;br /&gt;;; Maven bound to &lt;f6&gt;&lt;br /&gt;(add-hook 'scala-mode-hook&lt;br /&gt; '(lambda ()&lt;br /&gt;    (define-key scala-mode-map '[f6] 'mvn)))&lt;br /&gt;&lt;br /&gt;;;;;;;;;;;;;;&lt;br /&gt;;; YASNIPPIT&lt;br /&gt;;;;;;;;;;;;;;&lt;br /&gt;&lt;br /&gt;(add-to-list 'load-path "/usr/local/share/emacs/site-lisp/yasnippet-0.5.7")&lt;br /&gt;(require 'yasnippet)&lt;br /&gt;(yas/initialize)&lt;br /&gt;(yas/load-directory "/usr/local/share/emacs/site-lisp/yasnippet-0.5.7")&lt;br /&gt;&lt;br /&gt;More on that Maven key binding later.&lt;br /&gt;&lt;br /&gt;Now we can edit Scala code effectively.  There are some indentation issues and I've been able to improve it a bit but I still have fix a few things which I broke in the process before it is worthy.&lt;br /&gt;&lt;br /&gt;With Yasnippit and alt-/ completion its not too bad.  The next piece is exuberant ctags so you can alt-. and jump directly to that class, object or trait definition.&lt;br /&gt;&lt;br /&gt;First there is ctags and then there is ctags.  Emacs comes with a program called ctags.  ctags will index your source code symbols so you can hop around your source code files.&lt;br /&gt;&lt;br /&gt;There is a variation of ctags called exuberant ctags found at http://ctags.sourceforge.net/ and you need to install it.  Again it should be quick and easy if you've ever done the ol' Linux Make dance.&lt;br /&gt;&lt;br /&gt;Be careful, when you make install emacs as it reinstalls its version of ctags so you need to make install exhuberant ctags.  Just make sure however you go about it, exhuberant ctags is what is executed in your PATH and not the standard emacs ctags.&lt;br /&gt;&lt;br /&gt;In your home directory create a .ctags file with the following.&lt;br /&gt;&lt;br /&gt;--langdef=Scala&lt;br /&gt;--langmap=Scala:.scala&lt;br /&gt;--regex-Scala=/^[^\*\/]*class[ \t]*([a-zA-Z0-9_]+)/\1/c,classes/&lt;br /&gt;--regex-Scala=/^[^\*\/]*object[ \t]*([a-zA-Z0-9_]+)/\1/o,objects/&lt;br /&gt;--regex-scala=/^[^\*\/]*trait[ \t]*([a-zA-Z0-9_]+)/\1/t,traits/&lt;br /&gt;--regex-Scala=/^[^\*\/]*case[ \t]*class[ \t]*([a-zA-Z0-9_]+)/\1/m,case-classes/&lt;br /&gt;--regex-Scala=/^[^\*\/]*abstract[ \t]*class[ \t]*([a-zA-Z0-9_]+)/\1/a,abstract-classes/&lt;br /&gt;#--regex-Scala=/^[^\*\/]*def[ \t]*([a-zA-Z0-9_]+)[ \t]*.*[:=]/\1/f,functions/&lt;br /&gt;#--regex-Scala=/^[^\*\/]*val[ \t]*([a-zA-Z0-9_]+)[ \t]*[:=]/\1/V,values/&lt;br /&gt;#--regex-Scala=/^[^\*\/]*var[ \t]*([a-zA-Z0-9_]+)[ \t]*[:=]/\1/v,variables/&lt;br /&gt;#--regex-Scala=/^[^\*\/]*type[ \t]*([a-zA-Z0-9_]+)[ \t]*[\[&lt;&gt;=]/\1/T,types/&lt;br /&gt;&lt;br /&gt;I just like to index classes, traits, objects and case-classes. Hmmm just noticed I should add case objects as well.&lt;br /&gt;&lt;br /&gt;Now when editing a scala file in emacs, under the emacs &lt;span style="font-weight: bold;"&gt;Scala&lt;/span&gt; menu item, &lt;span style="font-weight: bold;"&gt;Features&lt;/span&gt; you can build and use tag files which index key symbols in your source code.&lt;br /&gt;&lt;br /&gt;Explore your Scala editing environment. No two people use emacs in the same fashion.&lt;br /&gt;&lt;/f6&gt;&lt;ul&gt;&lt;li&gt;&lt;f6&gt;alt-x rgrep in emacs to ad-hoc search your scala files.&lt;/f6&gt;&lt;/li&gt;&lt;li&gt;use alt-/ for simple minded completion.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Hit the F1 key to pop up your speed bar window.  Note at the bottom you can click and switch to view, buffers, files etc in the speed bar.&lt;/li&gt;&lt;li&gt;alt-x erc and join #scala in your emacs for instant Scala support. :)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Are you using ctr-x o to move between buffers?  There are tons of better ways.  Open up a several scala buffer windows ctr-x 2 or 3, now hold down shift and use your arrow keys to move around.&lt;/li&gt;&lt;li&gt;Notice that there are 5-6 Tag search options under the Scala Menu, try them all.&lt;/li&gt;&lt;li&gt;While editing a scala file, put your cursor over a type definition (x: MyType, ...) and do alt-. &lt;/li&gt;&lt;li&gt;Toggle yas/snippit, alt-x yas/minor-mode.  In your scala source file type 'def ' or 'class ' and hit the tab key.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Run the scala interpreter in emacs its right there in the Scala menu.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;f6&gt;&lt;br /&gt;Next post I'll address setting up and building your Scala project using Maven from inside emacs.&lt;br /&gt;&lt;br /&gt;&lt;/f6&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7445852099420692591-2265351398773664360?l=thegreylensmansview.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thegreylensmansview.blogspot.com/feeds/2265351398773664360/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thegreylensmansview.blogspot.com/2009/02/stone-tools-and-scala-development-part.html#comment-form' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7445852099420692591/posts/default/2265351398773664360'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7445852099420692591/posts/default/2265351398773664360'/><link rel='alternate' type='text/html' href='http://thegreylensmansview.blogspot.com/2009/02/stone-tools-and-scala-development-part.html' title='Stone Tools and Scala Development - Part I Editing'/><author><name>RayRacine</name><uri>http://www.blogger.com/profile/12063637186335293030</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>9</thr:total></entry></feed>
