hl-line-range-function

hl-line-range-function is a variable defined in `hl-line.el'.
Its value is
nil

  • This variable may be risky if used as a file-local variable.

Documentation:
If non-nil, function to call to return highlight range.
The function of no args should return a cons cell; its car value
is the beginning position of highlight and its cdr value is the
end position of highlight in the buffer.
It should return nil if there's no region to be highlighted.

This variable is expected to be made buffer-local by modes.