What do I put in my .emacs
file to use four spaces instead of the tab character for all indentation?
views:
100answers:
2
+5
A:
This behavior is controlled by the variable indent-tabs-mode
. Put:
(setq-default indent-tabs-mode nil)
in your .emacs to use spaces.
outis
2010-04-05 11:07:04
Thanks! That gives me eight spaces instead of a tab, but how do I switch to four spaces?
knorv
2010-04-05 14:38:20
Found the answer: (setq-default indent-tabs-mode nil)(setq-default tab-width 4)(setq indent-line-function 'insert-tab)
knorv
2010-04-05 14:42:07
A:
Please note that tabs and indentation in emacs is a more complicated subject than most people anticipate. I strongly recommend reading up on the subject at the Emacs Wiki, because the above information is far from comprehensive.
Phil
2010-04-05 20:55:10