Configure emacs to insert spaces when pressing the the tab key [duplicate]
Solution 1:
To configure Emacs so that pressing Tab will produce spaces instead of actual tab characters:
M-x set-variable<RET> indent-tabs-mode<RET> nil
Or in your .emacs file:
(setq-default indent-tabs-mode nil)
From this page.