Next: Line Truncation, Previous: How Text Is Displayed, Up: Controlling the Display [Contents][Index]
16.21 Displaying the CursorOn a text terminal, the cursor’s appearance is controlled by the terminal, largely out of the control of Emacs. Some terminals offer two different cursors: a visible static cursor, and a very visible blinking cursor. By default, Emacs uses the very visible cursor, and switches to it when you start or resume Emacs. If the variable visible-cursor
is nil
when Emacs starts or resumes, it uses the normal cursor.
On a graphical display, many more properties of the text cursor can be altered. To customize its color, change the :background
attribute of the face named cursor
(see Customizing Faces). (The other attributes of this face have no effect; the text shown under the cursor is drawn using the frame’s background color.) To change its shape, customize the buffer-local variable cursor-type
; possible values are box
(the default), (box . size)
(box cursor becoming a hollow box under masked images larger than size pixels in either dimension), hollow
(a hollow box), bar
(a vertical bar), (bar . n)
(a vertical bar n pixels wide), hbar
(a horizontal bar), (hbar . n)
(a horizontal bar n pixels tall), or nil
(no cursor at all).
By default, the cursor stops blinking after 10 blinks, if Emacs does not get any input during that time; any input event restarts the count. You can customize the variable blink-cursor-blinks
to control that: its value says how many times to blink without input before stopping. Setting that variable to a zero or negative value will make the cursor blink forever. To disable cursor blinking altogether, change the variable blink-cursor-mode
to nil
(see Easy Customization Interface), or add the line
to your init file. Alternatively, you can change how the cursor looks when it blinks off by customizing the list variable blink-cursor-alist
. Each element in the list should have the form (on-type . off-type)
; this means that if the cursor is displayed as on-type when it blinks on (where on-type is one of the cursor types described above), then it is displayed as off-type when it blinks off.
Some characters, such as tab characters, are extra wide. When the cursor is positioned over such a character, it is normally drawn with the default character width. You can make the cursor stretch to cover wide characters, by changing the variable x-stretch-cursor
to a non-nil
value.
The cursor normally appears in non-selected windows as a non-blinking hollow box. (For a bar cursor, it instead appears as a thinner bar.) To turn off cursors in non-selected windows, change the variable cursor-in-non-selected-windows
to nil
.
To make the cursor even more visible, you can use HL Line mode, a minor mode that highlights the line containing point. Use M-x hl-line-mode to enable or disable it in the current buffer. M-x global-hl-line-mode enables or disables the same mode globally.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4