C-h f indent-region ... 3) Indent each line via ‘indent-according-to-mode’. ... #### (indent-according-to-mode) Indent line in proper way for current major mode. *Normally*, this is done by calling the function specified by the variable ‘indent-line-function’. #### indent-line-function is a variable defined in ‘indent.el’. ... Setting this function is all you need to make TAB indent appropriately. ...