GNU bug report logs - #77224
[PATCH] New minor mode 'cursor-indicators-mode'

Previous Next

Package: emacs;

Reported by: Elijah Gabe Pérez <eg642616 <at> gmail.com>

Date: Sun, 23 Mar 2025 22:59:03 UTC

Severity: normal

Tags: patch

Full log


Message #20 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Rudolf Schlatte <rudi <at> constantly.at>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#77224: [PATCH] New minor mode 'cursor-indicators-mode'
Date: Tue, 25 Mar 2025 08:52:56 +0100
Juri Linkov <juri <at> linkov.net> writes:

>> +*** New minor mode 'cursor-indicators-mode'
>> +This mode changes cursor appearance (color and/or type) to indicate
>> +different buffer states.  This mode have cursor indicators for:
>> +- Overwrite mode
>> +- Read-only buffers
>> +- Repeat mode
>> +- Input method activation
>
> What if users want to add more conditions?
> Could you try to create only one defcustom that
> contains a list of default conditions
> plus a possible user-defined conditions.
> For example:
>
> #+begin_src emacs-lisp
> (defcustom cursor-indicators nil
>   :type `(alist :key-type
>                   (choice :tag "Condition"
>                     (const :tag "Overwrite mode" overwrite)
>                     (const :tag "Read-only mode" read-only)
>                     (const :tag "Repeat mode" repeat-in-progress)
>                     (const :tag "Activated input method" input-method)
>                     (function :tag "Matcher function")) ;; User-defined condition
>                 :value-type
>                   (choice
>                     (const :tag "None (do not change cursor)" nil)
>                     (color :tag "Color")
>                     (choice :tag "Type"
>                             (const :tag "Filled box" box)
>                             (const :tag "Vertical bar" bar)
>                             (const :tag "Horizontal bar" hbar)
>                             (const :tag "Hollow box" hollow))
>                     (cons :tag "Color and Type"
>                           (choice :tag "Type"
>                                   (const :tag "Filled box" box)
>                                   (const :tag "Vertical bar" bar)
>                                   (const :tag "Horizontal bar" hbar)
>                                   (const :tag "Hollow box" hollow))
>                           (color :tag "Color")))))
> #+end_src
>
>
> Then I could replace:
>
> #+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))))
> #+end_src
>
>
> with just
>
> #+begin_src emacs-lisp
> (setopt cursor-indicators '((repeat-in-progress   "blue")
>                             (current-input-method "red3")
>                             (overwrite-mode       'box)
>                             (default              'bar)))
> #+end_src

I set the following hooks, which makes the cursor unobtrusive while I'm
selecting text (C-SPC then moving cursor).  Could this also fit in the
above framework?

(deactivate-mark-hook . (lambda () (setq cursor-type t)))
(activate-mark-hook . (lambda () (setq cursor-type 'bar)))





This bug report was last modified 117 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.