In the Haxe programming language, you can specify the type of the return value of a function with a colon.

function funcName() : ReturnType { }

This becomes a problem when using emacs with haxe-mode. Whenever I try to enter a newline, the point is automatically indented to the column as to where the ":" character is found.

Here's a gif that better explains what I mean:

enter image description here

As you can see, creating a newline after the first function works fine. But on the second function (the one with a return datatype of ": Void"), we can see that the newline is indented at the same column of the ":" character in ": Void".

I tried disabling electric-indent-mode similar to the one found here but it did not do anything. I tried messing around with tab spacings but to no avail.

I would appreciate some help with this one.


  • Oh, wow, I'm one of the authors of this one and... well, I'm really sorry it's in the state that it is, but it is really far from working properly. I've been trying to patch some pieces of C mode grammar to make it work with Haxe, but eventually it become too complex and I didn't have time to work on it any more / wasn't working with Haxe, so I gave it up. Finally, I don't think that basing it on C mode was a good idea. I think I started working on a grammar for Bowine parser used in Semantic, but never finished it. So, if anyone will try to do anything about it, that'd be the way to go.
    – wvxvw
    Commented Dec 14, 2015 at 6:19
  • Hey @wvxvw, no problem. I was able to actually set it up properly and thanks to this, I now have a decent Haxe environment on emacs. Lots of room for improvement but I knew the risks coming in. Commented Dec 14, 2015 at 10:31


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.