indent-line-function

indent-line-function is a variable defined in `indent.el'.
Its value is
indent-relative

  • This variable may be risky if used as a file-local variable.

Documentation:
Function to indent the current line.
This function will be called with no arguments.
If it is called somewhere where auto-indentation cannot be done
(e.g. inside a string), the function should simply return `noindent'.
Setting this function is all you need to make TAB indent appropriately.
Don't rebind TAB unless you really need to.