I use the default style linux (snippet from here)
;; set indentation style linux for c++
(setq c-default-style "linux"
c-basic-offset 4)
But I can't get it to work with the style setting which sets zero indent for namespaces (from this question)
(defconst my-cc-style
'("cc-mode"
(c-offsets-alist . ((innamespace . [0])))))
(c-add-style "my-cc-mode" my-cc-style)
Once I choose my-cc-style with C-c . RET my-cc-mode RET
, I get the strange brace indent back which the first setting removes, i.e. like this:
virtual string_type do_falsename() const
{
Is there a way to keep everything from the default style, and change only the namespace indentation?
Edit: there are a multiple possible solutions to be found here: https://stackoverflow.com/questions/2619853/emacs-override-indentation/22711444#22711444
c-mode-common-hook
) that calls(c-set-offset 'innamespace 0)
. Let me know if I should explain this in more detail. – Constantine Dec 18 '14 at 18:45