14.23 Customization of Display
This section describes variables that control miscellaneous aspects of the appearance of the Emacs screen. Beginning users can skip it.
If you want to have Emacs display line numbers for every line in the buffer, customize the buffer-local variable display-line-numbers
; it is nil
by default. This variable can have several different values to support various modes of line-number display:
t
​
Display (an absolute) line number before each non-continuation screen line that displays buffer text. If the line is a continuation line, or if the entire screen line displays a display or an overlay string, that line will not be numbered.
relative
​
Display relative line numbers before non-continuation lines which show buffer text. The line numbers are relative to the line showing point, so the numbers grow both up and down as lines become farther from the current line.
visual
​
This value causes Emacs to count lines visually: only lines actually shown on the display will be counted (disregarding any lines in invisible parts of text), and lines which wrap to consume more than one screen line will be numbered that many times. The displayed numbers are relative, as with relative
value above. This is handy in modes that fold text, such as Outline mode (see Outline Mode), and when you need to move by exact number of screen lines.
anything else​
Any other non-nil
value is treated as t
.
The command M-x display-line-numbers-mode
provides a convenient way to turn on display of line numbers. This mode has a globalized variant, global-display-line-numbers-mode
. The user option display-line-numbers-type
controls which sub-mode of line-number display, described above, will these modes activate.
Note that line numbers are not displayed in the minibuffer and in the tooltips, even if you turn on display-line-numbers-mode
globally.
When Emacs displays relative line numbers, you can control the number displayed before the current line, the line showing point. By default, Emacs displays the absolute number of the current line there, even though all the other line numbers are relative. If you customize the variable display-line-numbers-current-absolute
to a nil
value, the number displayed for the current line will be zero. This is handy if you don’t care about the number of the current line, and want to leave more horizontal space for text in large buffers.
In a narrowed buffer (see Narrowing) lines are normally numbered starting at the beginning of the narrowing. However, if you customize the variable display-line-numbers-widen
to a non-nil
value, line numbers will disregard any narrowing and will start at the first character of the buffer.
If the value of display-line-numbers-offset
is non-zero, it is added to each absolute line number, and lines are counted from the beginning of the buffer, as if display-line-numbers-widen
were non-nil
. It has no effect when set to zero, or when line numbers are not absolute.
In selective display mode (see Selective Display), and other modes that hide many lines from display (such as Outline and Org modes), you may wish to customize the variables display-line-numbers-width-start
and display-line-numbers-grow-only
, or set display-line-numbers-width
to a large enough value, to avoid occasional miscalculations of space reserved for the line numbers.
The line numbers are displayed in a special face line-number
. The current line number is displayed in a different face, line-number-current-line
, so you can make the current line’s number have a distinct appearance, which will help locating the line showing point. Additional faces line-number-major-tick
and line-number-minor-tick
can be used to highlight the line numbers of lines which are a multiple of certain numbers. Customize display-line-numbers-major-tick
and display-line-numbers-minor-tick
respectively to set those numbers.
If the variable visible-bell
is non-nil
, Emacs attempts to make the whole screen blink when it would normally make an audible bell sound. This variable has no effect if your terminal does not have a way to make the screen blink.
The variable echo-keystrokes
controls the echoing of multi-character keys; its value is the number of seconds of pause required to cause echoing to start, or zero, meaning don’t echo at all. The value takes effect when there is something to echo. See Echo Area.
On graphical displays, Emacs displays the mouse pointer as an hourglass if Emacs is busy. To disable this feature, set the variable display-hourglass
to nil
. The variable hourglass-delay
determines the number of seconds of busy time before the hourglass is shown; the default is 1.
If the mouse pointer lies inside an Emacs frame, Emacs makes it invisible each time you type a character to insert text, to prevent it from obscuring the text. (To be precise, the hiding occurs when you type a self-inserting character. See Inserting Text.) Moving the mouse pointer makes it visible again. To disable this feature, set the variable make-pointer-invisible
to nil
.
On graphical displays, the variable underline-minimum-offset
determines the minimum distance between the baseline and underline, in pixels, for underlined text. By default, the value is 1; increasing it may improve the legibility of underlined text for certain fonts. (However, Emacs will never draw the underline below the current line area.) The variable x-underline-at-descent-line
determines how to draw underlined text. The default is nil
, which means to draw it at the baseline level of the font; if you change it to t
, Emacs draws the underline at the same height as the font’s descent line. (If non-default line spacing was specified for the underlined text, see Line Height in The Emacs Lisp Reference Manual, Emacs draws the underline below the additional spacing.)
The variable overline-margin
specifies the vertical position of an overline above the text, including the height of the overline itself, in pixels; the default is 2.
On some text terminals, bold face and inverse video together result in text that is hard to read. Call the function tty-suppress-bold-inverse-default-colors
with a non-nil
argument to suppress the effect of bold-face in this case.
Raw bytes are displayed in octal format by default, for example a byte with a decimal value of 128 is displayed as \200
. To change display to the hexadecimal format of \x80
, set the variable display-raw-bytes-as-hex
to t
.