emacs-diffs
[Top][All Lists]
Advanced

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

feature/completions-customs d7d0f5b5a2: Add new variable cursor-face-hig


From: Jimmy Aguilar Mena
Subject: feature/completions-customs d7d0f5b5a2: Add new variable cursor-face-highlight-nonselected-window
Date: Thu, 17 Mar 2022 14:37:53 -0400 (EDT)

branch: feature/completions-customs
commit d7d0f5b5a2d9705e6e3cf667677edc3e3f8ac9fc
Author: Jimmy Aguilar Mena <spacibba@aol.com>
Commit: Jimmy Aguilar Mena <spacibba@aol.com>

    Add new variable cursor-face-highlight-nonselected-window
    
    * lisp/simple.el (cursor-face-highlight-nonselected-window) : New
    custom default to cursor-in-non-selected-windows.
    (redisplay--update-cursor-face-highlight) : Extend highlight condition
    to consider the new variable.
---
 doc/lispref/text.texi | 14 +++++++++-----
 etc/NEWS              |  4 +++-
 lisp/simple.el        | 10 +++++++++-
 3 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi
index b7377d3156..30036675e1 100644
--- a/doc/lispref/text.texi
+++ b/doc/lispref/text.texi
@@ -3553,11 +3553,15 @@ unhighlighted text.
 
 @item cursor-face
 @kindex cursor-face @r{(text property)}
-This property is similar to @code{mouse-face} but the face is used the
-cursor (instead of mouse) is on or near the character.  Near has the
-same meaning than in @code{mouse-face} and the highlight only takes
-effect if the mode @code{cursor-face-highlight-mode} is enabled;
-otherwise no highlight is performed.
+This property is similar to @code{mouse-face} but the face is used if
+the cursor (instead of mouse) is on or near the character.  Near has
+the same meaning than in @code{mouse-face} and the highlight only
+takes effect if the mode @code{cursor-face-highlight-mode} is enabled;
+otherwise no highlight is performed.  When the variable
+@code{cursor-face-highlight-nonselected-window} is non-@code{nil} the
+text is highlighted even if the window is not selected similar to
+@code{highlight-nonselected-windows} for the region.  The default
+value is the same of @code{cursor-in-non-selected-windows}.
 
 @item fontified
 @kindex fontified @r{(text property)}
diff --git a/etc/NEWS b/etc/NEWS
index 9e9ed6cb87..bb92e46310 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1264,7 +1264,9 @@ This allows setting a minimum display width for a region 
of text.
 +++
 ** New 'cursor-face 'text' property.
 This uses cursor-face instead of the default face when cursor is on or
-near the character and 'cursor-face-highlight-mode' is enabled.
+near the character and 'cursor-face-highlight-mode' is enabled.  The
+variable 'highlight-nonselected-windows' is similar to
+'highlight-nonselected-windows' but for this property.
 
 +++
 ** New event type 'touch-end'.
diff --git a/lisp/simple.el b/lisp/simple.el
index a91895907d..42f3a80c3f 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -6540,10 +6540,18 @@ The overlay is returned by the function.")
         (unless (equal new rol)
           (set-window-parameter window 'internal-region-overlay new))))))
 
+(defcustom cursor-face-highlight-nonselected-window 
cursor-in-non-selected-windows
+  "Non-nil means highlight text with `cursor-face' even in nonselected windows.
+This variable is similar to `highlight-nonselected-windows'."
+  :local t
+  :type 'boolean
+  :version "29.1")
+
 (defun redisplay--update-cursor-face-highlight (window)
   "Highlights the overlay used to highlight text with cursor-face."
   (let ((rol (window-parameter window 'internal-cursor-face-overlay)))
-    (if-let (((or (eq window (selected-window))
+    (if-let (((or cursor-face-highlight-nonselected-window
+                  (eq window (selected-window))
                   (and (window-minibuffer-p)
                        (eq window (minibuffer-selected-window)))))
              (pt (window-point window))



reply via email to

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