This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Scala & Emacs?

13 replies
Normen Müller
Joined: 2009-02-13,
User offline. Last seen 42 years 45 weeks ago.

He,

I have a Scala eclipse project with some referenced libraries and more
than one source folder configured.

Now --- due to lack of memory on my laptop --- I would like to use
emacs & Scala mode to keep on developing. I installed the Scala emacs
mode, but how do I configure the interpreter to pre-load some
libraries cause otherwise I can't run/ compile my code. Or do I have
to use sth. like ant scripts instead?

Cheers,
--
Normen Müller

Ricky Clarkson
Joined: 2008-12-19,
User offline. Last seen 3 years 2 weeks ago.
Re: Scala & Emacs?

I tend to open a shell (M-x shell RET) then type something like:

scala -classpath lib/anylayout.jar:lib/fj.jar RET

From there I can type stuff and use M-p and M-n to scroll up and down
through previous lines that I've typed.

If I always needed the same classpath I'd probably do:

echo "#!/bin/bash
scala -classpath lib/anylayout.jar:lib/fj.jar" > repl.sh
chmod +x repl.sh

Then run that via ./repl.sh

I tend to have a build.sh for building, so I do M-x compile RET cd
~/myproj && ./build.sh

I have these set up to allow emacs to make compile errors from maven
builds clickable, one specially for Scala compile errors from maven
builds:

(add-to-list 'compilation-error-regexp-alist-alist '(mvn
"^\\(.*\\):\\[\\([0-9]+\\),\\([0-9]+\\)\\]" 1 2 3 2 1))
(add-to-list 'compilation-error-regexp-alist-alist '(mvnscala
"^\\(.*\\):\\([0-9]+\\): .*" 1 2))
(setq compilation-error-regexp-alist '(mvn mvnscala))

2009/2/13 Normen Müller :
> He,
>
> I have a Scala eclipse project with some referenced libraries and more than
> one source folder configured.
>
> Now --- due to lack of memory on my laptop --- I would like to use emacs &
> Scala mode to keep on developing. I installed the Scala emacs mode, but how
> do I configure the interpreter to pre-load some libraries cause otherwise I
> can't run/ compile my code. Or do I have to use sth. like ant scripts
> instead?
>
> Cheers,
> --
> Normen Müller
>
>

Normen Müller
Joined: 2009-02-13,
User offline. Last seen 42 years 45 weeks ago.
Re: Scala & Emacs?

On Feb 13, 2009, at 12:41 PM, Ricky Clarkson wrote:
> echo "#!/bin/bash
> scala -classpath lib/anylayout.jar:lib/fj.jar" > repl.sh
> chmod +x repl.sh
>
> Then run that via ./repl.sh

Thanks that works, I have to compile the code first though. Running
such a script sets the classpath variable right, but then loading a
file, "scala" complains, for example:

scala> :load /Users/nmueller/scaup/test/io/FilesTest.scala

:1: error: illegal start of definition
package scaup.test.io
^

> I tend to have a build.sh for building, so I do M-x compile RET cd
> ~/myproj && ./build.sh

Therefore you also set up a make file?

> I have these set up to allow emacs to make compile errors from maven

I don't use maven. Never did. Maybe I should have a look into it.

Cheers,
--
Normen Müller

Russel Winder
Joined: 2009-02-13,
User offline. Last seen 42 years 45 weeks ago.
Re: Scala & Emacs?

Norman,

On Fri, 2009-02-13 at 13:24 +0100, Normen Müller wrote:
[ . . . ]
> Therefore you also set up a make file?

I would have thought that Gant, Gradle, SCons or even Ant were better
choices for dependency management than Make?

> > I have these set up to allow emacs to make compile errors from maven
>
> I don't use maven. Never did. Maybe I should have a look into it.

Or Gradle (or Gant)?

(And yes, I am involved with both Gant and Gradle development -- however
the reason for their existence is to progress build and dependency
management on from the tools that went before.)

Ricky Clarkson
Joined: 2008-12-19,
User offline. Last seen 3 years 2 weeks ago.
Re: Scala & Emacs?

Yes, you have to compile the code first, that's true of all Scala code
(other than scripts and interpreter commands). I assume you would
like to start an interpreter to play with the code you've already
compiled and to prototype new code interactively.

2009/2/13 Normen Müller :
> On Feb 13, 2009, at 12:41 PM, Ricky Clarkson wrote:
>>
>> echo "#!/bin/bash
>> scala -classpath lib/anylayout.jar:lib/fj.jar" > repl.sh
>> chmod +x repl.sh
>>
>> Then run that via ./repl.sh
>
> Thanks that works, I have to compile the code first though. Running such a
> script sets the classpath variable right, but then loading a file, "scala"
> complains, for example:
>
> scala> :load /Users/nmueller/scaup/test/io/FilesTest.scala
>
> :1: error: illegal start of definition
> package scaup.test.io
> ^
>
>> I tend to have a build.sh for building, so I do M-x compile RET cd
>> ~/myproj && ./build.sh
>
> Therefore you also set up a make file?
>
>> I have these set up to allow emacs to make compile errors from maven
>
> I don't use maven. Never did. Maybe I should have a look into it.
>
> Cheers,
> --
> Normen Müller
>
>

Russ P.
Joined: 2009-01-31,
User offline. Last seen 1 year 26 weeks ago.
Re: Scala & Emacs?
On Fri, Feb 13, 2009 at 3:33 AM, Normen Müller <n [dot] mueller [at] jacobs-university [dot] de> wrote:

Now --- due to lack of memory on my laptop --- I would like to use emacs & Scala mode to keep on developing.  I installed the Scala emacs mode, but how do I configure the interpreter to pre-load some libraries cause otherwise I can't run/ compile my code.  Or do I have to use sth. like ant scripts instead?

Since you installed the emacs Scala mode, would you mind giving me a clue how to do it (for XEmacs on Linux)? I looked at the README file included with the Scala distribution, and I took a crack at it, but I can't get it to work. I copied all the scala ".el" files to a directory under my home directory. Then I put the following in my .emacs file:

(add-to-list 'load-path "/home/paielli/scala/xemacs") ; directory with .el files
(require 'scala-mode-auto)

But this doesn't seem to work. My xemacs installation is on a network that I have no control over (I don't even know where to find it in the filesystem). Also, I am barely familiar with emacs lisp. Thanks.

Russ P.

Christian Szegedy
Joined: 2009-02-08,
User offline. Last seen 42 years 45 weeks ago.
Re: Scala & Emacs?
I use scala with Emacs on Linux.

Last time I checked, it did not work with XEmacs though.

On Sun, Feb 15, 2009 at 4:04 PM, Russ Paielli <russ [dot] paielli [at] gmail [dot] com> wrote:
On Fri, Feb 13, 2009 at 3:33 AM, Normen Müller <n [dot] mueller [at] jacobs-university [dot] de> wrote:

Now --- due to lack of memory on my laptop --- I would like to use emacs & Scala mode to keep on developing.  I installed the Scala emacs mode, but how do I configure the interpreter to pre-load some libraries cause otherwise I can't run/ compile my code.  Or do I have to use sth. like ant scripts instead?

Since you installed the emacs Scala mode, would you mind giving me a clue how to do it (for XEmacs on Linux)? I looked at the README file included with the Scala distribution, and I took a crack at it, but I can't get it to work. I copied all the scala ".el" files to a directory under my home directory. Then I put the following in my .emacs file:

(add-to-list 'load-path "/home/paielli/scala/xemacs") ; directory with .el files
(require 'scala-mode-auto)

But this doesn't seem to work. My xemacs installation is on a network that I have no control over (I don't even know where to find it in the filesystem). Also, I am barely familiar with emacs lisp. Thanks.

Russ P.


Grey
Joined: 2009-01-03,
User offline. Last seen 42 years 45 weeks ago.
Re: Scala & Emacs?

I use emacs + maven (using ant as well) as my "make" system + the provided
scala-mode + some minor custom elisp .el work + exuberant ctags + a few code
development centric sundry emacs modes = what I think is a fine development
system.

I'm not blogger but this weekend I'm going to blog "How I develop in Scala"
and go over my setup and hopefully someone will find some value out of it..
Its not for everyone, but I claim its equal or better then the alternatives
available today. BTW I also believe that the maturation of the Eclipse
plugin would exceed my setup in desired feature/function for the vast
majority of people. Not for me, however, True Dino.

I just need to tweak a couple of indentation issues...

But you can develop very effectively with the above combo.

Normen Müller-2 wrote:
>
> He,
>
> I have a Scala eclipse project with some referenced libraries and more
> than one source folder configured.
>
> Now --- due to lack of memory on my laptop --- I would like to use
> emacs & Scala mode to keep on developing. I installed the Scala emacs
> mode, but how do I configure the interpreter to pre-load some
> libraries cause otherwise I can't run/ compile my code. Or do I have
> to use sth. like ant scripts instead?
>
> Cheers,
> --
> Normen Müller
>
>
>

normen.mueller
Joined: 2008-10-31,
User offline. Last seen 3 years 8 weeks ago.
Re: Scala & Emacs?

On Feb 17, 2009, at 8:09 PM, Grey wrote:
> I'm not blogger but this weekend I'm going to blog "How I develop in
> Scala"
> and go over my setup and hopefully someone will find some value out
> of it..

I am highly interested in this blog post. Please post the link as
soon as you are done. In turn I'll send you my feedback on how good
you explained and if I could manage to reproduce. Thanks in advance.

Cheers,
--
Normen Müller

Ricky Clarkson
Joined: 2008-12-19,
User offline. Last seen 3 years 2 weeks ago.
Re: Scala & Emacs?
What he said.

2009/2/17 Normen Müller <normen [dot] mueller [at] googlemail [dot] com>
On Feb 17, 2009, at 8:09 PM, Grey wrote:
I'm not blogger but this weekend I'm going to blog "How I develop in Scala"
and go over my setup and hopefully someone will find some value out of it..

I am highly interested in this blog post.  Please post the link as soon as you are done.  In turn I'll send you my feedback on how good you explained and if I could manage to reproduce.  Thanks in advance.

Cheers,
--
Normen Müller






Grey
Joined: 2009-01-03,
User offline. Last seen 42 years 45 weeks ago.
Re: Scala & Emacs?

Part - I Scala and basic emacs.

http://thegreylensmansview.blogspot.com/

I'm not a blogger ... First go has way too much verbiage and little
substance I know. The next one about emacs+scala+maven will be specific and
to the point. Promise.

Ray

Normen Mueller wrote:
>
> On Feb 17, 2009, at 8:09 PM, Grey wrote:
>> I'm not blogger but this weekend I'm going to blog "How I develop in
>> Scala"
>> and go over my setup and hopefully someone will find some value out
>> of it..
>
> I am highly interested in this blog post. Please post the link as
> soon as you are done. In turn I'll send you my feedback on how good
> you explained and if I could manage to reproduce. Thanks in advance.
>
> Cheers,
> --
> Normen Müller
>
>
>
>
>
>
>

Robert Kosara
Joined: 2008-12-18,
User offline. Last seen 42 years 45 weeks ago.
Re: Scala & Emacs?
That's great, thanks! I haven't used Emacs in many years, it's fun to play with it again. ;) I'm using Aquamacs Emacs on the Mac, and it's working well. I'm not sure if I'll switch from NetBeans, but it's great to have that alternative. I also like yasnippet, that's pretty useful.
Looking forward to the second part!

Robert

On Tue, Feb 17, 2009 at 8:29 PM, Grey <ray [dot] racine [at] gmail [dot] com> wrote:

Part - I Scala and basic emacs.

http://thegreylensmansview.blogspot.com/

I'm not a blogger ... First go has way too much verbiage and little
substance I know.  The next one about emacs+scala+maven will be specific and
to the point.  Promise.

Ray



Normen Mueller wrote:
>
> On Feb 17, 2009, at 8:09 PM, Grey wrote:
>> I'm not blogger but this weekend I'm going to blog "How I develop in
>> Scala"
>> and go over my setup and hopefully someone will find some value out
>> of it..
>
> I am highly interested in this blog post.  Please post the link as
> soon as you are done.  In turn I'll send you my feedback on how good
> you explained and if I could manage to reproduce.  Thanks in advance.
>
> Cheers,
> --
> Normen Müller
>
>
>
>
>
>
>

--
View this message in context: http://www.nabble.com/Scala---Emacs--tp21994710p22070391.html
Sent from the Scala - User mailing list archive at Nabble.com.


david.bernard
Joined: 2009-01-08,
User offline. Last seen 1 year 27 weeks ago.
Re: Scala & Emacs?
May be that could help some of you
http://github.com/stevej/emacs/tree/75d4f10652ec6ddc5ed7a4019237cce36f6488ba/scala-mode

On Wed, Feb 18, 2009 at 03:55, Robert Kosara <rkosara [at] gmail [dot] com> wrote:
That's great, thanks! I haven't used Emacs in many years, it's fun to play with it again. ;) I'm using Aquamacs Emacs on the Mac, and it's working well. I'm not sure if I'll switch from NetBeans, but it's great to have that alternative. I also like yasnippet, that's pretty useful.
Looking forward to the second part!

Robert

On Tue, Feb 17, 2009 at 8:29 PM, Grey <ray [dot] racine [at] gmail [dot] com> wrote:

Part - I Scala and basic emacs.

http://thegreylensmansview.blogspot.com/

I'm not a blogger ... First go has way too much verbiage and little
substance I know.  The next one about emacs+scala+maven will be specific and
to the point.  Promise.

Ray



Normen Mueller wrote:
>
> On Feb 17, 2009, at 8:09 PM, Grey wrote:
>> I'm not blogger but this weekend I'm going to blog "How I develop in
>> Scala"
>> and go over my setup and hopefully someone will find some value out
>> of it..
>
> I am highly interested in this blog post.  Please post the link as
> soon as you are done.  In turn I'll send you my feedback on how good
> you explained and if I could manage to reproduce.  Thanks in advance.
>
> Cheers,
> --
> Normen Müller
>
>
>
>
>
>
>

--
View this message in context: http://www.nabble.com/Scala---Emacs--tp21994710p22070391.html
Sent from the Scala - User mailing list archive at Nabble.com.



normen.mueller
Joined: 2008-10-31,
User offline. Last seen 3 years 8 weeks ago.
Re: Scala & Emacs?

On Feb 18, 2009, at 2:29 AM, Grey wrote:
> Part - I Scala and basic emacs.
>
> http://thegreylensmansview.blogspot.com/
>
> I'm not a blogger ... First go has way too much verbiage and little
> substance I know. The next one about emacs+scala+maven will be
> specific and
> to the point. Promise.

Thanks Grey! I'll try it out asap.

Cheers,
--
Normen Müller

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