Normally, indentation commands insert (or remove) an optimal mix of
space characters and tab characters to align to the desired column.
Tab characters are displayed as a stretch of empty space extending to
the next display tab stop. By default, there is one display tab
tab-width columns (the default is 8). See Text Display.
If you prefer, all indentation can be made from spaces only. To
request this, set the buffer-local variable
nil. See Locals, for information about setting buffer-local
variables. Note, however, that C-q TAB always inserts a
tab character, regardless of the value of
One reason to set
nil is that not
all editors display tab characters in the same way. Emacs users, too,
may have different customized values of
tab-width. By using
spaces only, you can make sure that your file always looks the same.
If you only care about how it looks within Emacs, another way to
tackle this problem is to set the
tab-width variable in a
file-local variable (see File Variables).
There are also commands to convert tabs to spaces or vice versa, always preserving the columns of all non-whitespace text. M-x tabify scans the region for sequences of spaces, and converts sequences of at least two spaces to tabs if that can be done without changing indentation. M-x untabify changes all tabs in the region to appropriate numbers of spaces.