Here is a short program that went into this weirdo mode several times fairly quickly. Adding #include directives might be involved, but maybe not. Again, the same symptom: everything goes flush left until I close out and re-visit the file. So, when you first visit the file, I am sure it will indent properly. And just because you fiddle it, it doesn't mean it will stop indenting properly. I do not know what the trigger mechanism is. I just know it was much more frequent (several times in a few minutes). Again, "linux" style: $ cat ../.dir-locals.el ( (nil . ((indent-tabs-mode . t) (tab-width . 8) (show-trailing-whitespace . t) (fill-column . 132))) (c-mode . ((c-file-style . "linux"))) )