I experimented a bit with erlang native pretty printing:

  {ok, Ast} = epp_dodger:parse_file(MyErlangSourceFile),
  String = erl_prettypr:format(erl_syntax:form_list(Ast)),
  io:format("~s~n", [String]).

That is very easy to put into an escript command for textmate. For
prettyprinting selctions, there is a bit more trickery necessary, see

http://www.trapexit.org/forum/viewtopic.php?p=130&sid=d3504836a6840bbfd7c5291700f3e82d

On Jan 23, 6:16 pm, flyfish <[EMAIL PROTECTED]> wrote:
> "some formatting" means that once you have the bundle installed it
> will do things like auto add closing parens and brackets, when using
> key bindings you get formatted prototype code like "control shift f"
> to create a function will look like this:
>
> function (param) when guard ->
>     body
>
> and generating a fun like this:
>
> fun
>     (pattern) when guard ->
>         body
> end
>
> and auto generated recieve prototype code like this:
>
> receive
>     pattern when guard ->
>         body
> after
>     expression ->
>         body
> end
>
> Of course you get syntax coloring, It sadly :( does not have a
> reformatter to beautify existing code. It would be nice to see that
> feature added. Maybe I will look into extending the bundle to do that
> when I have time and submit the patch to textmate to be included.
> There are currently 24 key bindings for generating prototype code.
> Hope this helps a little. I currently switch between emacs and
> textmate myself as I like different features each one has.
>
> On Jan 23, 2:42 pm, Roberto Saccon <[EMAIL PROTECTED]> wrote:
>
> > can you elaborate on how it does "some formatting" ?
>
> > what is the command or default key-binding for it ?
>
> > I want to reformat a given document and text selection.
>
> > On Jan 23, 4:24 pm, flyfish <[EMAIL PROTECTED]> wrote:
>
> > > It does do some formatting and gives you several shortcut keys that
> > > will insert layouts of functions, case logic and many others. Export
> > > the bundle and double click on the bundle file (Erlang.tmbundle dir)
> > > to install it. Then an Erlang menu option will show up under bundles
> > > in the textmate main menu bar. You can see all the key bindings and
> > > features under there.
>
> > > On Jan 23, 2:42 am, "Yariv Sadan" <[EMAIL PROTECTED]> wrote:> I'm using 
> > > the default one that came with TextMate. Is the one from the
> > > > repository more recent? Can it do code formatting?
>
> > > > On Jan 22, 2008 11:33 PM, flyfish <[EMAIL PROTECTED]> wrote:
>
> > > > > Are you using the erlang bundle  from textmate's repository?
>
> > > > >http://macromates.com/svn/Bundles/trunk/Bundles/Erlang.tmbundle
>
> > > > > Yariv Sadan wrote:
> > > > > > Hi,
>
> > > > > > I'm trying to use TextMate as a replacement for emacs, but the auto
> > > > > > formatting for Erlang code sucks. Does anyone know of a decent  
> > > > > > Erlang
> > > > > > code formatting capability in TextMate?
>
> > > > > > Yariv
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"erlyweb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to