[erlang-questions] Erlang emacs workflow question

Dale Harvey <>
Tue Jun 28 20:42:37 CEST 2011


I wrote a little compile helper plugin for emacs, I am not an emacs guru but
it helps me

https://github.com/daleharvey/dotfiles/blob/master/emacs/compile-helper/compile-helper.el

With the following config

(setq build-helper-files
       '(("Makefile" . "make")
         (".couchapprc" . "couchapp push")))

Whenever I press M-x compile (I bind to M-1) it will take the current
directory and search backwards until it finds some file that it recognizes,
in this case it is Makefile, I have my Makefile kick off a rebar compile.
and am using mochiweb:reloader when running a development to which will hot
load any newly compiled beam files.

If there are any errors during recompilation then an emacs buffer will popup
with a link directory to the line the error was in, I also use distel +
flymake mode to get syntax checking as I type so syntax errors are pretty
rare.

I havent actually added distel to the setup - but the compile helper and
erlang mode is in - https://github.com/daleharvey/dotfiles/tree/master/emacs

Hope its handy
Dale

On 28 June 2011 16:33, Garrett Smith <> wrote:

> On Thu, May 12, 2011 at 12:39 PM, Mike Oxford <> wrote:
> > Write some code
> > C-c C-k to make sure it compiles
> > Spin a release (using rebar) in another window
> > Run the code in another window
> > Is there a better/more streamlined way to do this, all from within emacs
> (I
> > have erl running in another window.)
>
> It's a bit more elaborate than what you're asking for, but I use Emacs
> and an Erlang shell under tmux, which provides a pretty nice workflow.
>
> Emacs is in tmux window 0, use for editing and compiling. I have a key
> binding for 'compile' (C-x C-m) and use a makefile in the src
> directory. This gives me a quick way to compile the app and use C-x ~
> to visit errors/warnings.
>
> I run erl in tmux window 1 and always keep it running. I have a
> 'shell' target in my makefile that handles setting ERL_LIBS (or
> explicit path settings) and starts any apps that I typically work with
> under dev.
>
> In particular, and very importantly, I always start Mochiweb's
> reloader module (which would be a great addition to core Erlang!).
> This will watch loaded modules for changes and automatically reload
> them. So when I compile from Emacs and switch over to the erl shell,
> all my latest changes are available.
>
> This "long running" shell lets me play around, test, whatever as I
> modify code in Emacs. It's a more ad hoc mode than re-running tests
> from a newly started Erlang VM. It also gives you a feel for how
> Erlang apps can indeed "run forever" with loosely coupled components
> that can be restarted, reloaded, corrupted, repaired, etc.
>
> While I know it's a common work flow, I'm not a fan of generating
> releases and restarting erl for routine dev changes. I actually can't
> imagine doing that, given how seamless the 'reloader' workflow is.
>
> Btw, tmux in this case is optional -- you could do the same thing in
> Emacs. I like (strike that, love) tmux because it does for shell
> sessions what Emacs does for text files. If you happen to do a lot of
> dev on remote servers over ssh, tmux is a life saver if you lose your
> connection.
>
> Garrett
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110628/af9d9063/attachment.html>


More information about the erlang-questions mailing list