Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Instruction how to set tab size in Emacs and Eclipse

...

Source files should contain no tabs. Since there are some existing tabs remaining, make sure to set your editor to interpret tabs to show as 8 spaces, otherwise you will not indent your new code correctly. Some tools like Microsoft Developer Studio and Eclipse have default setting other than 8, please change those.

In Emacs, put the following lines into your ~/.emacs file:

Code Block
languagecpp
;; insert spaces instead of tabs into your C/C++ files
(setq-default indent-tabs-mode nil)
;; set the tab width to 8, to match generic editors (8 is the default setting)
(setq tab-width 8)

In Eclipse, go to Window->Preferences->Java->Code Style->Formatter->Edit and set "Tab policy" to "Tabs only" and Tab size: 8. You may need to create a new profile, as the built-in one cannot be edited.

Anchor
modify-code-cplusplus-guidelines
modify-code-cplusplus-guidelines

...