|
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.)
Optimally it would be C-c C-k to compile it, maybe load the .beam, and test directly from within emacs. I feel like I'm missing something here... Thanks! -mox
_______________________________________________ erlang-questions mailing list [hidden email] http://erlang.org/mailman/listinfo/erlang-questions |
|
Hi Mike,
Have you tried Distel (http://github.com/massemanet/distel) that extends standard erlang-mode turning it into a nice Erlang IDE? It does the same job as SLIME for Common Lisp. On May 13, 2011, at 1:39 AM, 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.) > Optimally it would be C-c C-k to compile it, maybe load the .beam, and test directly from within emacs. > > I feel like I'm missing something here... > > Thanks! > > -mox > _______________________________________________ > erlang-questions mailing list > [hidden email] > http://erlang.org/mailman/listinfo/erlang-questions --ska _______________________________________________ erlang-questions mailing list [hidden email] http://erlang.org/mailman/listinfo/erlang-questions |
|
I have it installed but it seems to not work well for me. (User error is most likely the cuplrit.)
I get "EXIT: <0.6.0> [emacs-error "(cl-assertion-failed (derl-node-p node))"]" with just about every command I try.
I wasn't sure if distel was worth spending time digging into if there were better options around, or better workflows. If "distel is it" then I'll spend the time to dig into figuring out why it doesn't work for me. :)
-mox On Thu, May 12, 2011 at 11:54 AM, Kamil Shakirov <[hidden email]> wrote: Hi Mike, _______________________________________________ erlang-questions mailing list [hidden email] http://erlang.org/mailman/listinfo/erlang-questions |
|
Hmm, works for me: GNU Emacs 23 (OSX and GNU/Linux), R14B, distel HEAD from git. On May 13, 2011, at 2:21 AM, Mike Oxford wrote: I have it installed but it seems to not work well for me. (User error is most likely the cuplrit.) --ska
_______________________________________________ erlang-questions mailing list [hidden email] http://erlang.org/mailman/listinfo/erlang-questions |
|
In reply to this post by Mike Oxford
Hi Mike,
you could try erl-mvn-distel emacs integration for the maven-erlang-plugin. It's an emacs mode that currently features * JIT compiling with error markup and tooltips * easy toggling between source and test source * eunit test integration to run single test functions or test modules and report the results * eunit test tracing for debugging Since its an emacs integration for the maven-erlang-plugin you would need to manage your project with maven. erl-mvn-distel is still under development but it does the job quite well. Links: * maven-erlang-plugin http://erlang-plugin.sourceforge.net/ * erl-mvn-distel http://github.com/sheyll/erl-mvn-distel/ Regards Tobias Am 12.05.2011 20:39, schrieb Mike Oxford: > 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.) > Optimally it would be C-c C-k to compile it, maybe load the .beam, and > test directly from within emacs. > > I feel like I'm missing something here... > > Thanks! > > -mox > > > > _______________________________________________ > erlang-questions mailing list > [hidden email] > http://erlang.org/mailman/listinfo/erlang-questions -- Lindenbaum GmbH Dipl.-Inform. Tobias Schlager, Software Engineer Erbprinzenstr. 4-12, 76133 Karlsruhe, Deutschland Tel: +49 721 48 08 48 - 000, Fax: +49 721 48 08 48 - 801, E-Mail: [hidden email] Firmensitz: Erbprinzenstr. 4-12, Eingang A, 76133 Karlsruhe Registergericht: Amtsgericht Mannheim, HRB 706184 Geschäftsführer: Sven Behrens, Dr. Ralf Nikolai Steuernummer: 35007/02060, USt. ID: DE 263797265 http://www.lindenbaum.eu _______________________________________________ erlang-questions mailing list [hidden email] http://erlang.org/mailman/listinfo/erlang-questions |
|
In reply to this post by Mike Oxford
On Thu, May 12, 2011 at 8:39 PM, Mike Oxford <[hidden email]> 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.) > Optimally it would be C-c C-k to compile it, maybe load the .beam, and test > directly from within emacs. > I feel like I'm missing something here... > Thanks! > -mox > _______________________________________________ > erlang-questions mailing list > [hidden email] > http://erlang.org/mailman/listinfo/erlang-questions > > Hi Mike, There are some options already available within the Erlang/OTP distribution. Don't know if you've seen these? They need (better) documentation to be easier to find and use, however. First, there's erlang-eunit which makes it quicker to work with eunit tests. Just edit your code or test and type "C-c C-e k" to compile both source code and test modules. Type "C-c C-e t" to toggle between the code and test. More bindings and options exist. Then there's erlang-flymake which will compile an erlang module and highlight any warnings and errors on the fly. This may require some customization if your project needs include files or beam files from other apps than the one currently being compiled. More details below. Hope that's a start. Cheers, Klas EUnit support ============= If you work a lot with eunit tests, these addons might come in handy. Add this to .emacs: (require 'erlang-eunit) Running test suites ------------------- C-c C-e k Compile the source and test files and run all EUnit tests in the module. C-c C-e t Switch to the src file if the EUnit test file is the current buffer and vice versa C-c C-e l Compile the source and test files and repeat the most recent EUnit test run. C-c C-e j Compile the source and test files and run the current EUnit test. Code coverage analysis ---------------------- C-c C-e c Compile the source and test files and run the EUnit test suite and measure code coverage. C-c C-e v Cover compile current module. C-c C-e a Analyze the data collected by cover tool for the module in the current buffer. Customization ------------- These variables alter the default behaviour of the eunit addons: erlang-eunit-src-candidate-dirs (default "../src" followed by ".") Names of directories which to search for source files matching an EUnit test file. The first directory in the list will be used, if there is no match. erlang-eunit-test-candidate-dirs (default "../test" followed by ".") Names of directories which to search for EUnit test files matching a source file. The first directory in the list will be used, if there is no match. erlang-eunit-autosave (default nil) Set to non-nil to automtically save unsaved buffers before running tests. This is useful, reducing the save-compile-load-test cycle to one keychord. On-the-fly syntax check ======================= This will compile source code on the fly (integrates with flymake) and give you instant feedback. Start using flymake with erlang by putting the following somewhere in your .emacs file: (require 'erlang-flymake) Flymake is rather eager and does its syntax checks frequently by default and if you are bothered by this, you might want to put the following in your .emacs as well: (erlang-flymake-only-on-save) There are a couple of variables which control the compilation options: erlang-flymake-command (default "erlc") The command that will be used to perform the syntax check. erlang-flymake-get-code-path-dirs-function This is the name of a function which shall return a list of ebin directories to add to the code path. Will by default return the compiled apps's ebin directory. erlang-flymake-get-include-dirs-function This is the name of a function which shall return a list of include directories to add to the include path. Will by default return the compiled apps's include directory. erlang-flymake-extra-opts A list of options that will be passed to the compiler. These are in there by default: warn_obsolete_guard warn_unused_import warn_shadow_vars warn_export_vars strong_validation report _______________________________________________ erlang-questions mailing list [hidden email] http://erlang.org/mailman/listinfo/erlang-questions |
|
Thank you Klas! This is great documentation. This should be part of http://www.erlang.org/doc/man/erlang.el.html.
_______________________________________________ erlang-questions mailing list [hidden email] http://erlang.org/mailman/listinfo/erlang-questions |
|
On Tue, Jun 28, 2011 at 6:43 PM, Alain O'Dea <[hidden email]> wrote: Thank you Klas! This is great documentation. This should be part of http://www.erlang.org/doc/man/erlang.el.html. +1 on that. Would be excellent if some generous Emacs+Emacs-Erlang+Distel+Etest expert, with some time in hand, could list down the commonly used key-strokes in some kind of a handy 1 pager. How most of these experts use Emacs is enviously slick, and would be great to get better. Being a predominantly vi/vim user, Emacs doesn't come naturally. _______________________________________________ erlang-questions mailing list [hidden email] http://erlang.org/mailman/listinfo/erlang-questions |
|
In reply to this post by Mike Oxford
On Thu, May 12, 2011 at 12:39 PM, Mike Oxford <[hidden email]> 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 [hidden email] http://erlang.org/mailman/listinfo/erlang-questions |
|
Can you post your makefile for example?
I'm currently spinning releases for every dev change and if you've got a better way I'm dying to hear! -mox On Tue, Jun 28, 2011 at 8:33 AM, Garrett Smith <[hidden email]> wrote: > On Thu, May 12, 2011 at 12:39 PM, Mike Oxford <[hidden email]> 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 [hidden email] http://erlang.org/mailman/listinfo/erlang-questions |
|
In reply to this post by Garrett Smith-5
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 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 <[hidden email]> wrote:
_______________________________________________ erlang-questions mailing list [hidden email] http://erlang.org/mailman/listinfo/erlang-questions |
|
In reply to this post by Mike Oxford
On Tue, Jun 28, 2011 at 12:38 PM, Mike Oxford <[hidden email]> wrote:
> Can you post your makefile for example? > > I'm currently spinning releases for every dev change and if you've got > a better way I'm dying to hear! I posted a sample project in this repo: https://github.com/handsoncode/erlang See dev-workflow/makefile-reloader. Garrett _______________________________________________ erlang-questions mailing list [hidden email] http://erlang.org/mailman/listinfo/erlang-questions |
| Powered by Nabble | Edit this page |
