For some reason, my emacs indent the c++ class method wrong.
Current:
class B
{
public:
B()
{
}
};
But I want:
class B
{
public:
B()
{
}
};
Does anybody how to make it in .emacs?
Thanks!
For some reason, my emacs indent the c++ class method wrong.
Current:
class B
{
public:
B()
{
}
};
But I want:
class B
{
public:
B()
{
}
};
Does anybody how to make it in .emacs?
Thanks!
Try setting inline-open
to '0
. That should place a brace that opens an in-class inline method on the same indent level. For example:
(c-set-offset 'inline-open '0)
There also might be something else, it is hard to say. CC-Mode document has more options and its description that might also be helpful to you.
Below is the example of my C++ style that is based on Linux coding style that might be of interest to you:
(defun vlad-cc-style()
(c-set-style "linux")
(c-set-offset 'innamespace '0)
(c-set-offset 'inextern-lang '0)
(c-set-offset 'inline-open '0)
(c-set-offset 'label '*)
(c-set-offset 'case-label '*)
(c-set-offset 'access-label '/)
(setq c-basic-offset 4)
(setq tab-width 4)
(setq indent-tabs-mode nil)
)
(add-hook 'c++-mode-hook 'vlad-cc-style)
Hope it helps. Good Luck!