0

What is the difference between indent-tabs-mode and tab-always-indent?

Dilna
  • 1
  • 3
  • 11
  • Please limit yourself to one question per question, if that makes sense. The first sentence is a good question, but none of the rest has anything to do with it. – db48x Jun 12 '22 at 07:01
  • The question is unclear. What's the relation between the question hinted in the title and the question posed in the question body? What research have you done - have you looked at the descriptions of indent-tabs-mode and tab-always-indent? If so, can you be specific about what it is that you don't understand about the difference? – Drew Jun 12 '22 at 22:33

1 Answers1

1

You can read the help for any variable by typing C-h v which runs the command describe-function.

tab-always-indent adjusts the behavior of the TAB key. As the documentation says:

Controls the operation of the TAB key.

If t, hitting TAB always just indents the current line. If nil, hitting TAB indents the current line if point is at the left margin or in the line's indentation, otherwise it inserts a "real" TAB character. If complete, TAB first tries to indent the current line, and if the line was already indented, then try to complete the thing at point.

Meanwhile indent-tabs-mode controls what character(s) to insert into the file when indenting a line:

Indentation can insert tabs if this is non-nil.

This is the most basic way you can choose between spaces or tabs for indentation.

db48x
  • 17,977
  • 1
  • 22
  • 28
  • To change indent-tabs-mode, there is the possibilities to use setq-local, setq-default or setq. I think setq-default only changes the behaviour for major modes where the variable has not been set. – Dilna Jun 12 '22 at 20:50
  • 1
    That is a separate question, unrelated to indent-tabs-mode. You should ask it separately. – db48x Jun 12 '22 at 23:45