emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 5811741eda 3/3: Fix hl-line tests


From: Po Lu
Subject: master 5811741eda 3/3: Fix hl-line tests
Date: Wed, 23 Mar 2022 08:26:57 -0400 (EDT)

branch: master
commit 5811741eda764f4711031c90d2e7a3727f27d8a9
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Fix hl-line tests
    
    * lisp/hl-line.el (hl-line-mode): Restore old setter.
    * test/lisp/hl-line-tests.el (hl-line-tests-verify): Don't rely
    `cl-some' always returning t on success.
    (hl-line-tests-sticky-across-frames): Use correct global variable.
---
 lisp/hl-line.el            | 10 +++++++++-
 test/lisp/hl-line-tests.el |  9 ++++++---
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/lisp/hl-line.el b/lisp/hl-line.el
index 20b3f4160f..e42d1d97d9 100644
--- a/lisp/hl-line.el
+++ b/lisp/hl-line.el
@@ -102,7 +102,15 @@ This variable has no effect in Global Highlight Line mode.
 For that, use `global-hl-line-sticky-flag'."
   :type 'boolean
   :version "22.1"
-  :group 'hl-line)
+  :group 'hl-line
+  :set (lambda (symbol value)
+         (set-default symbol value)
+         (unless value
+           (let ((selected (window-buffer (selected-window))))
+             (dolist (buffer (buffer-list))
+               (unless (eq buffer selected)
+                 (with-current-buffer buffer
+                   (hl-line-unhighlight))))))))
 
 (defcustom global-hl-line-sticky-flag nil
   "Non-nil means the Global HL-Line mode highlight appears in all windows.
diff --git a/test/lisp/hl-line-tests.el b/test/lisp/hl-line-tests.el
index 6bff09135b..888351adda 100644
--- a/test/lisp/hl-line-tests.el
+++ b/test/lisp/hl-line-tests.el
@@ -22,12 +22,15 @@
 (require 'hl-line)
 
 (defsubst hl-line-tests-verify (_label on-p)
-  (eq on-p (cl-some (apply-partially #'eq hl-line--overlay)
-                    (overlays-at (point)))))
+  (if on-p
+      (cl-some (apply-partially #'eq hl-line-overlay)
+               (overlays-at (point)))
+    (not (cl-some (apply-partially #'eq hl-line-overlay)
+                  (overlays-at (point))))))
 
 (ert-deftest hl-line-tests-sticky-across-frames ()
   (skip-unless (display-graphic-p))
-  (customize-set-variable 'hl-line-sticky-flag t)
+  (customize-set-variable 'global-hl-line-sticky-flag t)
   (call-interactively #'global-hl-line-mode)
   (let ((first-frame (selected-frame))
         (first-buffer "foo")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]