bug#81358: [PATCH] viper: allow disabling cursor color changes

Eli Zaretskii <[email protected]> Sat, 01 Aug 2026 12:05:19 +0300
Newsgroups gmane.emacs.bugs
Message-ID <[email protected]>
> Date: Tue, 21 Jul 2026 23:17:01 -0400
> Cc: [email protected]
> From: Michael Kifer <[email protected]>
> 
> I think disabling the changes to the cursor color is ok, but such deep 
> level of customization is probably excessive here.

So what do you suggest to do about this issue? just disable the color
unconditionally? add a new variable that is not a defcustom? something
else?

> On 7/18/26 04:31, Eli Zaretskii wrote:
> 
> > Ping!  Michael, please chime in.
> >
> >> Cc: [email protected]
> >> Date: Sun, 05 Jul 2026 07:58:06 +0300
> >> From: Eli Zaretskii <[email protected]>
> >>
> >>> From: Joshua Murphy <[email protected]>
> >>> Date: Sat, 04 Jul 2026 16:59:43 +0000
> >>>
> >>> The minibuffer faces can already be disabled, this allows disabling
> >>> the color changes for the cursor.
> >>> The default is to allow color changes like before.
> >> Thanks.  Michael, any comments on these proposed changes?
> >>
> >>> >From 5c932c00ac60b71cae641d8d6b7a0baf5a25cf9f Mon Sep 17 00:00:00 2001
> >>> From: Joshua Murphy <[email protected]>
> >>> Date: Sat, 4 Jul 2026 12:51:32 -0400
> >>>
> >>> * etc/NEWS: Document new option
> >>> * lisp/emulation/viper-cmd.el (viper-enable-cursor-colors):
> >>> Allow disabling cursor colors when option is set
> >>> * lisp/emulation/viper-util.el (viper-change-cursor-color):
> >>> Add new option to disable cursor colors
> >>> ---
> >>>   etc/NEWS                     | 7 +++++++
> >>>   lisp/emulation/viper-cmd.el  | 6 ++++++
> >>>   lisp/emulation/viper-util.el | 3 ++-
> >>>   3 files changed, 15 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git a/etc/NEWS b/etc/NEWS
> >>> index d39ede2b346..11a72776a3c 100644
> >>> --- a/etc/NEWS
> >>> +++ b/etc/NEWS
> >>> @@ -179,6 +179,13 @@ as well as the default nil and arbitrary user functions.
> >>>   The new command 'newsticker-copy-url', bound to 'w', adds the URL of
> >>>   the currently selected item in the list view to the kill-ring.
> >>>   
> >>> +** Viper
> >>> +
> >>> +---
> >>> +*** New option to disable cursor color changes
> >>> +If 'viper-enable-cursor-colors' is set to nil, viper will no longer
> >>> +change cursor colors when changing state.
> >>> +
> >>>   
> >>>   
> >>>   * New Modes and Packages in Emacs 32.1
> >>> diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el
> >>> index 3cbdcddac0a..0121f8d153f 100644
> >>> --- a/lisp/emulation/viper-cmd.el
> >>> +++ b/lisp/emulation/viper-cmd.el
> >>> @@ -466,6 +466,12 @@
> >>>   
> >>>   ;; Viper mode-changing commands and utilities
> >>>   
> >>> +(defcustom viper-enable-cursor-colors t
> >>> +  "If non-nil, viper uses distinct colors for the cursor."
> >>> +  :type 'boolean
> >>> +  :version "32.1"
> >>> +  :group 'viper-misc)
> >>> +
> >>>   (defcustom viper-enable-minibuffer-faces t
> >>>     "If non-nil, viper uses distinct faces in the minibuffer."
> >>>     :type 'boolean
> >>> diff --git a/lisp/emulation/viper-util.el b/lisp/emulation/viper-util.el
> >>> index 5593ae4506f..c279d6864bf 100644
> >>> --- a/lisp/emulation/viper-util.el
> >>> +++ b/lisp/emulation/viper-util.el
> >>> @@ -89,7 +89,8 @@ Otherwise return the normal value."
> >>>   
> >>>   ;; cursor colors
> >>>   (defun viper-change-cursor-color (new-color &optional frame)
> >>> -  (if (and (viper-window-display-p) (display-color-p)
> >>> +  (if (and viper-enable-cursor-colors
> >>> +           (viper-window-display-p) (display-color-p)
> >>>              (stringp new-color) (color-defined-p new-color)
> >>>   	   (not (string= new-color (viper-get-cursor-color))))
> >>>         (modify-frame-parameters
> >>> -- 
> >>> 2.54.0
> >>>
> >>
> >>
> >>
>