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 #17 received at 77224 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Elijah Gabe Pérez <eg642616 <at> gmail.com>
Cc: 77224 <at> debbugs.gnu.org, shipmints <at> gmail.com
Subject: Re: bug#77224: [PATCH] New minor mode 'cursor-indicators-mode'
Date: Tue, 25 Mar 2025 09:34:08 +0200
> +*** 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




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.