0

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

2
  • 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
    Commented Jun 12, 2022 at 7: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
    Commented Jun 12, 2022 at 22:33

1 Answer 1

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.

2
  • 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
    Commented Jun 12, 2022 at 20:50
  • 1
    That is a separate question, unrelated to indent-tabs-mode. You should ask it separately.
    – db48x
    Commented Jun 12, 2022 at 23:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.