Variable: display-line-numbers
display-line-numbers is a customizable and buffer-local variable
defined in xdisp.c.
Documentation
Non-nil means display line numbers.
If the value is t, display the absolute number of each line of a buffer
shown in a window. Absolute line numbers count from the beginning of
the current narrowing, or from buffer beginning. The variable
display-line-numbers-offset, if non-zero, is a signed offset added
to each absolute line number; it also forces line numbers to be counted
from the beginning of the buffer, as if display-line-numbers-widen
were non-nil. It has no effect when line numbers are not absolute.
If the value is relative, display for each line not containing the
window's point its relative number instead, i.e. the number of the line
relative to the line showing the window's point.
In either case, line numbers are displayed at the beginning of each
non-continuation line that displays buffer text, i.e. after each newline
character that comes from the buffer. The value visual is like
relative but counts screen lines instead of buffer lines. In practice
this means that continuation lines count as well when calculating the
relative number of a line.
Lisp programs can disable display of a line number of a particular
buffer line by putting the display-line-numbers-disable text property
or overlay property on the first visible character of that line.
This variable was added, or its default value changed, in Emacs 26.1.
Probably introduced at or before Emacs version 26.1.
Source Code
// Defined in /usr/src/emacs/src/xdisp.c
DEFVAR_LISP ("display-line-numbers", Vdisplay_line_numbers,
doc: /* Non-nil means display line numbers.
If the value is t, display the absolute number of each line of a buffer
shown in a window. Absolute line numbers count from the beginning of
the current narrowing, or from buffer beginning. The variable
`display-line-numbers-offset', if non-zero, is a signed offset added
to each absolute line number; it also forces line numbers to be counted
from the beginning of the buffer, as if `display-line-numbers-widen'
were non-nil. It has no effect when line numbers are not absolute.
If the value is `relative', display for each line not containing the
window's point its relative number instead, i.e. the number of the line
relative to the line showing the window's point.
In either case, line numbers are displayed at the beginning of each
non-continuation line that displays buffer text, i.e. after each newline
character that comes from the buffer. The value `visual' is like
`relative' but counts screen lines instead of buffer lines. In practice
this means that continuation lines count as well when calculating the
relative number of a line.
Lisp programs can disable display of a line number of a particular
buffer line by putting the `display-line-numbers-disable' text property
or overlay property on the first visible character of that line. */);