This page is about libraries that highlight the current line of characters, so you can find it easily.

== Standard Library `hl-line.el' ==

GnuEmacs version 21 has library `##hl-line.el##', which provides a local and a global minor mode for highlighting the current line.  See [[Manual:highlight current line]].


[:HlSpotlight]
== Extension Library `hl-spotlight.el' ==

Library <tt>[[hl-spotlight.el]]</tt> extends standard library `##hl-line.el##'. It spotlights the current few lines using a different face from that used by `##hl-line.el##'. It is designed to be used together with library <tt>[[centered-cursor-mode.el]]</tt>, so that the lines surrounding the [[cursor]] remain highlighted, and these spotlighted lines remain in the center of the window.

`##hl-spotlight.el##' separates its spotlighting from your normal use of `hl-line' highlighting. It does this in these ways:

* Provides separate minor modes for spotlighting: '''`hl-spotlight-mode'''' and '''`global-hl-spotlight-mode''''.

* Uses a different face for its highlighting: '''`hl-spotlight''''. Typically, you might make this only slightly different from your normal background, whereas you might want the face you use for normal `hl-line' highlighting to stand out more.

* Uses internal variable `hl-line-range-function' locally. Library `##hl-line.el##' uses that variable to specify how many lines to highlight. The width you use for spotlight highlighting affects only the spotlight -- you can still have `##hl-line.el##' highlight only one line.



[:HlLinePlus]
== Extension Library `hl-line+.el' ==

Library <tt>[[hl-line+.el]]</tt> extends standard library `##hl-line.el##' in several ways. It provides these commands:

* `toggle-hl-line-when-idle' -- Highlight the current line whenever Emacs is idle more than a certain number of seconds.

* `flash-line-highlight' -- Highlight the current line for `line-show-period' seconds.

The idea for both of these is to let `hl-line-mode' help you find the current line, but not keep highlighting it after you've found it. 

In addition, library ##hl-line+.el## provides local and global modes (commands `hl-spotlight-mode' and `global-hl-spotlight-mode') to highlight several lines surrounding the [[cursor]] using a different face, `hl-spotlight'.  You can enlarge or shrink this spotlight highlighting using command `hl-spotlight-enlarge'.  You can repeat, via `##C-x z z z z##...', to enlarge or shrink the spotlight incrementally.

Spotlight highlighting can be used together with library
<tt>[[centered-cursor-mode.el]]</tt>, by AndreRiemann, which keeps the cursor (hence also the
spotlight) centered in the window.  This can be helpful when
reading text (as opposed to code).  This is controlled by [[user option]] `hl-spotlight-keep-centered-flag'. 

'''See Also:'''

* HighlightCurrentColumn for similar highlighting, but for the current column, not the current line.
* CrosshairHighlighting for ways to highlight the current line and the current column at the same time.
* ChangingCursorDynamically for a way to change the TextCursor type when Emacs is idle, making it more visible.



=== Discussion ===

[new]
'''Question:''' In ~/.emacs ##(toggle-hl-line-when-idle 1)## now works, but ##(flash-line-highlight 1)## gives "Symbol's function definition is void: global-hl-line-highlight". ##(require 'hl-line)## and ##(global-hl-line-mode 1)## both work: so I suppose I'm loading ##hl-line.el## well. I cannot see its content, because it's an .elc installed by debian emacs21 package (21.4). Thanks a lot... maybe I'll upgrade. Bye!

[new:DrewAdams:2007-10-11 22:01 UTC]
You are apparently using Emacs 21, not Emacs 22. As the ##Compatibility:## field in the header of <tt>[[hl-line+.el]]</tt> states, it works with GnuEmacs 22. It is an extension of ##hl-line.el## of Emacs 22, where `global-hl-line-highlight' is defined. You can try to see if ##hl-line+.el## works at all with Emacs 21, but all bets are off. To try that, you'll need to tweak things a bit, to at least suppress the error message. It is useless to ##(setq global-hl-line-highlight 1)## -- it is a function (in Emacs 22), not a variable. Thx -- DrewAdams

----

[new:sylecn:2009-12-18 18:53 UTC]
'''Question:'''. I'm using (toggle-hl-line-when-idle 1) in my ~/.emacs. and I don't want to highlight line when I'm in Info mode or Help mode etc.
I try to use
    (add-hook 'Info-mode-hook
	      '(lambda ()
		 (toggle-hl-line-when-idle -1)))
but after I trigger this it turn off highlight on other buffers too. Is there a way to turn on/off this mode only for current buffer and how? -- [[Yuanle]]

[new:DrewAdams:2009-05-14 00:18 UTC]
Good question. No, I'm sorry, there is no simple way to do that. <tt>[[hl-line+.el]]</tt> uses only ''global'' hl-line mode. There is a single idle timer for this, and it has no notion of the current mode.

You might try to change the definition of `hl-line-idle-timer' to run not `hl-line-highlight-now', but some new command `hl-line-highlight-local-now', which is like the global version but uses `hl-line-mode' etc. instead of `global-hl-line-mode' etc. You will need an unhighlight version too, etc.

If you do that and like what you end up with, I could add it to the library, if you like. -- DrewAdams

== Library `highlight-current-line.el' ==

There is also Lisp:highlight-current-line.el

== Library `highline.el' ==
At least Gentoo ships a library with this name written and maintained by ViniciusJoseLatorre.

/See/ Lisp:highline.el (HighlineMode).


== Library `pulse.el' ==

See PulseRegion, function `pulse-momentary-highlight-one-line'. 

 
== XEmacs Compatibility ==
* hl-line -- No.
* highlight-current-line.el -- Probably (Tested but no longer usage).
* highline -- Yes (I've been using this -- StefanKamphausen).
* pulse -- Yes.

----
CategoryEditing
CategoryDisplay
CategoryAccessibility
CategoryFaces
HighlightTemporarily

