[TxMt] Emacs-like indentation for the Haskell mode?

Emil Hedevang emilhedevang at gmail.com
Tue Mar 4 13:55:05 UTC 2008


On Mar 4, 2008, at 7:12 AM, Allan Odgaard wrote:

> On 3 Mar 2008, at 22:26, Emil Hedevang wrote:
>
>> I would like to use TextMate as my Haskell editor instead of Emacs  
>> but one thing is holding me back and that is the wonderfull  
>> indentation features in the Haskell mode for Emacs.
>
> Have a look at this blog post: http://gragusa.wordpress.com/
>
> It’s about using Emacs as an indenter called from TextMate.

I have now had a look at it.

The following code implemented as a command in TextMate works to  
indent the Haskell code. It assumes that the Emacs Haskell mode is  
located a certain place.

However, this still does not allow one to cycle through the possible  
indentations while coding. Does anyone have an idea on how to get this?

#!/usr/bin/perl
my $in;
my $now = "tidyHaskellcode";
my $file = "/tmp/tmptx_${now}.hs";
my $eb=$ENV{'TM_BUNDLE_SUPPORT'};
open FILE, ">$file" or die "unable to open $file $!";
while (<>) {
print FILE $_;
}
close(FILE);
`emacs -batch -eval '(load "~/Local/lib/emacs/haskell-mode/haskell- 
site-file") (add-hook \'haskell-mode-hook \'turn-on-haskell-indent)' $ 
{file} -eval '(indent-region (point-min) (point-max) nil)' -f save- 
buffer &> /dev/null`;
my $in = `cat ${file}`;
print $in;


Regards,
Emil


More information about the textmate mailing list