tab-always-indent tweaks the behavior of the
indent-for-tab-command) command. The default value,
t, gives the behavior described in Indentation. If you
change the value to the symbol
complete, then TAB first
tries to indent the current line, and if the line was already
indented, it tries to complete the text at point (see Symbol Completion). If the value is
nil, then TAB indents the
current line only if point is at the left margin or in the line’s
indentation; otherwise, it inserts a tab character.
Electric Indent mode is a global minor mode that automatically indents the line after every RET you type. This mode is enabled by default. To toggle this minor mode, type M-x electric-indent-mode. To toggle the mode in a single buffer, use M-x electric-indent-local-mode.