TextMate: Erlang Build Dialog

Goals for Erlang Builder:
  • Compile all Erlang sources in same dir as saved file
  • Show HTML output of errors and warnings if any is provided
  • Link HTML output to lines in Erlang source files
  • Generate BEAM files in $TM_PROJECT_DIRECTORY/ebin
  1. Set ERLANG_HOME in Preferences>Advanced>Shell Variables
  2. Get/Update the Erlang bundle:
    mkdir -p ~/Library/Application\ Support/TextMate/Bundles
    cd ~/Library/Application\ Support/TextMate/Bundles/
    svn co http://macromates.com/svn/Bundles/trunk/Bundles/Erlang.tmbundle
    osascript -e 'tell app "TextMate" to reload bundles'
  3. Grab Warning/Error icons for the Erlang bundle from the ADC Reference Library:
    cd ~/Library/Application\ Support/TextMate/Bundles/Erlang.tmbundle/
    mkdir Resources
    cd Resources
    for icon in tr_warn_error.jpg tr_warn_alert.jpg
        do cp $srcdir/$icon .
  4. Create a Command called Compile in the Erlang bundle
    1. Set Save to 'Current File'
    2. Paste the following Ruby script into Command(s):
    3. Set Input to 'None'
    4. Set Output to 'Discard'
    5. Set Activation to 'Key Equivalent' and type Command-S in the key-binding field
    6. Set Scope to 'source.erlang'
  5. Save an Erlang source file with a deliberate error and see the output
  6. Post your feedback as a comment
You now have an immediate indication of errors each time you save. If no compile errors or warnings are present no output will be shown. If you have commit access to the TextMate Bundle Repository, please commit this change.