emacs-diffs
[Top][All Lists]
Advanced

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

master d989fc8997: Allow hl-line-mode so work when global-hl-line-mode i


From: Lars Ingebrigtsen
Subject: master d989fc8997: Allow hl-line-mode so work when global-hl-line-mode is active
Date: Tue, 20 Sep 2022 07:56:25 -0400 (EDT)

branch: master
commit d989fc89972a7b2c1bef9000cca275ce85bd69c6
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Allow hl-line-mode so work when global-hl-line-mode is active
    
    * lisp/hl-line.el (hl-line-mode): Allow switching off the global
    mode in the current buffer (bug#51580).
---
 lisp/hl-line.el | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lisp/hl-line.el b/lisp/hl-line.el
index e5ca6819f0..693c94eea8 100644
--- a/lisp/hl-line.el
+++ b/lisp/hl-line.el
@@ -154,6 +154,12 @@ non-selected window.  Hl-Line mode uses the function
 When `hl-line-sticky-flag' is nil, Hl-Line mode highlights the
 line about point in the selected window only."
   :group 'hl-line
+  ;; If the global mode is switched on, then `M-x hl-line-mode' should
+  ;; switch the mode off in this buffer.
+  (when global-hl-line-mode
+    (setq hl-line-mode nil)
+    (setq-local global-hl-line-mode nil)
+    (global-hl-line-unhighlight))
   (if hl-line-mode
       (progn
         ;; In case `kill-all-local-variables' is called.



reply via email to

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