Variable: tab-width

tab-width is a customizable and buffer-local variable defined in buffer.c.

Documentation

Distance between tab stops (for display of tab characters), in columns.

This controls the width of a TAB character on display. The value should be a positive integer. Note that this variable doesn't necessarily affect the size of the indentation step. However, if the major mode's indentation facility inserts one or more TAB characters, this variable will affect the indentation step as well, even if indent-tabs-mode(var)/indent-tabs-mode(fun) is non-nil.

View in manual

Probably introduced at or before Emacs version 18.

Source Code

// Defined in /usr/src/emacs/src/buffer.c
  DEFVAR_PER_BUFFER ("tab-width", &BVAR (current_buffer, tab_width),
		     Qintegerp,
		     doc: /* Distance between tab stops (for display of tab characters), in columns.
This controls the width of a TAB character on display.
The value should be a positive integer.
Note that this variable doesn't necessarily affect the size of the
indentation step.  However, if the major mode's indentation facility
inserts one or more TAB characters, this variable will affect the
indentation step as well, even if `indent-tabs-mode' is non-nil.  */);