Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

The default format when I write a while statement is as follows:

  while(true)
    {


    }

I prefer to using the following:

  while(true)
  {


  }

Is there a way that I can customize emacs to following this format?

Thank you

share|improve this question
1  
hmm.. which language and which major mode.? C and cc-mode ??. –  kindahero Apr 16 '12 at 18:24
add comment

1 Answer 1

You can use c-set-style and friends to change which general style of indentation you want. You can also change individual pieces of the indentation engine to get something very personalized. See the EmacsWiki page for details. What you probably want (to a first approximation) is simply

(c-set-style "bsd")

in a hook, or

(setq c-default-style "bsd")

in your .emacs.

share|improve this answer
    
I have auto-complete setting that has known conflict with above solution. This solution solved my problem. –  q0987 Apr 18 '12 at 16:24
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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