14.15 Displaying Boundaries
Emacs can display an indication of the fill-column
position (see Fill Commands). The fill-column indicator is a useful functionality especially in prog-mode
and its descendants (see Major Modes) to indicate the position of a specific column that has some special meaning for formatting the source code of a program.
To activate the fill-column indication display, use the minor modes M-x display-fill-column-indicator-mode
and M-x global-display-fill-column-indicator-mode
, which enable the indicator locally or globally, respectively.
Alternatively, you can set the two buffer-local variables display-fill-column-indicator
and display-fill-column-indicator-character
to activate the indicator and control the character used for the indication. Note that both variables must be non-nil
for the indication to be displayed. (Turning on the minor mode sets both these variables.)
There are 2 buffer local variables and a face to customize this mode:
display-fill-column-indicator-column
​
Specifies the column number where the indicator should be set. It can take positive numerical values for the column, or the special value t
, which means that the value of the variable fill-column
will be used.
Any other value disables the indicator. The default value is t
.
display-fill-column-indicator-character
​
Specifies the character used for the indicator. This character can be any valid character including Unicode ones if the font supports them. The value nil
disables the indicator. When the mode is enabled through the functions display-fill-column-indicator-mode
or global-display-fill-column-indicator-mode
, they will use the character specified by this variable, if it is non-nil
; otherwise Emacs will use the character ‘U+2502 VERTICAL LINE
’, falling back to ‘|
’ if U+2502
cannot be displayed.
fill-column-indicator
​
Specifies the face used to display the indicator. It inherits its default values from the face shadow
, but without background color. To change the indicator color, you need only set the foreground color of this face.
On graphical displays, Emacs can indicate the buffer boundaries in the fringes. If you enable this feature, the first line and the last line are marked with angle images in the fringes. This can be combined with up and down arrow images which say whether it is possible to scroll the window.
The buffer-local variable indicate-buffer-boundaries
controls how the buffer boundaries and window scrolling is indicated in the fringes. If the value is left
or right
, both angle and arrow bitmaps are displayed in the left or right fringe, respectively.
If value is an alist (see Association Lists in the Emacs Lisp Reference Manual), each element (indicator . position)
specifies the position of one of the indicators. The indicator
must be one of top
, bottom
, up
, down
, or t
which specifies the default position for the indicators not present in the alist. The position
is one of left
, right
, or nil
which specifies not to show this indicator.
For example, ((top . left) (t . right))
places the top angle bitmap in left fringe, the bottom angle bitmap in right fringe, and both arrow bitmaps in right fringe. To show just the angle bitmaps in the left fringe, but no arrow bitmaps, use ((top . left) (bottom . left))
.