GNU bug report logs -
#77224
[PATCH] New minor mode 'cursor-indicators-mode'
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Based on Stefan Kangas comments, this minor mode mode changes the cursor
appearance to indicate overwrite mode or read-only buffers.
This is extracted from `cua-enable-cursor-indications'.
-------------------- Start of forwarded message --------------------
From: Stefan Kangas <stefankangas <at> gmail.com>
Subject: Re: Should 'cua-overwrite-cursor-color' be standalone?
To: Elijah Gabe Pérez <eg642616 <at> gmail.com>, emacs-devel <at> gnu.org
Date: Sat, 22 Mar 2025 02:01:11 -0500 (1 day, 15 hours, 49 minutes ago)
Elijah Gabe Pérez <eg642616 <at> gmail.com> writes:
> I've noticed about this variable today, but
> Should not this option be part of =overwrite= instead =cua=?
> Or be a standalone minor-mode?
>
> IMO, I find this useful outside =cua=.
I think a standalone mode is probably best, because if you want the
cursor color changed for overwrite-mode, you might want it for
buffer-read-only too.
In other words, I'd do both of these:
cua-overwrite-cursor-color
cua-read-only-cursor-color
FWIW, I have this in my init file since forever:
(setq my/set-cursor-color-color "")
(setq my/set-cursor-color-buffer "")
(defun my/set-cursor-color-according-to-mode ()
"Change cursor color according to some minor modes."
;; set-cursor-color is somewhat costly, so we only call it when needed:
(let ((color
(if buffer-read-only "#8888FF"
(if overwrite-mode "#000000"
"#FF0000"))))
(unless (and
(string= color my/set-cursor-color-color)
(string= (buffer-name) my/set-cursor-color-buffer))
(set-cursor-color (setq my/set-cursor-color-color color))
(setq my/set-cursor-color-buffer (buffer-name)))))
(add-hook 'post-command-hook 'my/set-cursor-color-according-to-mode)
I picked it up on EmacsWiki years ago.
-------------------- End of forwarded message --------------------
[Message part 2 (text/html, inline)]
[0001-New-minor-mode-cursor-indicators-mode.patch (text/patch, attachment)]
[Message part 4 (text/plain, inline)]
--
- E.G via GNU Emacs and Org.
This bug report was last modified 64 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.