There are several ways to customize the display of the cursor. I happen to prefer highlighting the current line as a visual cue to keep my eye focused on where I’m working.
Before a few days ago, I had not realized there were so many packages to accomplish this, but let’s review a few.
(require 'highlight-current-line) (highlight-current-line-on t) ;; To customize the background color (set-face-background 'highlight-current-line-face "light yellow")
To my surprise, I learned that GNU Emacs 21 introduced a built-in
hl-line-mode. To enable it globally, add this to your emacs initialization:
(global-hl-line-mode 1) ;; To customize the background color (set-face-background 'hl-line "#330") ;; Emacs 22 Only ;(set-face-background 'highlight "#330") ;; Emacs 21 Only
(Note the difference between customizing the color in Emacs 21 and 22.)
Highline was inspired by
linemenu. It is supposedly the best option for the XEmacs contingent. To enable, put highline.el in your load-path and add the following to your emacs initialization:
(require 'highline) (highline-mode 1) ;; To customize the background color (set-face-background 'highline-face "#222")
Other packages such as hl-line+, col-highlight, and crosshairs have extra features such as idle-timers, line flashing, and column highlighting. I found most of these a little over-the-top, but if your personal preferences differ, give them a try.
I use a black emacs background and prefer a deep-dark gray like
#111 for highlighting to keep things subtle.
When on a white background, I prefer a light yellow such as
lemon chiffon or
light goldenrod yellow. What colors do you like?
Up until this article, I used
highlight-current-line, but I just switched to using the built-in
hl-line. It’s now one less dependency I need to manage, and
hl-line happens to work better in conjuction with visible bookmarks.
1 EmacsWiki, HighlightCurrentLine — libraries that highlight the current line of characters.
2 GNU Emacs Manual, Displaying the Cursor
3 EmacsWiki, HighlightCurrentColumn — libraries that highlight the current column of characters.