GNU bug report logs -
#77224
[PATCH] New minor mode 'cursor-indicators-mode'
Previous Next
Full log
View this message in rfc822 format
> 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)
Cool. Will it be possible to replace these settings in my init file
with the new package?
#+begin_src emacs-lisp
(defun my-change-cursor (&rest _)
"Change cursor color and type depending on insertion mode and input method."
(set-cursor-color
(cond (repeat-in-progress "blue")
(current-input-method "red3")
(t "black")))
(setq-default cursor-type
(cond (overwrite-mode 'box)
(t 'bar))))
(add-hook 'post-command-hook 'my-change-cursor t)
;; Also update the cursor on the repeat timer events:
(add-function :after repeat-echo-function #'my-change-cursor)
#+end_src
This bug report was last modified 65 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.