Subject: [PATCH] Re: bug#45946: 28.0.50; hl-line-sticky-flag not working

From: Gabriel do Nascimento Ribeiro <[email-masked]>
Date: Wed, 20 Jan 2021 22:07:33 -0300

Here is a proposal of patch for this bug. It seems to work well in all
cases I have tested, but maybe I am missing some edge case. Suggestions
are welcome.

>From f4586cd7f535a9613216f61888a5ab8ee05352ca Mon Sep 17 00:00:00 2001
From: Gabriel do Nascimento Ribeiro <[email-masked]>
Date: Wed, 20 Jan 2021 22:02:31 -0300
Subject: [PATCH] Always set overlay current-buffer on
 hl-line-maybe-unhighlight

---
 lisp/hl-line.el | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lisp/hl-line.el b/lisp/hl-line.el
index 73870f9579..b19b9543f5 100644
--- a/lisp/hl-line.el
+++ b/lisp/hl-line.el
@@ -193,8 +193,7 @@ hl-line-maybe-unhighlight
       (with-current-buffer hlob
         (when (overlayp hl-line-overlay)
           (delete-overlay hl-line-overlay))))
-    (when (and (overlayp hl-line-overlay)
-               (eq (overlay-buffer hl-line-overlay) curbuf))
+    (when (overlayp hl-line-overlay)
       (setq hl-line-overlay-buffer curbuf))))
 
 ;;;###autoload
-- 
2.27.0