Malice
Malice

Reputation: 1482

Emacs changing c coding style

How do i change the c coding style format in emacs ? Specifically i need to change the indentation in the c code shown by emacs from i per block to 2 per block

Upvotes: 3

Views: 3924

Answers (3)

Rörd
Rörd

Reputation: 6681

Among the built-in indentation styles, "gnu" has an indentation width of 2 characters. You can choose an indentation style with c-set-style, bound to C-c..

Upvotes: 1

kmalmur
kmalmur

Reputation: 2839

Take a look at http://code.google.com/p/google-styleguide/
There is ready to use macro. You can customize it if you want.

Upvotes: 0

Rakis
Rakis

Reputation: 7874

Type M-x followed by "customize-mode" followed by "c-mode". Then use the built-in customization page to override the default "C Basic Offset" with your new value of "2". When you're done, be sure to select "Save for future sessions" at the top of the page.

Upvotes: 4

Related Questions