Variable: global-hl-line-mode
global-hl-line-mode is a customizable variable defined in
hl-line.el.gz.
Value
nil
Documentation
Non-nil if Global Hl-Line mode is enabled.
See the global-hl-line-mode(var)/global-hl-line-mode(fun) command
for a description of this minor mode.
Setting this variable directly does not take effect;
either customize it (see the info node (emacs)Easy Customization)
or call the function global-hl-line-mode(var)/global-hl-line-mode(fun).
Probably introduced at or before Emacs version 21.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/hl-line.el.gz
;;;###autoload
(define-minor-mode global-hl-line-mode
"Toggle line highlighting in all buffers (Global Hl-Line mode).
If `global-hl-line-sticky-flag' is non-nil, Global Hl-Line mode
highlights the line about the current buffer's point in all live
windows.
If `global-hl-line-sticky-flag' is customized to `window',
then instead of highlighting the line with buffer's point,
this mode highlights the line with window's point that might differ from
the buffer's point when the buffer is displayed in multiple windows.
In this case this mode uses the function
`global-hl-line-window-redisplay' on `pre-redisplay-functions'.
Global-Hl-Line mode uses the function `global-hl-line-highlight'
on `post-command-hook'."
:global t
:group 'hl-line
(if global-hl-line-mode
(cond
((eq global-hl-line-sticky-flag 'window)
(add-hook 'pre-redisplay-functions
#'global-hl-line-window-redisplay))
(t
;; In case `kill-all-local-variables' is called.
(add-hook 'change-major-mode-hook #'global-hl-line-unhighlight)
(global-hl-line-highlight-all)
(add-hook 'post-command-hook (if (eq global-hl-line-sticky-flag 'all)
#'global-hl-line-highlight-all
#'global-hl-line-highlight))))
(cond
((eq global-hl-line-sticky-flag 'window)
(remove-hook 'pre-redisplay-functions
#'global-hl-line-window-redisplay)
(walk-windows (lambda (window)
(redisplay--unhighlight-overlay-function
(window-parameter window 'hl-line-overlay))
(set-window-parameter window 'hl-line-overlay nil))
t t))
(t
(global-hl-line-unhighlight-all)
(remove-hook 'post-command-hook #'global-hl-line-highlight)
(remove-hook 'post-command-hook #'global-hl-line-highlight-all)
(remove-hook 'change-major-mode-hook #'global-hl-line-unhighlight)))))