From eacaae81237d8f4e30045c663cae687473e3f327 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Wed, 17 Sep 2025 19:20:18 +0300 Subject: [PATCH] * lisp/hl-line.el: Various fixes (bug#64993). (hl-line-face): Move 'global-hl-line-overlay' updates to the loop over buffers since it's a buffer-local variable. (global-hl-line-maybe-unhighlight): Remove obsolete overlays from 'global-hl-line-overlays'. --- lisp/hl-line.el | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lisp/hl-line.el b/lisp/hl-line.el index ab9dab71823..bebccbf942d 100644 --- a/lisp/hl-line.el +++ b/lisp/hl-line.el @@ -88,9 +88,9 @@ when `global-hl-line-sticky-flag' is non-nil.") (dolist (buffer (buffer-list)) (with-current-buffer buffer (when (overlayp hl-line-overlay) - (overlay-put hl-line-overlay 'face hl-line-face)))) - (when (overlayp global-hl-line-overlay) - (overlay-put global-hl-line-overlay 'face hl-line-face)))) + (overlay-put hl-line-overlay 'face hl-line-face)) + (when (overlayp global-hl-line-overlay) + (overlay-put global-hl-line-overlay 'face hl-line-face)))))) (defcustom hl-line-sticky-flag t "Non-nil means the HL-Line mode highlight appears in all windows. @@ -310,10 +310,12 @@ on `post-command-hook'." "Maybe deactivate the Global-Hl-Line overlay on the current line. Specifically, when `global-hl-line-sticky-flag' is nil deactivate all such overlays in all buffers except the current one." + (setq global-hl-line-overlays + (seq-remove (lambda (ov) (not (overlay-buffer ov))) + global-hl-line-overlays)) (mapc (lambda (ov) (let ((ovb (overlay-buffer ov))) (when (and (not global-hl-line-sticky-flag) - (bufferp ovb) (not (eq ovb (current-buffer))) (not (minibufferp))) (with-current-buffer ovb