Installing Emacs 24.4 broke my haxe mode. The mode for the HaXe language doesn't seem to be maintained any more so I'm trying to fix it myself.

Firstly, I had a cl-macroexpand-all problem which forced me to add

(require 'cl)

before loading the mode.

Secondly, and that's where things get tricky, the indenting of typeful function declarations is broken (or at least that's where I think the problem is originated):

class Test {

    public function notFailingAfterThis() {


    public function butFailingAfterThis(): Int {


                                           public function failingHere(): Void {


                                                                          public function hereEvenMore() {

        public function endOfTheFailure() {



My knowledge of Emacs lisp is too limited to find the error (if you want to test this yourself, you can download haxe mode's source and create this Test.hx file).

HaXe allows typeless and typeful declarations, with a syntax similar to ActionScript.

var myVar: MyVarType;
function myFunction(): MyFunctionReturnType {}
var myUntypedVar;
function myUntypedFunction() {}

Any ideas how to fix this, before I'm forced to make the whole plugin myself? It seems to be a feature that put the carret at the right indenting after a carriage return, which it didn't do before I updated emacs.

  • You should turn off aggressive-indent-mode (since you add a tag for it, I assume you are using it) to see the error still occurs.
    – Tu Do
    Commented Jan 5, 2015 at 1:44
  • @TuDo In fact I don't think I am, but it seems to be somehow related to this problem so I added the tag?! Commented Jan 5, 2015 at 2:23
  • aggressive-indent-mode refers to this package.
    – Tu Do
    Commented Jan 5, 2015 at 2:29
  • @TuDo Alright, I'm removing the tag until further notice. Commented Jan 5, 2015 at 8:57
  • Hey, at some point I thought of taking over this project, because it seems like nobody works on it. I did some work, but then lost interest. To be honest, it's mostly broken now, but if someone else uses it, I might try to bring it to a workable condition. code.google.com/p/haxe-mode (again, as I've said, it's mostly broken), but if you will be interested to work on it, I'll try to fix at least the obvious things.
    – wvxvw
    Commented Jan 5, 2015 at 19:24

1 Answer 1


Okay so I had to update one of the libraries that my old version of emacs was using so I took this week-end as an opportunity to make my own major mode for HaXe.

I based it on fundamental mode, which may be controversial because CC-mode might make more sense, but we'll avoid future problems with CC-mode evolution — as it was the case here — when doing so.

So in case it helps anybody, here's a public git (I've released it on GPL v3):


This mode is pretty basic but it somehow supports syntax highlighting and indentation.

I have found a few minor bugs or improvements to make already, but at this point I believe it's already better than using a javascript mode.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.