Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Emacs and indent
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Highlands
Guru
Guru


Joined: 22 Apr 2003
Posts: 366
Location: Sundsvall, Sweden

PostPosted: Sun Oct 23, 2005 10:12 pm    Post subject: Emacs and indent Reply with quote

I've installed emacs-cvs and now when i code C++ code the indent-mode wants code like this.
[code]
if (a == b) {
a = b;
}else{
b = a;
}
[/code]
but i want
[code]
if (a == b)
{
a = b;
}
else
{
b = a;
}
[/code]

How can i change this?
Back to top
View user's profile Send private message
allucid
Veteran
Veteran


Joined: 02 Nov 2002
Posts: 1314
Location: atlanta

PostPosted: Mon Oct 24, 2005 2:10 am    Post subject: Reply with quote

fix your code blocks and then we'll talk. ;)

In the meantime, here are some settings you might be interested that go in in your ~/.emacs or ~/.emacs.el:
Code:
(setq-default indent-tabs-mode nil) ;; spaces instead of tabs                   
(setq default-tab-width        4)   ;; tab width                               
(setq c-basic-offset           4)   ;; C indentation offset
(setq c-default-style "gnu")        ;; indentation style


fudge with the values until you get what you want. This may also help.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum