From: Jimmy Aguilar Mena Date: Thu, 17 Mar 2022 18:16:36 +0000 (+0100) Subject: Add new variable cursor-face-highlight-nonselected-window X-Git-Tag: emacs-29.0.90~1931^2~1002^2~3 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d7d0f5b5a2d9705e6e3cf667677edc3e3f8ac9fc;p=emacs.git 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. --- diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index b7377d3156d..30036675e10 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 9e9ed6cb87f..bb92e463109 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 a91895907d2..42f3a80c3f7 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))