Abhi Yerra

Rants of lunatic

Changing Indent Style

leave a comment »

So I am starting to use emacs quite a lot. However, I hate the default emacs coding style which is the GNU style. So I want to convert say code that looks like GNU to K&R. Well this is how one would go about doing this.

M-x c-set-style k&r
M-x mark-whole-buffer
M-x c-indent-line-or-region

Update: The problem with this is say you want the K&R style if’s where you have:

if(statement) {
stuff;
} else {
stuff;
}

This is not possible in this method. You will get:

if(statement)
{
stuff;
}
else
{
stuff;
}

Written by abhiyerra

March 26, 2006 at 8:52 pm

Posted in all

Leave a Reply