After over two weeks emacs 24.3 for Mountain Lion 10.8.3 setup, I am still unable to fix the indentation setup.
The issues: - in scratch mode & R mode the indentation is not working. I am now using spaces - in C++ mode, I have to toggle off the syntactic indentation in order to indent for a width of 2 columns. I want to do at least 3 columns but failed with the .emacs file
;; Set default tab to 4 spaces
(setq default-tab-width 4)
Emacswiki said the TAB indentation is only temporarily activated for auto-complete prompt so I set this up in .emacs file as well
(ac-set-trigger-key "TAB")
Because I cannot use TAB to indent, I just disable the settings above and still unsuccessful.
There is very lengthy materials in CC mode about indentation. However, I am happy with C++ mode and auto-complete. And I am hesitant to waste a few more days on CC mode just for sake of indentation.
Is there global settings for indentation in .emacs file? If no such settings, what should be the correct settings for indentation for C++ and ESS model (R) in .emacs file?
tab-width
has nothing to do with indentation, it only controls the display-width of a TAB character. You want to change things likefoo-indent-offset
orfoo-basic-indent
. - Stefan