I'm now using the bsd style in emacs. It's a style I started with years back after coming from learning pascal and I've decided will use over other styles for new projects.
However, there is two things that bug me with the emacs bsd style. It indents inline methods.
1) How do I stop it indenting like this?
i.e.
class A
{
A()
{
// do stuff
}
};
I want the brace to be on the same line as methods like this开发者_C百科.
class A
{
A()
{
// do stuff
}
};
Looking around it appears like I need to set c-set-offset substatement-open' 0)
But I don't know how to attach this to the bsd style in lisp. I gave it a go, but got parse errors on starting emacs.
2) How to make the tab key insert 4 spaces?
I just doubled checked my emacs setup and this does what you describe for me:
(setq c-default-style "bsd"
c-basic-offset 4)
Try this to insert spaces instead of tabs:
(setq tab-width 4)
(setq indent-tabs-mode nil)
精彩评论