Subject: Re: bug#37848: 27.0.50; hl-line and line-numbers out of sync

From: Eli Zaretskii <[email-masked]>
Date: Mon, 21 Oct 2019 15:58:59 +0300

[Please keep the bug address on the CC list.]

> From: Andrey Orst <[email-masked]>
> Date: Mon, 21 Oct 2019 14:38:10 +0300
> 
> > It's a bug in hl-line that needs to be fixed.
> >
> > The display engine runs pre-redisplay-function for the window in this
> > case, so perhaps hl-line could install its hook there and fix its
> > overlay when it is called.
> >
> > Patches are welcome.
> 
> Unfortunately adding these hooks doesn't fix issue:
> 
> (add-hook 'pre-redisplay-function #'hl-line-highlight nil t)
> (add-hook 'pre-redisplay-function #'hl-line-maybe-unhighlight nil t)
> (add-hook 'pre-redisplay-function #'global-hl-line-highlight)
> (add-hook 'pre-redisplay-function #'global-hl-line-maybe-unhighlight)

This is not as simple as this;  pre-redisplay-function is called with
an argument, a list of windows that are to be redisplayed (in this
case I expect to see only one window in the list).  The function
should move the overlay in that window using that window's point
position.  By contrast, the functions you tried don't accept any
arguments, and hl-line-highlight assumes that it is called in the
selected window.

Thanks.