Problem: When a C++ file is loaded, the indentation rules are not always what they should be, i.e. instead of indenting by 3, it will indent by 1 or 8 for that session. This occurs consistently through the buffer, as if I have changed the variable for
Here is the code I have in general configurations file that is loaded by my init.el:
;;No tabs, set to 3 spaces when found (setq-default indent-tabs-mode nil) (setq-default tab-width 3) ;;C AND C++ ;;--------- (setq c-default-style "linux" c-basic-offset 3 c-basic-indent 3 indent-tabs-mode nil)
To reiterate: sometimes the file will load and the indentation rules, as given above, will load correctly and work just fine. However, very often it will not and will have a 'new' rule in the session, indenting by some new amount X of spaces. Going to
M-x Customize Variable and checking
c-basic-indent shows they are custom set and
c-default-style shows linux as it should.
The only other thing I have to say is that emacs does not know it has loaded a C++ file all the time and will say
C/l mode instead of
C++/l mode, requiring me to manually switch to that. Regardless, when indentation isn't working as it should, both modes act up. When it isn't, both modes indent as they should. Other modes that I have loaded (that I could see /potentially/ influencing this) include Company(vanilla), Flycheck, and Electric Indent.
My emacs configuration isn't crazy or that complex, so I have no problem giving my github here if that will help.