Hi,
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.
In Emacs I can write the following very easily and press tab to cycle between the possible indentations. In the code below there are only one possibility for each line, and pressing tab multiple times does not insert any tab or space characters.
f_25 :: [a] -> a -> [a] f_25 s c = foldr g [] s where g x acc = if x == c then acc else x : acc
If I for example unindent the code so I get the code below, then pressing tab once for each line (or seleting the code and executing M- x indent-region) will give me the pretty indented version back. Is there any chance that this kind of functionality could be implemented in TextMate?
f_25 :: [a] -> a -> [a] f_25 s c = foldr g [] s where g x acc = if x == c then acc else x : acc
Kind regards, Emil Hedevang
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.
2008/3/4, Allan Odgaard throw-away-2@macromates.com:
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.
Thanks, Allan. It looks interesting. I will give it a try this evening.
Regards, Emil Hedevang
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