From unknown Tue Jun 17 03:39:40 2025
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.509 (Entity 5.509)
Content-Type: text/plain; charset=utf-8
From: bug#77224 <77224@debbugs.gnu.org>
To: bug#77224 <77224@debbugs.gnu.org>
Subject: Status: [PATCH] New minor mode 'cursor-indicators-mode'
Reply-To: bug#77224 <77224@debbugs.gnu.org>
Date: Tue, 17 Jun 2025 10:39:40 +0000
retitle 77224 [PATCH] New minor mode 'cursor-indicators-mode'
reassign 77224 emacs
submitter 77224 Elijah Gabe P=C3=A9rez
severity 77224 normal
tag 77224 patch
thanks
From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 23 18:58:53 2025
Received: (at submit) by debbugs.gnu.org; 23 Mar 2025 22:58:53 +0000
Received: from localhost ([127.0.0.1]:53037 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from )
id 1twUHM-0002Qs-SD
for submit@debbugs.gnu.org; Sun, 23 Mar 2025 18:58:53 -0400
Received: from lists.gnu.org ([2001:470:142::17]:49108)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from )
id 1twUHK-0002Qb-2m
for submit@debbugs.gnu.org; Sun, 23 Mar 2025 18:58:50 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1) (envelope-from )
id 1twUHE-00009P-PX
for bug-gnu-emacs@gnu.org; Sun, 23 Mar 2025 18:58:44 -0400
Received: from mail-ot1-x342.google.com ([2607:f8b0:4864:20::342])
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.90_1) (envelope-from )
id 1twUHC-00080v-AC
for bug-gnu-emacs@gnu.org; Sun, 23 Mar 2025 18:58:44 -0400
Received: by mail-ot1-x342.google.com with SMTP id
46e09a7af769-72b0626c785so2674333a34.2
for ; Sun, 23 Mar 2025 15:58:41 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1742770720; x=1743375520; darn=gnu.org;
h=mime-version:user-agent:message-id:date:subject:to:from:from:to:cc
:subject:date:message-id:reply-to;
bh=UErBeR5jcvm5P7UwjJ0ebo9FJsW77QEpPP0SNuBTK8Q=;
b=kEqAs6a8LIv66yvSY4ipxvtkd71SAtD35ckf3q8TllnF8roBfu4xaO8OHpFT/OViaO
ELi/ivgpf7mVOWf43mHOuaWRR/p/t5Unz/gJQUaps/XvOtxjK9Ng9e9ELSIS/qVOQQN/
tx6K6JHZRMwcoNNnYTL0FlKwBEoKFcou0ZJs2QpcA9h7xticoTatAuqWGvmcN/EBAcqx
OOAN0pZ+qYPjuEWaKiUJCXsUmjn7eUbMOXYd1XzW+g8iP7LiAWWd4qnRYa940l+NKJyf
czL0fBw8ne7pwnIFRbfsfLStZhgV9lg7GPyMl5ktcvns0jPXS3gOWaBuQ9pfDQ8/tDvi
lQ4Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1742770720; x=1743375520;
h=mime-version:user-agent:message-id:date:subject:to:from
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=UErBeR5jcvm5P7UwjJ0ebo9FJsW77QEpPP0SNuBTK8Q=;
b=VGY/+mTNPK79w3T3qO5kywnku5ZxEOe+9hFyMegkN6Q+eEny74m2rGnpSOpatjnS51
K1RvHyVrtZHDkJjWQU1DLuStmKBJcFJfTN0QtPAT6XfhxKIbfst6nefLbcTAioA8IP8v
UoKHUUEcjG2GYs0JKK0CSOxyXSmVddsn8SN4PH1/N5SpWSRDq/qCdlMs64YBAjh+35Fc
cip9g43U84K+b2Bx9mBJnTN29swGcXeGkQ8U9MJ9E/4YVmroHAi1JZnUXG/t0TVwfY73
VhmYWZPiED9kqpGtwA9o8uiNu/d+bAbW/f48Pg/ihM3WkX3e0xL2v9DPwIR3oxvIWHML
T3LQ==
X-Gm-Message-State: AOJu0YwKjxyJz9zutsuWUnJwNnELJfkYLtzf/LfqOaVWtb8YBEc4+ty/
a1xoKP0xP7g3ERjobM7MbMJ/a7SZ+xXDkXRjLmBZk7CwOx7GOfl+svkTw6Ri
X-Gm-Gg: ASbGncsF+4FJT80gbb985rSAwbfe5tdlm83oWvDiQAeIj03R42fEbHw0V+oxdeFfW2f
QswB5iZEy6JVzlq+20QBOGpZecJHfXBkRm+mI7RjbUDWES62uaAe0dHc7A0IRx0ejIkOPHVDToQ
MuYJXx8RrDW037z7bgqEOlEA21aIPwGbXB56K0SuOhAOohgM+LjwFyWHcOOOWt/RiThVeNZ4ccQ
81BxZkQVMVRegJ+Gk47IM5OX3TOS6G/BPYTb0cJNNFXPVTiXxoPXpnuLJYzcl/AZwo3j6LdowMp
h0aO7S2Xh+4D
X-Google-Smtp-Source: AGHT+IE4cNNKYNJo773ippanNwOlTYE+lJ0bqmWMMdwzZnC/jXp9lmafPYVqQU6V5sT3MpyPgD2/cg==
X-Received: by 2002:a05:6830:640a:b0:72b:8aec:fbd5 with SMTP id
46e09a7af769-72c0ae4f1b4mr6823202a34.1.1742770719993;
Sun, 23 Mar 2025 15:58:39 -0700 (PDT)
Received: from fedora ([2806:10ae:e:5fce::1]) by smtp.gmail.com with ESMTPSA id
46e09a7af769-72c0ac887e6sm1348120a34.67.2025.03.23.15.58.39
for
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Sun, 23 Mar 2025 15:58:39 -0700 (PDT)
From: =?utf-8?Q?Elijah_Gabe_P=C3=A9rez?=
To: bug-gnu-emacs@gnu.org
Subject: [PATCH] New minor mode 'cursor-indicators-mode'
Date: Sun, 23 Mar 2025 16:58:37 -0600
Message-ID: <87iknzxski.fsf@gmail.com>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=2607:f8b0:4864:20::342;
envelope-from=eg642616@gmail.com; helo=mail-ot1-x342.google.com
X-Spam_score_int: -17
X-Spam_score: -1.8
X-Spam_bar: -
X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001,
RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.2 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
has NOT identified this incoming email as spam. The original
message has been attached to this so you can view it or label
similar future email. If you have any questions, see
the administrator of that system for details.
Content preview: 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 Subject: Re: Should 'cua-overwrite-cursor-color' be standalone?
To: Elijah Gabe Pérez , Sat, 22 Mar 2025 [...]
Content analysis details: (1.2 points, 10.0 required)
pts rule name description
---- ---------------------- --------------------------------------------------
-0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/,
no trust
[2001:470:142:0:0:0:0:17 listed in]
[list.dnswl.org]
0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail
provider (eg642616[at]gmail.com)
0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends
in digit (eg642616[at]gmail.com)
-0.0 SPF_HELO_PASS SPF: HELO matches SPF record
1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail)
0.0 HTML_MESSAGE BODY: HTML included in message
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit"
X-Spam-Score: 0.2 (/)
--=-=-=
Content-Type: multipart/alternative; boundary="==-=-="
--==-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
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
Subject: Re: Should 'cua-overwrite-cursor-color' be standalone?
To: Elijah Gabe P=C3=A9rez , emacs-devel@gnu.org
Date: Sat, 22 Mar 2025 02:01:11 -0500 (1 day, 15 hours, 49 minutes ago)
Elijah Gabe P=C3=A9rez writes:
> I've noticed about this variable today, but
> Should not this option be part of =3Doverwrite=3D instead =3Dcua=3D?
> Or be a standalone minor-mode?
>
> IMO, I find this useful outside =3Dcua=3D.
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 neede=
d:
(let ((color
(if buffer-read-only "#8888FF"
(if overwrite-mode "#000000"
"#FF0000"))))
(unless (and
(string=3D color my/set-cursor-color-color)
(string=3D (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 --------------------
--==-=-=
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable
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 ---------------&=
#x2013;—
From: Stefan Kangas <stefankangas@gmail.com>
Subject: Re: Should 'cua-overwrite-cursor-color' be standalone?
To: Elijah Gabe P=C3=A9rez <eg642616@gmail.com>, emacs-devel@gnu.org=
Date: Sat, 22 Mar 2025 02:01:11 -0500 (1 day, 15 hours, 49 minutes ago)
Elijah Gabe P=C3=A9rez <eg642616@gmail.com> writes:
I've noticed about this variable today, but
Should not this option be part of overwrite
instead cua<=
/code>?
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=3D color my/set-cursor-color-color)
(string=3D (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 ---------------=
2013;—
--==-=-=--
--=-=-=
Content-Type: text/patch; charset=utf-8
Content-Disposition: attachment;
filename=0001-New-minor-mode-cursor-indicators-mode.patch
Content-Transfer-Encoding: quoted-printable
>From 15b9074636a31676b83ac7e2086959e23b93cd11 Mon Sep 17 00:00:00 2001
From: =3D?UTF-8?q?El=3DC3=3DADas=3D20Gabriel=3D20P=3DC3=3DA9rez?=3D
Date: Sat, 22 Mar 2025 22:56:01 -0600
Subject: [PATCH] New minor mode 'cursor-indicators-mode'
This minor mode changes the cursor appearance to indicate
overwrite mode or read-only buffers. (bug#)
Acts similar to 'cua-enable-cursor-indications'
* etc/NEWS: Document changes.
* lisp/cursor-indicators.el
(cursor-indicators-overwrite-indicator)
(cursor-indicators-read-only-indicator): New user options.
(cursor-indicators--default-cursor-color): New use internal variable.
(cursor-indicators--update-indications): New use internal function.
(cursor-indicators-mode): New minor mode definition.
---
etc/NEWS | 5 ++
lisp/cursor-indicators.el | 125 ++++++++++++++++++++++++++++++++++++++
2 files changed, 130 insertions(+)
create mode 100644 lisp/cursor-indicators.el
diff --git a/etc/NEWS b/etc/NEWS
index cc63d03eafe..22c84d253ba 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1566,6 +1566,11 @@ This user option replaces 'follow-mode-prefix', whic=
h had to be set
before loading Follow mode. This new option allows you to change the
prefix even after it was loaded, using 'customize-option' or 'setopt'.
=20
+---
+*** New minor mode 'cursor-indicators-mode'
+This minor mode changes cursor type and/or face to indicate
+overwrite mode or read-only buffers.
+
---
*** cdl.el is now obsolete.
Use 'shell-command' and 'shell-command-on-region' instead.
diff --git a/lisp/cursor-indicators.el b/lisp/cursor-indicators.el
new file mode 100644
index 00000000000..d97237c6942
--- /dev/null
+++ b/lisp/cursor-indicators.el
@@ -0,0 +1,125 @@
+;;; cursor-indicators.el --- Cursor indicators for some states -*- lexica=
l-binding: t; -*-
+
+;; Copyright (C) 2025 Free Software Foundation, Inc.
+
+;; Author: El=C3=ADas Gabriel P=C3=A9rez
+;; Keywords:
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see .
+
+;;; Commentary:
+;; This package changes cursor appearance (color and/or type) to indicate
+;; overwrite mode and read-only buffers.
+;;
+;; For example:
+;;
+;; The following setting will use a YELLOW cursor in overwrite mode in rea=
d-write
+;; buffers, and a GREEN cursor in read-only buffers:
+;;
+;; (setq cursor-indicators-overwrite-indicator "yellow")
+;; (setq cursor-indicators-read-only-indicator "green")
+
+
+;;; Code:
+(defcustom cursor-indicators-overwrite-indicator "yellow"
+ "Cursor indicator used when overwrite mode is set, if non-nil.
+Only used when `cursor-indicators-mode' is enabled.
+
+If the value is a COLOR name, then only the `cursor-color' attribute will =
be
+affected. If the value is a cursor TYPE (one of: box, hollow, bar, or hba=
r),
+then only the `cursor-type' property will be affected. If the value is
+a cons (TYPE . COLOR), then both properties are affected.
+If the value is nil then do not change cursor."
+ :group 'cursor
+ :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"))))
+
+(defcustom cursor-indicators-read-only-indicator "darkgreen"
+ "Cursor indicator used in read-only buffers, if non-nil.
+Only used when `cursor-indicators-mode' is enabled.
+
+If the value is a COLOR name, then only the `cursor-color' attribute will =
be
+affected. If the value is a cursor TYPE (one of: box, hollow, bar, or hba=
r),
+then only the `cursor-type' property will be affected. If the value is
+a cons (TYPE . COLOR), then both properties are affected.
+If the value is nil then do not change cursor."
+ :group 'cursor
+ :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"))))
+
+(defvar cursor-indicators--default-cursor-color (frame-parameter nil 'curs=
or-color))
+
+(defun cursor-indicators--update-indications ()
+ (let* ((cursor
+ (or
+ ;; XXX: global mark?
+ ;; (and cua--global-mark-active cursor-indicators-global-mark-color)
+ (and buffer-read-only cursor-indicators-read-only-indicator)
+ (and overwrite-mode cursor-indicators-overwrite-indicator)
+ (cons (default-value 'cursor-type)
+ cursor-indicators--default-cursor-color)))
+ (color (if (consp cursor) (cdr cursor) cursor))
+ (type (if (consp cursor) (car cursor) cursor)))
+ (if (and color
+ (stringp color)
+ (not (equal color (frame-parameter nil 'cursor-color))))
+ (set-cursor-color color))
+ (if (and type
+ (symbolp type)
+ (not (eq type (default-value 'cursor-type))))
+ (setq-local cursor-type type))))
+
+;;;###autoload
+(define-minor-mode cursor-indicators-mode
+ "Change cursor type and/or face for indications.
+When enabled, this mode changes the cursor appearance to indicate
+overwrite mode or read-only buffers."
+ :group 'cursor
+ :global t
+ (if cursor-indicators-mode
+ (progn
+ (add-hook 'post-command-hook #'cursor-indicators--update-indications)
+ (cursor-indicators--update-indications))
+ (remove-hook 'post-command-hook #'cursor-indicators--update-indication=
s)
+ (set-cursor-color cursor-indicators--default-cursor-color)
+ (setq-local cursor-type (default-value 'cursor-type))))
+
+(provide 'cursor-indicators)
+;;; cursor-indicators.el ends here
--=20
2.49.0
--=-=-=
Content-Type: text/plain
--
- E.G via GNU Emacs and Org.
--=-=-=--
From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 24 03:37:33 2025
Received: (at 77224) by debbugs.gnu.org; 24 Mar 2025 07:37:33 +0000
Received: from localhost ([127.0.0.1]:54018 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from )
id 1twcNI-0005wn-UV
for submit@debbugs.gnu.org; Mon, 24 Mar 2025 03:37:33 -0400
Received: from relay1-d.mail.gandi.net ([217.70.183.193]:56381)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from ) id 1twcNG-0005wR-RU
for 77224@debbugs.gnu.org; Mon, 24 Mar 2025 03:37:31 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id BAA7444383;
Mon, 24 Mar 2025 07:37:22 +0000 (UTC)
From: Juri Linkov
To: Elijah Gabe =?iso-8859-1?Q?P=E9rez?=
Subject: Re: bug#77224: [PATCH] New minor mode 'cursor-indicators-mode'
In-Reply-To: <87iknzxski.fsf@gmail.com>
Organization: LINKOV.NET
References: <87iknzxski.fsf@gmail.com>
Date: Mon, 24 Mar 2025 09:35:38 +0200
Message-ID: <87o6xq6fud.fsf@mail.linkov.net>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-GND-State: clean
X-GND-Score: -100
X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduheeludelucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufgjohhffffkfgggtgesthdtredttdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucggtffrrghtthgvrhhnpeffgeetfeevlefhleejfeeuheeiudeitdffhfdutdekfeffgffhveehteegueekheenucfkphepledurdduvdelrddutdehrdduudejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepledurdduvdelrddutdehrdduudejpdhhvghlohepmhgrihhlrdhgrghnughirdhnvghtpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhgspghrtghpthhtohepvddprhgtphhtthhopeejjedvvdegseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtohepvghgieegvdeiudeisehgmhgrihhlrdgtohhm
X-GND-Sasl: juri@linkov.net
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 77224
Cc: 77224@debbugs.gnu.org
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit"
X-Spam-Score: -1.7 (-)
> 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
From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 24 14:11:06 2025
Received: (at 77224) by debbugs.gnu.org; 24 Mar 2025 18:11:07 +0000
Received: from localhost ([127.0.0.1]:58080 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from )
id 1twmGL-0003Wi-Df
for submit@debbugs.gnu.org; Mon, 24 Mar 2025 14:11:06 -0400
Received: from mail-oi1-x242.google.com ([2607:f8b0:4864:20::242]:43313)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from )
id 1twmGH-0003Vl-MS
for 77224@debbugs.gnu.org; Mon, 24 Mar 2025 14:10:59 -0400
Received: by mail-oi1-x242.google.com with SMTP id
5614622812f47-3fa58dc37c5so2828309b6e.1
for <77224@debbugs.gnu.org>; Mon, 24 Mar 2025 11:10:57 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1742839851; x=1743444651; darn=debbugs.gnu.org;
h=mime-version:user-agent:message-id:date:references:in-reply-to
:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
bh=I7jF0nrZ+4EEJPwqiJGgpZKHItTkDEnNxNokgXuWopQ=;
b=WYed4Nh/qbl7tZepBdfe1adk+q7dnqqMdgxl6ozeAr+I9Uo1fpTPBCGMJs+OBxHAgz
xO+KVmdnohEZfMPeJvqF2BHAPWMA6seA4hKRse0Fots2vFRYH36gneej5MM4NT/0Xivg
JyosomWhiVlWU2iXLkpy3CdrwdbzKXaYfVw5+8QF5N3qVJ1BM/o5Hg0BLRopPEL0aveB
X3nC1DMIkjHYjx6k7pd1SBQDl3PUGtzAQYx5eSjRlAus09t24dVdS66N0J2POXW+OivB
NXHdQR2JsKlNPaMOhgwIaz83IztKdIAx3yD8zsWgL8Zw/S5tQ5tVP72IMoycs0Lkwf18
xdag==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1742839851; x=1743444651;
h=mime-version:user-agent:message-id:date:references:in-reply-to
:subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to;
bh=I7jF0nrZ+4EEJPwqiJGgpZKHItTkDEnNxNokgXuWopQ=;
b=ls3dSt1G7abywDGG1PyJ6RslJ+J5DIeSHNg3ZhMXJSTADu+zpEDnTNxEfAspr+F807
Xs3FEhMbeGc7vhRONU0idEWy7lqDvO2FnMmkluH+D84UwpHtNwzFWabv+yXtoTixxvDr
sXZj0uBwGklKNgArZ6eagpnDjX/DhFXFnOHz6TZJ7BWW2lhJ0Lmn10mYpiwlW7wDz43w
ij7H4fd87nIlITZclZnYLry1B4cHXC8VdRXJ2YyLuRIzWHxZF7v9e/qvetWevQI3AVL9
dnGNehDgCsQ/2+CIZWnn52TvLk4pjNVQ/sTxJ7SH48GvmwdtdWSx/Gv72VjurmS1ycY5
/FOA==
X-Gm-Message-State: AOJu0YwYlmWy2yks9BD0NyejEyO78smc+6HwJsRAsV+v24+G3EOfe+Ht
px1ssvV+VcP8362HYRM5F8RIq8CqVZ5yQf9W7Cl8P0I3VUiJdfeYNYhCulzK
X-Gm-Gg: ASbGncurbHwbn4GUBYnn3dz2sE+E6eAqf+o4QdwKnjRyt2PAPrQ1/vMZ7bQmr/1Sz5A
nAmk6HxVOyAoIJMvGaZm60b9FWLR82Ho+Xsrrm0T7OLRO895w5u4Jzt/w4K6WfIPIsQoqemlv7f
KHHwyauQRDpMPyG0KOtrje4lEsv4CIFSUFatnW+PUJsc0GiVd83nyjOm2/KY+9cXNp46Th3NTif
Mu6Pj6lvtfWfNEwpRQ6WbHymq1Q1WcspUs/nZNJGyLsXhW1Ro5h8xAQ2l/uVcNy4Kwd0JhTZyWE
orPLUgcrsZnx
X-Google-Smtp-Source: AGHT+IEF8qLi5HVk132mALWTGcT5OuNDcpn4Cvx3boc2mrMrN/uOg7j/yEpG1IteXf3zPV0hgFXz8A==
X-Received: by 2002:a05:6808:6b48:b0:3f4:bc5:d47a with SMTP id
5614622812f47-3febee94fbemr9219867b6e.13.1742839850959;
Mon, 24 Mar 2025 11:10:50 -0700 (PDT)
Received: from fedora ([2806:10ae:e:5fce::1]) by smtp.gmail.com with ESMTPSA id
5614622812f47-3febf79e27dsm1687659b6e.50.2025.03.24.11.10.49
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Mon, 24 Mar 2025 11:10:50 -0700 (PDT)
From: =?utf-8?Q?Elijah_Gabe_P=C3=A9rez?=
To: Juri Linkov
Subject: Re: bug#77224: [PATCH] New minor mode 'cursor-indicators-mode'
In-Reply-To: <87o6xq6fud.fsf@mail.linkov.net>
References: <87iknzxski.fsf@gmail.com> <87o6xq6fud.fsf@mail.linkov.net>
Date: Mon, 24 Mar 2025 12:10:48 -0600
Message-ID: <875xjymh93.fsf@gmail.com>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 77224
Cc: 77224@debbugs.gnu.org
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit"
X-Spam-Score: -0.7 (/)
--=-=-=
Content-Type: multipart/alternative; boundary="==-=-="
--==-=-=
Content-Type: text/plain
Juri Linkov writes:
>> 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
Sure, I've updated the patch for handle this.
--==-=-=
Content-Type: text/html
Juri Linkov <juri@linkov.net> writes:
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?
#+beginsrc 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)
#+endsrc
Sure, I've updated the patch for handle this.
--==-=-=--
--=-=-=
Content-Type: text/x-patch; charset=utf-8
Content-Disposition: attachment;
filename=0001-New-minor-mode-cursor-indicators-mode.patch
Content-Transfer-Encoding: quoted-printable
>From 82a59dce91c15a742ed6031b6961e316c8da627b Mon Sep 17 00:00:00 2001
From: =3D?UTF-8?q?El=3DC3=3DADas=3D20Gabriel=3D20P=3DC3=3DA9rez?=3D
Date: Sat, 22 Mar 2025 22:56:01 -0600
Subject: [PATCH] New minor mode 'cursor-indicators-mode'
This minor mode changes the cursor appearance to indicate
buffers states, such as if overwrite-mode is active or current
buffer is read-only. (Bug#77224)
Acts similar to 'cua-enable-cursor-indications'
* etc/NEWS: Document changes.
* lisp/cursor-indicators.el
(cursor-indicators-overwrite-indicator)
(cursor-indicators-repeat-indicator)
(cursor-indicators-input-method-indicator)
(cursor-indicators-read-only-indicator): New user options.
(cursor-indicators--default-cursor-color): New use internal variable.
(cursor-indicators--update-indications): New use internal function.
(cursor-indicators-mode): New minor mode definition.
---
etc/NEWS | 9 ++
lisp/cursor-indicators.el | 185 ++++++++++++++++++++++++++++++++++++++
2 files changed, 194 insertions(+)
create mode 100644 lisp/cursor-indicators.el
diff --git a/etc/NEWS b/etc/NEWS
index cc63d03eafe..a9fee82a29e 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1566,6 +1566,15 @@ This user option replaces 'follow-mode-prefix', whic=
h had to be set
before loading Follow mode. This new option allows you to change the
prefix even after it was loaded, using 'customize-option' or 'setopt'.
=20
+---
+*** 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
+
---
*** cdl.el is now obsolete.
Use 'shell-command' and 'shell-command-on-region' instead.
diff --git a/lisp/cursor-indicators.el b/lisp/cursor-indicators.el
new file mode 100644
index 00000000000..6b9ae9677d7
--- /dev/null
+++ b/lisp/cursor-indicators.el
@@ -0,0 +1,185 @@
+;;; cursor-indicators.el --- Cursor indicators for some states -*- lexica=
l-binding: t; -*-
+
+;; Copyright (C) 2025 Free Software Foundation, Inc.
+
+;; Author: El=C3=ADas Gabriel P=C3=A9rez
+;; Keywords:
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see .
+
+;;; Commentary:
+;; This package changes cursor appearance (color and/or type) to indicate
+;; different buffer states.
+;;
+;; For example:
+;;
+;; The following setting will use a YELLOW cursor in overwrite mode in rea=
d-write
+;; buffers, and a GREEN cursor in read-only buffers:
+;;
+;; (setq cursor-indicators-overwrite-indicator "yellow")
+;; (setq cursor-indicators-read-only-indicator "green")
+
+
+;;; Code:
+
+;;; User options
+(defcustom cursor-indicators-overwrite-indicator "red3"
+ "Cursor indicator used when overwrite mode is set, if non-nil.
+Only used when `cursor-indicators-mode' is enabled.
+
+If the value is a COLOR name, then only the `cursor-color' attribute will =
be
+affected. If the value is a cursor TYPE (one of: box, hollow, bar, or hba=
r),
+then only the `cursor-type' property will be affected. If the value is
+a cons (TYPE . COLOR), then both properties are affected.
+If the value is nil then do not change cursor."
+ :group 'cursor
+ :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"))))
+
+(defcustom cursor-indicators-read-only-indicator "darkgreen"
+ "Cursor indicator used in read-only buffers, if non-nil.
+Only used when `cursor-indicators-mode' is enabled.
+
+If the value is a COLOR name, then only the `cursor-color' attribute will =
be
+affected. If the value is a cursor TYPE (one of: box, hollow, bar, or hba=
r),
+then only the `cursor-type' property will be affected. If the value is
+a cons (TYPE . COLOR), then both properties are affected.
+If the value is nil then do not change cursor."
+ :group 'cursor
+ :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"))))
+
+(defcustom cursor-indicators-repeat-indicator "blue"
+ "Cursor indicator used when `repeat-in-progress' is non-nil.
+Only used when `cursor-indicators-mode' is enabled.
+
+If the value is a COLOR name, then only the `cursor-color' attribute will =
be
+affected. If the value is a cursor TYPE (one of: box, hollow, bar, or hba=
r),
+then only the `cursor-type' property will be affected. If the value is
+a cons (TYPE . COLOR), then both properties are affected.
+If the value is nil then do not change cursor."
+ :group 'cursor
+ :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"))))
+
+(defcustom cursor-indicators-input-method-indicator "dark magenta"
+ "Cursor indicator used when input method is activated now.
+Only used when `cursor-indicators-mode' is enabled.
+
+If the value is a COLOR name, then only the `cursor-color' attribute will =
be
+affected. If the value is a cursor TYPE (one of: box, hollow, bar, or hba=
r),
+then only the `cursor-type' property will be affected. If the value is
+a cons (TYPE . COLOR), then both properties are affected.
+If the value is nil then do not change cursor."
+ :group 'cursor
+ :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"))))
+
+;;; Internal Code
+
+(defvar cursor-indicators--default-cursor-color (frame-parameter nil 'curs=
or-color))
+
+(defun cursor-indicators--update-indications (&optional cursor-color)
+ (let* ((cursor
+ (or
+ ;; CURSOR-COLOR is intended to be used by the user in an advice=
-add
+ cursor-color
+ ;; XXX: global mark?
+ ;; (and cua--global-mark-active cursor-indicators-global-mark-c=
olor)
+ (and buffer-read-only cursor-indicators-read-only-indicator)
+ (and overwrite-mode cursor-indicators-overwrite-indicator)
+ (and (bound-and-true-p repeat-in-progress) cursor-indicators-re=
peat-indicator)
+ (and (bound-and-true-p current-input-method) cursor-indicators-=
input-method-indicator)
+ (cons (default-value 'cursor-type)
+ cursor-indicators--default-cursor-color)))
+ (color (if (consp cursor) (cdr cursor) cursor))
+ (type (if (consp cursor) (car cursor) cursor)))
+ (if (and color
+ (stringp color)
+ (not (equal color (frame-parameter nil 'cursor-color))))
+ (set-cursor-color color))
+ (if (and type
+ (symbolp type)
+ (not (eq type (default-value 'cursor-type))))
+ (setq-local cursor-type type))))
+
+;;;###autoload
+(define-minor-mode cursor-indicators-mode
+ "Change cursor type and/or face for indications.
+When enabled, this mode changes the cursor appearance to indicate
+overwrite mode or read-only buffers."
+ :group 'cursor
+ :global t
+ (if cursor-indicators-mode
+ (progn
+ (add-hook 'post-command-hook #'cursor-indicators--update-indications)
+ (cursor-indicators--update-indications))
+ (remove-hook 'post-command-hook #'cursor-indicators--update-indication=
s)
+ (set-cursor-color cursor-indicators--default-cursor-color)
+ (setq-local cursor-type (default-value 'cursor-type))))
+
+(provide 'cursor-indicators)
+;;; cursor-indicators.el ends here
--=20
2.49.0
--=-=-=
Content-Type: text/plain
--
- E.G via GNU Emacs and Org.
--=-=-=--
From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 24 14:49:31 2025
Received: (at 77224) by debbugs.gnu.org; 24 Mar 2025 18:49:31 +0000
Received: from localhost ([127.0.0.1]:58398 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from )
id 1twmra-0000BY-KV
for submit@debbugs.gnu.org; Mon, 24 Mar 2025 14:49:31 -0400
Received: from mail-oi1-x243.google.com ([2607:f8b0:4864:20::243]:53687)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from )
id 1twmrX-0000Af-Ks
for 77224@debbugs.gnu.org; Mon, 24 Mar 2025 14:49:28 -0400
Received: by mail-oi1-x243.google.com with SMTP id
5614622812f47-3f6a92f234dso2670789b6e.3
for <77224@debbugs.gnu.org>; Mon, 24 Mar 2025 11:49:27 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1742842161; x=1743446961; darn=debbugs.gnu.org;
h=mime-version:user-agent:message-id:date:references:in-reply-to
:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
bh=EI3/qq0DZK8fLacC2IwkKo9MQzm0N+GZH+dvuEnwkGs=;
b=cXNbR0+OfTjsO9ZljolVD1TxS5x9ePm+rhvZW/JocyiSgvDUKR1JOsi1eBAfLWMhDE
fH87YSNPg+dH5kUI9klFfc4fB5PQKVS+0g6FefSmdg+yVgp54FDan2TfwkvvWwQGlvm9
zEuYmySdso8ZG2t8u0LEgGgaOvB8I8Qa5xXobOUPG08DyzJ0dmwJ499TLUJtNIIw0l2C
DQOxZij/DNVQ7qwa7Km+C3Q+IwbNcOl9yecX+U+Ozq+1exT2UP2HWKb3faZ8krk1W9N0
NGg8ZoLhEdqsNZ3D9vktVSikx/Np40zrCQ4NU/fs9r5PrSKnemD2XmLIduLdpajaK+Us
mttQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1742842161; x=1743446961;
h=mime-version:user-agent:message-id:date:references:in-reply-to
:subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to;
bh=EI3/qq0DZK8fLacC2IwkKo9MQzm0N+GZH+dvuEnwkGs=;
b=XqmsEahTUuRa/XWud3c7CdZj3fhbJeMmtnR9Cpd34VxeQfDDeegjwjJHYPs1F99NgE
aBQ6e44dySBWf4M9Y7cI24q9ur5GeR9gPA2ayhrgXUEqsB34ucCaGqw1eSmZnrjPG/VG
+nfvjLE1o7RQETCLKSVqXYyeudi+Oi8Hu6zHvQ7atEm2TppcNFu38fB6bunuF69wZPUw
9b66ak3f65lXSB/C0iTupoBk1Sb/uUVUy6LDe7KVvv093La0qXu6a3TIzo/XSQM4/tKt
Kl+to2rBw6oLwJHEd4PRSJX9XDwsN5uHF3DuBZlCZH3iOumHYVHmd77McbEB72dli2vD
LqfA==
X-Gm-Message-State: AOJu0Yyuotz8nc221slnlf0TddGz7VepZo/7l8e9RuLeI2oXG6mCL7FA
d3V5kNd+YGD0ClCRTi1mApnbi7dDryZJe2o1RkIMGDT5XvrizAF/
X-Gm-Gg: ASbGncuJ0cUw1CxqGXJ8OU39T7hBaYRbjVG78ejHSAV8gYofq0Wb6ZSeePGVm9tvbn5
P6EfSQwpH3du85ZOHFsgFyX4F4Fqwrq9ivt3U1zcvoCVZzZjZoZyCBiAlaq/3CeF4R2nB7VrRKw
lh3Uh+CFh7n0pMDl/5eMBtn8vSVJ/D1UM5BznrY2m0QQe9IpLNOa3EFA84/Kgn5OG1F1yAH+m7z
dKiAR3YciRoYMkhfrQfa5OTeoTsgmSVn2zDHy5fNoQ2ui0MUtlR2kuJY5pJIHcEDFz/KDJwxVWu
puNsgkCwIb26
X-Google-Smtp-Source: AGHT+IHQDT2aOIuDvvBQjx8I+piE5HmA6YrNqNkqGo+iFSJYPzWB9VYnZN/f8Cq64J4MMrGoLD+rqA==
X-Received: by 2002:a05:6808:199c:b0:3f9:17f9:30bd with SMTP id
5614622812f47-3febf702481mr8726512b6e.7.1742842161121;
Mon, 24 Mar 2025 11:49:21 -0700 (PDT)
Received: from fedora ([2806:10ae:e:5fce::1]) by smtp.gmail.com with ESMTPSA id
5614622812f47-3febf79dda8sm1668667b6e.44.2025.03.24.11.49.20
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Mon, 24 Mar 2025 11:49:20 -0700 (PDT)
From: =?utf-8?Q?Elijah_Gabe_P=C3=A9rez?=
To: eg642616@gmail.com
Subject: Re: bug#77224: [PATCH] New minor mode 'cursor-indicators-mode'
In-Reply-To: <875xjymh93.fsf@gmail.com>
References: <87iknzxski.fsf@gmail.com> <87o6xq6fud.fsf@mail.linkov.net>
<875xjymh93.fsf@gmail.com>
Date: Mon, 24 Mar 2025 12:49:19 -0600
Message-ID: <87ikny2rio.fsf@gmail.com>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 77224
Cc: 77224@debbugs.gnu.org, shipmints@gmail.com, Juri Linkov
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit"
X-Spam-Score: -0.7 (/)
--=-=-=
Content-Type: multipart/alternative; boundary="==-=-="
--==-=-=
Content-Type: text/plain
Ship Mints writes:
> I think you need to update your configuration to not use tabs in lisp code--your patch is filled with tabs.
> Standard elisp is this (see emacs/.dir-locals.el for other settings):
> (emacs-lisp-mode . ((indent-tabs-mode . nil) ...
Yeah, i forgot to untabify the whole file.
Sending fixed one.
--==-=-=
Content-Type: text/html
Ship Mints <shipmints@gmail.com> writes:
I think you need to update your configuration to not use tabs in lisp code–your patch is filled with tabs.
Standard elisp is this (see emacs/.dir-locals.el for other settings):
(emacs-lisp-mode . ((indent-tabs-mode . nil) …
Yeah, i forgot to untabify the whole file.
Sending fixed one.
--==-=-=--
--=-=-=
Content-Type: text/x-patch; charset=utf-8
Content-Disposition: attachment;
filename=0001-New-minor-mode-cursor-indicators-mode.patch
Content-Transfer-Encoding: quoted-printable
>From b2e9e8e1b60c3d0f051c3c7d0bbe6af39edf2408 Mon Sep 17 00:00:00 2001
From: =3D?UTF-8?q?El=3DC3=3DADas=3D20Gabriel=3D20P=3DC3=3DA9rez?=3D
Date: Sat, 22 Mar 2025 22:56:01 -0600
Subject: [PATCH] New minor mode 'cursor-indicators-mode'
This minor mode changes the cursor appearance to indicate
buffers states, such as if overwrite-mode is active or current
buffer is read-only. (Bug#77224)
Acts similar to 'cua-enable-cursor-indications'
* etc/NEWS: Document changes.
* lisp/cursor-indicators.el
(cursor-indicators-overwrite-indicator)
(cursor-indicators-repeat-indicator)
(cursor-indicators-input-method-indicator)
(cursor-indicators-read-only-indicator): New user options.
(cursor-indicators--default-cursor-color): New use internal variable.
(cursor-indicators--update-indications): New use internal function.
(cursor-indicators-mode): New minor mode definition.
---
etc/NEWS | 9 ++
lisp/cursor-indicators.el | 185 ++++++++++++++++++++++++++++++++++++++
2 files changed, 194 insertions(+)
create mode 100644 lisp/cursor-indicators.el
diff --git a/etc/NEWS b/etc/NEWS
index cc63d03eafe..a9fee82a29e 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1566,6 +1566,15 @@ This user option replaces 'follow-mode-prefix', whic=
h had to be set
before loading Follow mode. This new option allows you to change the
prefix even after it was loaded, using 'customize-option' or 'setopt'.
=20
+---
+*** 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
+
---
*** cdl.el is now obsolete.
Use 'shell-command' and 'shell-command-on-region' instead.
diff --git a/lisp/cursor-indicators.el b/lisp/cursor-indicators.el
new file mode 100644
index 00000000000..cf778c5bfce
--- /dev/null
+++ b/lisp/cursor-indicators.el
@@ -0,0 +1,185 @@
+;;; cursor-indicators.el --- Cursor indicators for some states -*- lexica=
l-binding: t; -*-
+
+;; Copyright (C) 2025 Free Software Foundation, Inc.
+
+;; Author: El=C3=ADas Gabriel P=C3=A9rez
+;; Keywords:
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see .
+
+;;; Commentary:
+;; This package changes cursor appearance (color and/or type) to indicate
+;; different buffer states.
+;;
+;; For example:
+;;
+;; The following setting will use a YELLOW cursor in overwrite mode in rea=
d-write
+;; buffers, and a GREEN cursor in read-only buffers:
+;;
+;; (setq cursor-indicators-overwrite-indicator "yellow")
+;; (setq cursor-indicators-read-only-indicator "green")
+
+
+;;; Code:
+
+;;; User options
+(defcustom cursor-indicators-overwrite-indicator "red3"
+ "Cursor indicator used when overwrite mode is set, if non-nil.
+Only used when `cursor-indicators-mode' is enabled.
+
+If the value is a COLOR name, then only the `cursor-color' attribute will =
be
+affected. If the value is a cursor TYPE (one of: box, hollow, bar, or hba=
r),
+then only the `cursor-type' property will be affected. If the value is
+a cons (TYPE . COLOR), then both properties are affected.
+If the value is nil then do not change cursor."
+ :group 'cursor
+ :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"))))
+
+(defcustom cursor-indicators-read-only-indicator "darkgreen"
+ "Cursor indicator used in read-only buffers, if non-nil.
+Only used when `cursor-indicators-mode' is enabled.
+
+If the value is a COLOR name, then only the `cursor-color' attribute will =
be
+affected. If the value is a cursor TYPE (one of: box, hollow, bar, or hba=
r),
+then only the `cursor-type' property will be affected. If the value is
+a cons (TYPE . COLOR), then both properties are affected.
+If the value is nil then do not change cursor."
+ :group 'cursor
+ :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"))))
+
+(defcustom cursor-indicators-repeat-indicator "blue"
+ "Cursor indicator used when `repeat-in-progress' is non-nil.
+Only used when `cursor-indicators-mode' is enabled.
+
+If the value is a COLOR name, then only the `cursor-color' attribute will =
be
+affected. If the value is a cursor TYPE (one of: box, hollow, bar, or hba=
r),
+then only the `cursor-type' property will be affected. If the value is
+a cons (TYPE . COLOR), then both properties are affected.
+If the value is nil then do not change cursor."
+ :group 'cursor
+ :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"))))
+
+(defcustom cursor-indicators-input-method-indicator "dark magenta"
+ "Cursor indicator used when input method is activated now.
+Only used when `cursor-indicators-mode' is enabled.
+
+If the value is a COLOR name, then only the `cursor-color' attribute will =
be
+affected. If the value is a cursor TYPE (one of: box, hollow, bar, or hba=
r),
+then only the `cursor-type' property will be affected. If the value is
+a cons (TYPE . COLOR), then both properties are affected.
+If the value is nil then do not change cursor."
+ :group 'cursor
+ :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"))))
+
+;;; Internal Code
+
+(defvar cursor-indicators--default-cursor-color (frame-parameter nil 'curs=
or-color))
+
+(defun cursor-indicators--update-indications (&optional cursor-color)
+ (let* ((cursor
+ (or
+ ;; CURSOR-COLOR is intended to be used by the user in an advice=
-add
+ cursor-color
+ ;; XXX: global mark?
+ ;; (and cua--global-mark-active cursor-indicators-global-mark-c=
olor)
+ (and buffer-read-only cursor-indicators-read-only-indicator)
+ (and overwrite-mode cursor-indicators-overwrite-indicator)
+ (and (bound-and-true-p repeat-in-progress) cursor-indicators-re=
peat-indicator)
+ (and (bound-and-true-p current-input-method) cursor-indicators-=
input-method-indicator)
+ (cons (default-value 'cursor-type)
+ cursor-indicators--default-cursor-color)))
+ (color (if (consp cursor) (cdr cursor) cursor))
+ (type (if (consp cursor) (car cursor) cursor)))
+ (if (and color
+ (stringp color)
+ (not (equal color (frame-parameter nil 'cursor-color))))
+ (set-cursor-color color))
+ (if (and type
+ (symbolp type)
+ (not (eq type (default-value 'cursor-type))))
+ (setq-local cursor-type type))))
+
+;;;###autoload
+(define-minor-mode cursor-indicators-mode
+ "Change cursor type and/or face for indications.
+When enabled, this mode changes the cursor appearance to indicate
+overwrite mode or read-only buffers."
+ :group 'cursor
+ :global t
+ (if cursor-indicators-mode
+ (progn
+ (add-hook 'post-command-hook #'cursor-indicators--update-indicatio=
ns)
+ (cursor-indicators--update-indications))
+ (remove-hook 'post-command-hook #'cursor-indicators--update-indication=
s)
+ (set-cursor-color cursor-indicators--default-cursor-color)
+ (setq-local cursor-type (default-value 'cursor-type))))
+
+(provide 'cursor-indicators)
+;;; cursor-indicators.el ends here
--=20
2.49.0
--=-=-=
Content-Type: text/plain
--
- E.G via GNU Emacs and Org.
--=-=-=--
From debbugs-submit-bounces@debbugs.gnu.org Tue Mar 25 03:34:41 2025
Received: (at 77224) by debbugs.gnu.org; 25 Mar 2025 07:34:41 +0000
Received: from localhost ([127.0.0.1]:35920 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from )
id 1twyo5-00023h-7f
for submit@debbugs.gnu.org; Tue, 25 Mar 2025 03:34:41 -0400
Received: from relay3-d.mail.gandi.net ([2001:4b98:dc4:8::223]:46273)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from ) id 1twyo2-00023P-QX
for 77224@debbugs.gnu.org; Tue, 25 Mar 2025 03:34:39 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id 4CF7D20487;
Tue, 25 Mar 2025 07:34:28 +0000 (UTC)
From: Juri Linkov
To: Elijah Gabe =?iso-8859-1?Q?P=E9rez?=
Subject: Re: bug#77224: [PATCH] New minor mode 'cursor-indicators-mode'
In-Reply-To: <87ikny2rio.fsf@gmail.com>
Organization: LINKOV.NET
References: <87iknzxski.fsf@gmail.com> <87o6xq6fud.fsf@mail.linkov.net>
<875xjymh93.fsf@gmail.com> <87ikny2rio.fsf@gmail.com>
Date: Tue, 25 Mar 2025 09:34:08 +0200
Message-ID: <871pula7sn.fsf@mail.linkov.net>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-GND-State: clean
X-GND-Score: -100
X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduiedvtdeiucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufgjohhffffkfgggtgesthdtredttdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucggtffrrghtthgvrhhnpeffgeetfeevlefhleejfeeuheeiudeitdffhfdutdekfeffgffhveehteegueekheenucfkphepledurdduvdelrddutdehrdduudejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepledurdduvdelrddutdehrdduudejpdhhvghlohepmhgrihhlrdhgrghnughirdhnvghtpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhgspghrtghpthhtohepfedprhgtphhtthhopehshhhiphhmihhnthhssehgmhgrihhlrdgtohhmpdhrtghpthhtohepjeejvddvgeesuggvsggsuhhgshdrghhnuhdrohhrghdprhgtphhtthhopegvgheigedvieduieesghhmrghilhdrtghomh
X-GND-Sasl: juri@linkov.net
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 77224
Cc: 77224@debbugs.gnu.org, shipmints@gmail.com
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit"
X-Spam-Score: -1.7 (-)
> +*** 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
From debbugs-submit-bounces@debbugs.gnu.org Tue Mar 25 03:53:21 2025
Received: (at submit) by debbugs.gnu.org; 25 Mar 2025 07:53:21 +0000
Received: from localhost ([127.0.0.1]:35982 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from )
id 1twz68-0002x4-VP
for submit@debbugs.gnu.org; Tue, 25 Mar 2025 03:53:21 -0400
Received: from lists.gnu.org ([2001:470:142::17]:50316)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from )
id 1twz66-0002wn-RJ
for submit@debbugs.gnu.org; Tue, 25 Mar 2025 03:53:19 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1) (envelope-from )
id 1twz60-0006Q6-8F
for bug-gnu-emacs@gnu.org; Tue, 25 Mar 2025 03:53:12 -0400
Received: from ciao.gmane.io ([116.202.254.214])
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1) (envelope-from )
id 1twz5y-0001Pv-3Y
for bug-gnu-emacs@gnu.org; Tue, 25 Mar 2025 03:53:11 -0400
Received: from list by ciao.gmane.io with local (Exim 4.92)
(envelope-from )
id 1twz5u-00074e-B7
for bug-gnu-emacs@gnu.org; Tue, 25 Mar 2025 08:53:06 +0100
X-Injected-Via-Gmane: http://gmane.org/
To: bug-gnu-emacs@gnu.org
From: Rudolf Schlatte
Subject: Re: bug#77224: [PATCH] New minor mode 'cursor-indicators-mode'
Date: Tue, 25 Mar 2025 08:52:56 +0100
Message-ID:
References: <87iknzxski.fsf@gmail.com> <87o6xq6fud.fsf@mail.linkov.net>
<875xjymh93.fsf@gmail.com> <87ikny2rio.fsf@gmail.com>
<871pula7sn.fsf@mail.linkov.net>
Mime-Version: 1.0
Content-Type: text/plain
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:sPdbSBJhMZMbp/5fSFpyt5B+a/U=
Received-SPF: pass client-ip=116.202.254.214;
envelope-from=geb-bug-gnu-emacs@m.gmane-mx.org; helo=ciao.gmane.io
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9,
HEADER_FROM_DIFFERENT_DOMAINS=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001,
RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit"
X-Spam-Score: -1.0 (-)
Juri Linkov 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)))
From debbugs-submit-bounces@debbugs.gnu.org Tue Mar 25 08:12:14 2025
Received: (at 77224) by debbugs.gnu.org; 25 Mar 2025 12:12:14 +0000
Received: from localhost ([127.0.0.1]:36660 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from )
id 1tx38g-0007lU-70
for submit@debbugs.gnu.org; Tue, 25 Mar 2025 08:12:14 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:34910)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from ) id 1tx38b-0007l5-N2
for 77224@debbugs.gnu.org; Tue, 25 Mar 2025 08:12:11 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1) (envelope-from )
id 1tx38T-0001BN-UJ; Tue, 25 Mar 2025 08:12:02 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
Date; bh=AZnr6eYsc7tQmD8NezzdEoVmNCaUqc3+AuwDVwWA1IA=; b=FD8HjQO6W9keVYee5NYX
w2sB9IOkfItv31QfJqPI3YLDwKGA0pgKknb68LbKg9wK32ZpDC+1QXJ9lnlvbQzO3eYDx/Lp/Yecc
SRZQbuNsRyWPrlOd49P6QQswBQlEofoW3pYRqbQF/TrjQKYk1qWHoF0EFs/dlh1kaly90H8Bq1zxH
EOZlzq2M57MEKcoBkAyWGs5kS/zdL8kBxiAlekbmggB9PXvPPFDoVIsxyrK8NNbwXxD2b9L9QnZ6r
dHyw55H7eUL+9YtHCW6a1oljGaBl3VUUHx0cg32/L511qDg13QXsYU1PzIviW2ZZqBcsHaaFD7k9A
f4eLfDOnv2zIiQ==;
Date: Tue, 25 Mar 2025 14:11:58 +0200
Message-Id: <86o6xpe2cx.fsf@gnu.org>
From: Eli Zaretskii
To: Elijah Gabe =?utf-8?Q?P=C3=A9rez?=
In-Reply-To: <87ikny2rio.fsf@gmail.com> (message from Elijah Gabe
=?utf-8?Q?P=C3=A9rez?= on Mon, 24 Mar 2025 12:49:19 -0600)
Subject: Re: bug#77224: [PATCH] New minor mode 'cursor-indicators-mode'
References: <87iknzxski.fsf@gmail.com> <87o6xq6fud.fsf@mail.linkov.net>
<875xjymh93.fsf@gmail.com> <87ikny2rio.fsf@gmail.com>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 77224
Cc: 77224@debbugs.gnu.org, shipmints@gmail.com, juri@linkov.net
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit"
X-Spam-Score: -3.3 (---)
> Cc: 77224@debbugs.gnu.org, shipmints@gmail.com, Juri Linkov
> From: Elijah Gabe Pérez
> Date: Mon, 24 Mar 2025 12:49:19 -0600
>
> Ship Mints writes:
>
> I think you need to update your configuration to not use tabs in lisp code–your patch is filled with tabs.
> Standard elisp is this (see emacs/.dir-locals.el for other settings):
> (emacs-lisp-mode . ((indent-tabs-mode . nil) …
>
> Yeah, i forgot to untabify the whole file.
Thanks.
> +(defcustom cursor-indicators-overwrite-indicator "red3"
Using literal color names might be problematic on terminals that don't
support enough colors, unless you are extra careful to select colors
that are supported everywhere. Alternatively, the default value could
be different for different numbers of supported colors.
Also, what happens if an Emacs session has both GUI frames (with lots
of colors) and TTY frames with a small number of colors -- does each
frame get its own color?
> + "Cursor indicator used when overwrite mode is set, if non-nil.
That "if non-nil" part can potentially confuse, because it isn't clear
whether it refers to the value of the variable or to "overwrite mode".
Better say this the other way around:
If non-nil, the cursor indication to use when overwrite mode is set.
(Note that I also slightly reworded the rest of this sentence, for
clarity.)
Suggest to make the same changes for other user options in this file.
> +(defcustom cursor-indicators-repeat-indicator "blue"
> + "Cursor indicator used when `repeat-in-progress' is non-nil.
repeat-in-progress is an obscure variable, which is also not visible
until repeat.el is loaded. Please reword this to be in user-level
terms, like "when a command is repeated due to `repeat-mode'" or
something similar.
Please also add the :version tag to each and every new defcustom.
> +(defcustom cursor-indicators-input-method-indicator "dark magenta"
> + "Cursor indicator used when input method is activated now.
^^^
What do you mean by "now"?
> +(define-minor-mode cursor-indicators-mode
> + "Change cursor type and/or face for indications.
"Change cursor type and/or face to indicate various minor modes."
> +When enabled, this mode changes the cursor appearance to indicate
> +overwrite mode or read-only buffers."
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
That is not the full list of indications.
From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 26 00:55:28 2025
Received: (at 77224) by debbugs.gnu.org; 26 Mar 2025 04:55:29 +0000
Received: from localhost ([127.0.0.1]:40849 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from )
id 1txInY-0002rD-3e
for submit@debbugs.gnu.org; Wed, 26 Mar 2025 00:55:28 -0400
Received: from mail-oa1-x43.google.com ([2001:4860:4864:20::43]:58657)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from )
id 1txInU-0002qU-40
for 77224@debbugs.gnu.org; Wed, 26 Mar 2025 00:55:25 -0400
Received: by mail-oa1-x43.google.com with SMTP id
586e51a60fabf-2c759bf1b2eso3352242fac.1
for <77224@debbugs.gnu.org>; Tue, 25 Mar 2025 21:55:24 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1742964918; x=1743569718; darn=debbugs.gnu.org;
h=mime-version:user-agent:message-id:date:references:in-reply-to
:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
bh=fJZTtYRiQ4ozjLGDMf31il2vtA4/cyFitZzuQmVWfq0=;
b=cXsVFYEm97Of9ViUgDh/Unhk4w8lhyrY7hzGJ6oyeHOyvkHtluhDChGI9cBhDdSOD8
mthFInO3M+naMOPxjAZJiuzOZ5mmZTI3em0eEXq9+y2Oa/9Iu3e4D+6EnaKEu3odfJX4
sgHrE42yCIy9koSRzQrenZiZ8CHamEF4qnKrSxGe2/zMhM430HslTuDiTWVvVcM+sJoJ
A5V9igj5B2ly8j0T1KSD7j3K69BYOXOrYC/Pr2jlPwkfOu9ukJBOpeZVX3n+/tGTsIgv
vb5MpOeUqLUP2j/DvJBezE1Gj7EWg8+Vta/gV/pYmJy1TQ0U7sAYQqXpHfCAg5dz/N7b
W/Ug==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1742964918; x=1743569718;
h=mime-version:user-agent:message-id:date:references:in-reply-to
:subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to;
bh=fJZTtYRiQ4ozjLGDMf31il2vtA4/cyFitZzuQmVWfq0=;
b=uzpbpVN0f2OMCvthYvtXKIjuL5pVEY/2eI2qlZOpAj8xM6eKwZKRUctJ4KCX7bGlUO
6dWX7XRqWw5zC6+dqz8M2zP2uCeqB4FSxPD8GZIGvZuQiBna84WiH8Dh8DoS86+f0NlY
rDuN7PMWhX384oJLZnGJpeQuIuLLmm64idNvq8PmCk9aP8EFskNsD7lC1kZJMh9zGRxJ
voeJRoqMOMKLKi4+A+3o+hBsDnmK/7t/IxcSVQRovRZSgXnNKLQHxkiTVYmsMkrpAy2E
nfhVUHHf/wn0SZWkxRJj7DLupgxofDry6y6AbSRHix5/zccYiw/z5q80YyMpw6fXQG2d
gQCQ==
X-Gm-Message-State: AOJu0YxUpe6dfT5KncqcwtogOLr6uOoqG9xH8aOuODYf+NrvZ7jiGx08
jUJSuxYz2/cQ2wd2rZfbRiNlN2Y4KaxqTyNuEOft4K4iV6HFmCXijSLi/o9o
X-Gm-Gg: ASbGncvZKhGqMgUKBxVVGiQLQIaY+yo1o52Nm94HP5mT2twm9xSUZtImcpwADQ9bgaO
yX5WogdCIiMKE/h8MeTbUPDa4o3sQOf2HjLzVzjYku9k2iATqC1GOBxLQFMkZB+lb/wICEn8BV6
RAJpPcGUlVf/d2ypRCFVuIc7IKoSgI7G3mUQoUUesr2zsLBhpLmwibeHRKlmYvHPXy9GQVd3SNv
sA25eMPYjnt29eP2jmfh62ZroYvyidRDjcDabcpI3ONRkIy7QfLWNM4M+MUcEf7vPOkmiqdgDdD
vFHZKFqJEs1l
X-Google-Smtp-Source: AGHT+IHQcguYjv0+1KQB5CQ7Ohw87RBKbVpxIc5bULOrkP6U4alKM9lYj9k9mB58eaO92Rw47y3U+g==
X-Received: by 2002:a05:6871:5310:b0:2c2:561c:47e3 with SMTP id
586e51a60fabf-2c78032a79amr11647285fac.21.1742964917599;
Tue, 25 Mar 2025 21:55:17 -0700 (PDT)
Received: from fedora ([2806:10ae:e:5fce::1]) by smtp.gmail.com with ESMTPSA id
586e51a60fabf-2c77ebc9f40sm2859234fac.3.2025.03.25.21.55.16
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Tue, 25 Mar 2025 21:55:16 -0700 (PDT)
From: =?utf-8?Q?Elijah_Gabe_P=C3=A9rez?=
To: Eli Zaretskii
Subject: Re: bug#77224: [PATCH] New minor mode 'cursor-indicators-mode'
In-Reply-To: <86o6xpe2cx.fsf@gnu.org>
References: <87iknzxski.fsf@gmail.com> <87o6xq6fud.fsf@mail.linkov.net>
<875xjymh93.fsf@gmail.com> <87ikny2rio.fsf@gmail.com>
<86o6xpe2cx.fsf@gnu.org>
Date: Tue, 25 Mar 2025 22:55:15 -0600
Message-ID: <87o6xobdcc.fsf@gmail.com>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 77224
Cc: , 77224@debbugs.gnu.org, juri@linkov.net
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit"
X-Spam-Score: -0.7 (/)
--=-=-=
Content-Type: multipart/alternative; boundary="==-=-="
--==-=-=
Content-Type: text/plain
I've updated the patch following Juri suggestions.
Now all the conditions are inside a single =defcustom=.
I've added only basic colors that a basic TTY can support, and a
=Package-Requires= tag in case this package should also be included in
ELPA.
This version now can handle functions as conditions (lambdas and function
symbols).
--==-=-=
Content-Type: text/html
I've updated the patch following Juri suggestions.
Now all the conditions are inside a single defcustom
.
I've added only basic colors that a basic TTY can support, and a
Package-Requires
tag in case this package should also be included in
ELPA.
This version now can handle functions as conditions (lambdas and function
symbols).
--==-=-=--
--=-=-=
Content-Type: text/x-patch; charset=utf-8
Content-Disposition: attachment;
filename=0001-New-minor-mode-cursor-indicators-mode.patch
Content-Transfer-Encoding: quoted-printable
>From 2d89262880a47628cb47d803cedc6f04fd1f70d4 Mon Sep 17 00:00:00 2001
From: =3D?UTF-8?q?El=3DC3=3DADas=3D20Gabriel=3D20P=3DC3=3DA9rez?=3D
Date: Sat, 22 Mar 2025 22:56:01 -0600
Subject: [PATCH] New minor mode 'cursor-indicators-mode'
This minor mode changes the cursor appearance to indicate
buffers states, such as if overwrite-mode is active or current
buffer is read-only. (Bug#77224)
Acts similar to 'cua-enable-cursor-indications'
* etc/NEWS: Document changes.
* lisp/cursor-indicators.el
(cursor-indicators-conditions): New user option.
(cursor-indicators--default-cursor-color): New use internal variable.
(cursor-indicators--update-indications)
(cursor-indicators--change-cursor): New use internal function.
(cursor-indicators-mode): New minor mode definition.
---
etc/NEWS | 9 +++
lisp/cursor-indicators.el | 139 ++++++++++++++++++++++++++++++++++++++
2 files changed, 148 insertions(+)
create mode 100644 lisp/cursor-indicators.el
diff --git a/etc/NEWS b/etc/NEWS
index cc63d03eafe..e87afc8c1b6 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1566,6 +1566,15 @@ This user option replaces 'follow-mode-prefix', whic=
h had to be set
before loading Follow mode. This new option allows you to change the
prefix even after it was loaded, using 'customize-option' or 'setopt'.
=20
+---
+*** New minor mode 'cursor-indicators-mode'
+This mode changes cursor appearance (color and/or type) to indicate
+different buffer states according to 'cursor-indicators-conditions'.
+The mode have cursor indicators out the box for:
+- Overwrite mode
+- Read-only buffers
+- Input method activation
+
---
*** cdl.el is now obsolete.
Use 'shell-command' and 'shell-command-on-region' instead.
diff --git a/lisp/cursor-indicators.el b/lisp/cursor-indicators.el
new file mode 100644
index 00000000000..bbd33e7c634
--- /dev/null
+++ b/lisp/cursor-indicators.el
@@ -0,0 +1,139 @@
+;;; cursor-indicators.el --- Cursor indicators for some states -*- lexica=
l-binding: t; -*-
+
+;; Copyright (C) 2025 Free Software Foundation, Inc.
+
+;; Version: 1.0.0
+;; Author: El=C3=ADas Gabriel P=C3=A9rez
+;; Package-Requires: ((emacs "26.1"))
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see .
+
+;;; Commentary:
+;; This package changes cursor appearance (color and/or type) to indicate
+;; different buffer states.
+
+;;; Code:
+(require 'map)
+
+;;; User options
+
+(defcustom cursor-indicators-conditions
+ '((overwrite-mode . box)
+ (buffer-read-only . "green")
+ (current-input-method . "blue"))
+ "Alist of conditions to which cursor should change its appearence.
+Only used when `cursor-indicators-mode' is enabled.
+
+Each element is an alist entry in one of these forms:
+ (CONDITION . COLOR) Change cursor color
+ (CONDITION . TYPE) Change cursor type
+ (CONDITION TYPE COLOR) Change cursor color and type
+
+CONDITION must be a function (without arguments) or a variable that
+must return non-nil.
+COLOR is a string specifying the cursor color.
+TYPE specifies cursor type.
+
+Colors can be any valid color name or hex RGB value.
+Valid cursor types are:
+ `box' - Filled box
+ `bar' - Vertical bar
+ `hbar' - Horizontal bar
+ `hollow' - Hollow box
+
+Each element in this alist takes predominance according to its order.
+
+If none of the conditions return non-nil, the cursor will use default
+cursor type and color."
+ :group 'cursor
+ :version "31.1"
+ :type '(alist :key-type
+ (choice :tag "Condition"
+ (const :tag "Overwrite mode" overwrite-mode)
+ (const :tag "Read-only mode" buffer-read-only)
+ (const :tag "Repeat mode" repeat-in-progress)
+ (const :tag "Activated input method" current-input=
-method)
+ ;; User-defined conditions
+ (function :tag "Variable")
+ (variable :tag "Function"))
+ :value-type
+ (choice
+ (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))
+ (group :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")))))
+
+;;; Internal Code
+
+(defvar cursor-indicators--default-cursor-color (frame-parameter nil 'curs=
or-color))
+
+(defun cursor-indicators--change-cursor (key val)
+ ;; Check if KEY is non-nil
+ (when (or (and (symbolp key) (boundp key) (symbol-value key))
+ (and (interpreted-function-p key) (funcall key))
+ (and (functionp key) (symbolp key) (not (boundp key)) (funcall=
key)))
+ (cond
+ ;; Set cursor color
+ ((and (stringp val) (not (equal val (frame-parameter nil 'cursor-colo=
r))))
+ (set-cursor-color val)
+ (setq-local cursor-type (default-value 'cursor-type))) ; Set to defa=
ult cursor type
+ ;; Set cursor type
+ ((and (symbolp val) (not (eq val (default-value 'cursor-type))))
+ (setq-local cursor-type val)
+ (set-cursor-color cursor-indicators--default-cursor-color)) ; Set to=
default cursor color
+ ;; Set cursor color and type
+ ((consp val)
+ (let ((type (car val))
+ (color (cadr val)))
+ (when (and (symbolp type) (not (eq type (default-value 'cursor-typ=
e)))
+ (stringp color) (not (equal color (frame-parameter nil =
'cursor-color))))
+ (set-cursor-color color)
+ (setq-local cursor-type type)))))
+ ;; And exit from loop.
+ (throw 'c-i-exit t)))
+
+(defun cursor-indicators--update-indications ()
+ ;; C-I-EXIT is used here for exit from loop.
+ (when (and cursor-type
+ (not (catch 'c-i-exit (map-do #'cursor-indicators--change-cur=
sor cursor-indicators-conditions))))
+ (setq-local cursor-type (default-value 'cursor-type))
+ (set-cursor-color cursor-indicators--default-cursor-color)))
+
+;;;###autoload
+(define-minor-mode cursor-indicators-mode
+ "Change cursor type and/or face for indications.
+When enabled, this mode changes the cursor appearance to indicate
+different buffer states."
+ :group 'cursor
+ :version "31.1"
+ :global t
+ (if cursor-indicators-mode
+ (progn
+ (add-hook 'post-command-hook #'cursor-indicators--update-indicatio=
ns)
+ (cursor-indicators--update-indications))
+ (remove-hook 'post-command-hook #'cursor-indicators--update-indication=
s)
+ (set-cursor-color cursor-indicators--default-cursor-color)
+ (setq-local cursor-type (default-value 'cursor-type))))
+
+(provide 'cursor-indicators)
+;;; cursor-indicators.el ends here
--=20
2.49.0
--=-=-=
Content-Type: text/plain
--
- E.G via GNU Emacs and Org.
--=-=-=--
From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 26 01:01:08 2025
Received: (at 77224) by debbugs.gnu.org; 26 Mar 2025 05:01:08 +0000
Received: from localhost ([127.0.0.1]:40856 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from )
id 1txIt1-00038B-Lh
for submit@debbugs.gnu.org; Wed, 26 Mar 2025 01:01:08 -0400
Received: from mail-oi1-x243.google.com ([2607:f8b0:4864:20::243]:61857)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from )
id 1txIsy-00037U-En
for 77224@debbugs.gnu.org; Wed, 26 Mar 2025 01:01:05 -0400
Received: by mail-oi1-x243.google.com with SMTP id
5614622812f47-3fa6c54cdb2so5528332b6e.3
for <77224@debbugs.gnu.org>; Tue, 25 Mar 2025 22:01:04 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1742965258; x=1743570058; darn=debbugs.gnu.org;
h=mime-version:user-agent:message-id:date:references:in-reply-to
:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
bh=dE8ffj+xIXWLB9zedBabIuwfUW5qVJ7n4dM0/e03yIE=;
b=ALweFWNpw+31LZmZoEpMewWboQDeDiLRbGGtfzQoZrrJT+CGe2/LTN3rmfbchajANX
Eukmw6ywa8yD7yYW0+9wtI3wcsAAE5STcxX9+3jgXTlwXH5HWuzsObJKjVpGOgXcSUjf
89gNG34vb3rrmplQ2MfFIYCkK7WZOsTtl1+DuDOyr3D+Cx2fscFdbhy6YmPearSfuRZT
a66mVqFJHjO5OR4VG+Xelx60St5JgsYreT96ZMJPjCuB6E/rrDlj+M0GTcp4gMB9rqhX
DfxRCu+yYwd4QN80yVhtnBtpEjmSwhX4U9hwRjx6di5j+wMFFGO/gZeW0JVj7Q946gQE
iP+g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1742965258; x=1743570058;
h=mime-version:user-agent:message-id:date:references:in-reply-to
:subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to;
bh=dE8ffj+xIXWLB9zedBabIuwfUW5qVJ7n4dM0/e03yIE=;
b=LIEnRhK6OUOu/B9TObX/EXy3waksrNmChUm8W5GO08fmpSvM71LIZ+DVVhBzUq5f8M
63SsVYZK1RrbYP8RU6mUJZxPaMA3xEHClRhLqgvQuNsM5ce2k7UIQeNzE7qprAYr74a/
1zJnojOehkLSAIazDmrHK/u++JiejVHtmquHBLgoIpNHdBo8V41vE1UuHngeS4Vr73ik
yDeDz7oUsIjsmDoNc9cH1zMu40MngRVZDGAo1nalvLSesqoIyK3m0UZfaBnjosQik5im
cA1aQNYmdC0tAVDMrLdC9DWDbac3yOVnxUfjXRNX3OhVimluag0sjoDk5AJMZylU5nu9
CyZw==
X-Gm-Message-State: AOJu0YzACJKVCSw6FS3AHriQYFHRCBzH2pjPe348mLWGzUKM2xXWa59g
UySpZ350zJG1ww1P3DyGTA10MltMz30OnaCvvbJuEkiqLHbZCPecPN0BPzgY
X-Gm-Gg: ASbGnctbYZXxYNfqcYA5O0Rccy0LjMTUjOTroGfrnlErff3yTasCbPBlui2OCIQuEG7
ZvZEwsUyZrAKkm13xwXOaf4pCZmciG+7hKtUR2+sAUGI5tw807YLO/57+NslqplJgHBsq5KpaRy
hMh7VSVr3Hltw7iGxhCpN7QJVusMZh3W1mSUl0nMq3UGjHBfmnF8m7t1d1MBmaQ4wUZf/uChefu
kfzxKP8IShZm3TyY+N2udtGUeXkiCWIH1nu9OFs1CvNXtd8wpgbsd2J3mWmoLJeT9mptqOOEVeY
b+OyQLCnt89C
X-Google-Smtp-Source: AGHT+IFOhF4JbDJ1JR8OgYbh0zY831SWgytcxaV3A8VUQb5vW/mhufrVTOoDGayZjfG4AlTFeqTsVw==
X-Received: by 2002:a05:6808:14c6:b0:3f9:1fee:8055 with SMTP id
5614622812f47-3febf723a8cmr12388458b6e.15.1742965257895;
Tue, 25 Mar 2025 22:00:57 -0700 (PDT)
Received: from fedora ([2806:10ae:e:5fce::1]) by smtp.gmail.com with ESMTPSA id
006d021491bc7-60234759a2fsm1740327eaf.21.2025.03.25.22.00.56
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Tue, 25 Mar 2025 22:00:57 -0700 (PDT)
From: =?utf-8?Q?Elijah_Gabe_P=C3=A9rez?=
To: Rudolf Schlatte
Subject: Re: bug#77224: [PATCH] New minor mode 'cursor-indicators-mode'
In-Reply-To:
References: <87iknzxski.fsf@gmail.com> <87o6xq6fud.fsf@mail.linkov.net>
<875xjymh93.fsf@gmail.com> <87ikny2rio.fsf@gmail.com>
<871pula7sn.fsf@mail.linkov.net>
Date: Tue, 25 Mar 2025 23:00:56 -0600
Message-ID: <87ldssbd2v.fsf@gmail.com>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 77224
Cc: 77224@debbugs.gnu.org
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit"
X-Spam-Score: -0.7 (/)
--=-=-=
Content-Type: multipart/alternative; boundary="==-=-="
--==-=-=
Content-Type: text/plain
Rudolf Schlatte writes:
> Juri Linkov 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)))
Yeah, you can set it as something like this.
#+begin_src elisp
(setopt cursor-indicators-conditions '((use-region-p . "purple")))
#+end_src
--==-=-=
Content-Type: text/html
Rudolf Schlatte <rudi@constantly.at> writes:
Juri Linkov <juri@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:
#+beginsrc 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")))))
#+endsrc
#+beginsrc 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))))
#+endsrc
#+beginsrc emacs-lisp
(setopt cursor-indicators '((repeat-in-progress "blue")
(current-input-method "red3")
(overwrite-mode 'box)
(default 'bar)))
#+endsrc
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)))
Yeah, you can set it as something like this.
(setopt cursor-indicators-conditions '((use-region-p . "⏺purple")))
--==-=-=--
--=-=-=
Content-Type: text/plain
--
- E.G via GNU Emacs and Org.
--=-=-=--
From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 26 04:16:23 2025
Received: (at 77224) by debbugs.gnu.org; 26 Mar 2025 08:16:23 +0000
Received: from localhost ([127.0.0.1]:41200 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from )
id 1txLvy-0004Ie-PP
for submit@debbugs.gnu.org; Wed, 26 Mar 2025 04:16:23 -0400
Received: from relay9-d.mail.gandi.net ([217.70.183.199]:35069)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from ) id 1txLvs-0004IF-Og
for 77224@debbugs.gnu.org; Wed, 26 Mar 2025 04:16:20 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id A016A443E1;
Wed, 26 Mar 2025 08:16:08 +0000 (UTC)
From: Juri Linkov
To: Elijah Gabe =?iso-8859-1?Q?P=E9rez?=
Subject: Re: bug#77224: [PATCH] New minor mode 'cursor-indicators-mode'
In-Reply-To: <87o6xobdcc.fsf@gmail.com>
Organization: LINKOV.NET
References: <87iknzxski.fsf@gmail.com> <87o6xq6fud.fsf@mail.linkov.net>
<875xjymh93.fsf@gmail.com> <87ikny2rio.fsf@gmail.com>
<86o6xpe2cx.fsf@gnu.org> <87o6xobdcc.fsf@gmail.com>
Date: Wed, 26 Mar 2025 09:58:06 +0200
Message-ID: <875xjwyzvt.fsf@mail.linkov.net>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-GND-State: clean
X-GND-Score: -100
X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduieehtddvucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufgjohhffffkfgggtgesthdtredttdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucggtffrrghtthgvrhhnpeffgeetfeevlefhleejfeeuheeiudeitdffhfdutdekfeffgffhveehteegueekheenucfkphepledurdduvdelrddutdehrdduudejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepledurdduvdelrddutdehrdduudejpdhhvghlohepmhgrihhlrdhgrghnughirdhnvghtpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhgspghrtghpthhtohepfedprhgtphhtthhopeejjedvvdegseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtohepvghlihiisehgnhhurdhorhhgpdhrtghpthhtohepvghgieegvdeiudeisehgmhgrihhlrdgtohhm
X-GND-Sasl: juri@linkov.net
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 77224
Cc: 77224@debbugs.gnu.org, Eli Zaretskii
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit"
X-Spam-Score: -1.7 (-)
> I've updated the patch following Juri suggestions.
> Now all the conditions are inside a single defcustom.
Thanks! I tested that everything works nicely.
There is only one small problem for repeat-mode:
> + (add-hook 'post-command-hook #'cursor-indicators--update-indications)
It would be better to use a large value DEPTH for add-hook
to add the hook to the end. The problem is that repeat-mode
also uses the same hook 'post-command-hook'. So the cursor
indication hook should be called afterwards as the last hook.
From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 26 08:50:27 2025
Received: (at 77224) by debbugs.gnu.org; 26 Mar 2025 12:50:27 +0000
Received: from localhost ([127.0.0.1]:41978 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from )
id 1txQDD-0004Vi-8x
for submit@debbugs.gnu.org; Wed, 26 Mar 2025 08:50:27 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:51862)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from ) id 1txQD9-0004VU-Pf
for 77224@debbugs.gnu.org; Wed, 26 Mar 2025 08:50:24 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1) (envelope-from )
id 1txQD4-0002HQ-0j; Wed, 26 Mar 2025 08:50:18 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
mime-version; bh=0CLpxbDVsbakKuoz6Xcu8YL0g2M7kLTQks86uV5xVjw=; b=Hm+4iVtcZmM9
V8hPBST2XUdoysGC1DF56HDk91DfMJB7dvOVhqfYLWjZbncbq+wCbZGYKI9+xLJ6SdSKp/q3YEDbg
RekqtvwSFayWy29SJX2Qd+MpoU3m7/8wfn3dR+SAu4dDCKcLzoJ58ilWqsjL9dcv2CTbDaRcM+NUy
MJR0lS4cB7rdkjFTY7rlZxKDoL2Jj2AdVEaKTV/Dp/6kIBZiRMabsBQ5xhfX2JDNf/vx4IO3aRnQB
jsXdfDDAlaGaoyxADng7gbb6YPTzcBV++W05roREz1UUt68qCJtLtLDMGVk9713c4WcoR7mPrG3jn
jQjMSSfpppC8z/JRjoyG/A==;
Date: Wed, 26 Mar 2025 14:50:09 +0200
Message-Id: <8634f0dkhq.fsf@gnu.org>
From: Eli Zaretskii
To: Juri Linkov
In-Reply-To: <875xjwyzvt.fsf@mail.linkov.net> (message from Juri Linkov on
Wed, 26 Mar 2025 09:58:06 +0200)
Subject: Re: bug#77224: [PATCH] New minor mode 'cursor-indicators-mode'
References: <87iknzxski.fsf@gmail.com> <87o6xq6fud.fsf@mail.linkov.net>
<875xjymh93.fsf@gmail.com> <87ikny2rio.fsf@gmail.com>
<86o6xpe2cx.fsf@gnu.org> <87o6xobdcc.fsf@gmail.com>
<875xjwyzvt.fsf@mail.linkov.net>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 77224
Cc: 77224@debbugs.gnu.org, eg642616@gmail.com
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit"
X-Spam-Score: -3.3 (---)
> From: Juri Linkov
> Cc: Eli Zaretskii , 77224@debbugs.gnu.org
> Date: Wed, 26 Mar 2025 09:58:06 +0200
>
> > I've updated the patch following Juri suggestions.
> > Now all the conditions are inside a single defcustom.
>
> Thanks! I tested that everything works nicely.
> There is only one small problem for repeat-mode:
>
> > + (add-hook 'post-command-hook #'cursor-indicators--update-indications)
>
> It would be better to use a large value DEPTH for add-hook
> to add the hook to the end. The problem is that repeat-mode
> also uses the same hook 'post-command-hook'. So the cursor
> indication hook should be called afterwards as the last hook.
Would it be better to use an idle timer instead? post-command-hook
tends to make Emacs sluggish.
From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 26 20:51:03 2025
Received: (at 77224) by debbugs.gnu.org; 27 Mar 2025 00:51:03 +0000
Received: from localhost ([127.0.0.1]:45085 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from )
id 1txbSX-000417-1J
for submit@debbugs.gnu.org; Wed, 26 Mar 2025 20:51:03 -0400
Received: from mail-ot1-x343.google.com ([2607:f8b0:4864:20::343]:45398)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from )
id 1txbSR-0003z3-Uy
for 77224@debbugs.gnu.org; Wed, 26 Mar 2025 20:50:58 -0400
Received: by mail-ot1-x343.google.com with SMTP id
46e09a7af769-72bbc03d436so312311a34.3
for <77224@debbugs.gnu.org>; Wed, 26 Mar 2025 17:50:55 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1743036650; x=1743641450; darn=debbugs.gnu.org;
h=mime-version:user-agent:message-id:date:references:in-reply-to
:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
bh=EHw0Jv2o5da++rqVMNLI5gn8XdXmoMlN/3lsYbWbw/0=;
b=OQgxMDl9Y442f1AwP/IRZxR4m6m/ArfccK9nIc25ZrPYj7ukoszyY9tgwE74WLTJdu
GIcGhUNW68b2hCcjerMKsibpw8bx8NVxxqM+awJZ6hxVflEnUGq9Uzulm2DWSHUmHZma
H2SOB5XcTft0bDHegiuICe7iOPofaK5bwT3ZHzX0518h3XSChvtGV0Z3m0kRjx2bAsrG
pVaz6/symreXzYnL0aAoqQbHGoXPATl9nr6j5x4i2Co2OXeMl0cc9GeFQh0iMQlf1/D7
9vglG0SxIzPRwqdOhCe9laIwALNi4tBcEA4ctYRwyUzKZ7hN/8i3p/r17DNbwaN9QMUj
u5hQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1743036650; x=1743641450;
h=mime-version:user-agent:message-id:date:references:in-reply-to
:subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to;
bh=EHw0Jv2o5da++rqVMNLI5gn8XdXmoMlN/3lsYbWbw/0=;
b=ilcDAEUAHhyyoFP1691uBCfJOb8ViKraE1c4KujfqPKM5YSxdXVzq7ZEW6ptmcvREO
CDR6aHXRie7SY8ph5Y8QH6tBtTJk7XFpDkpVJbHepiyEgNSbQ2LGW/CTUzJcMf9aKpt1
Zr4yuskPyMuakgTygo+y+l8x8MjEcGoJOjE05VhV1Ju96yACbXMhJBxjwzvPx+ZRo9M+
KkhqgPmf5NAVBVG13vFeIBpcgh8ygyRr+FPTW2zrDYL5FjTiGVBbyI/+M3QBkCXHfqPt
emLTIquONrR1T/s5MABoXYDwFLD/MvuaFpt2Zp+gv5rEjFt9ejPthtJI18hrhj62RFzV
z4Yg==
X-Forwarded-Encrypted: i=1;
AJvYcCU/l8LTOT27MB61+2LyM2ssvTiQ6ZSeFIf5eyijR/SIH/kRHJFkeyBsJpRQTeeEwDobvZQ1cQ==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YzT+4Phdap/9dcTgJ4nJ1NUo/ssFRHO8WG1lKhkk4LJ1sQqJZuF
t5xMnbN+zbMcTZDoP+iMjlT+dp78936ofVUeiHBFR7Oe9z2byVNjo1LUA7HS
X-Gm-Gg: ASbGnculocek8tA4JlYl+Fm6bp02lNqzy+Q06EC1rRVg0yNx5JRkATaUE7nVah6uY4P
Z419UtLC8wiNppBAPgRyDZIdDElwhrt3Id+6nSNcpar9gGN/Y2nwB3yjZUXVx2LL808DZtnuMhu
8XgKP25KmkCe9ka9nzyft4tm/PPzxtmJ1S98odiRM/Fht7nW6Qy9JZZT7Dc2HXmW6aBPA22ZIHl
eI1MzvQMs+xYIgsrLX2hLZzXRBlXP9Pnlcubupb9f0OeDjNfrrlPUEmScSFklQWPVIo9tFVS1js
Kari86sGJO39
X-Google-Smtp-Source: AGHT+IGub5PsrLLmfVF4ho4QfyDrtDNiz/ruUyGMgb/MxDlE92kKBGcI62uSknf0Z+d4jlK5JYX13w==
X-Received: by 2002:a05:6830:f93:b0:727:3303:7ea8 with SMTP id
46e09a7af769-72c4ca166f8mr1256333a34.25.1743036649513;
Wed, 26 Mar 2025 17:50:49 -0700 (PDT)
Received: from fedora ([2806:10ae:e:5fce::1]) by smtp.gmail.com with ESMTPSA id
46e09a7af769-72c0ac7b8aasm2520187a34.62.2025.03.26.17.50.48
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Wed, 26 Mar 2025 17:50:48 -0700 (PDT)
From: =?utf-8?Q?Elijah_Gabe_P=C3=A9rez?=
To: Eli Zaretskii
Subject: Re: bug#77224: [PATCH] New minor mode 'cursor-indicators-mode'
In-Reply-To: <8634f0dkhq.fsf@gnu.org>
References: <87iknzxski.fsf@gmail.com> <87o6xq6fud.fsf@mail.linkov.net>
<875xjymh93.fsf@gmail.com> <87ikny2rio.fsf@gmail.com>
<86o6xpe2cx.fsf@gnu.org> <87o6xobdcc.fsf@gmail.com>
<875xjwyzvt.fsf@mail.linkov.net> <8634f0dkhq.fsf@gnu.org>
Date: Wed, 26 Mar 2025 18:50:47 -0600
Message-ID: <875xjvcn4o.fsf@gmail.com>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 77224
Cc: 77224@debbugs.gnu.org, Juri Linkov
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit"
X-Spam-Score: -0.7 (/)
--=-=-=
Content-Type: multipart/alternative; boundary="==-=-="
--==-=-=
Content-Type: text/plain
Eli Zaretskii writes:
>> From: Juri Linkov
>> Cc: Eli Zaretskii , 77224@debbugs.gnu.org
>> Date: Wed, 26 Mar 2025 09:58:06 +0200
>> > I've updated the patch following Juri suggestions.
>> > Now all the conditions are inside a single defcustom.
>> Thanks! I tested that everything works nicely.
>> There is only one small problem for repeat-mode:
>> > + (add-hook 'post-command-hook #'cursor-indicators--update-indications)
>> It would be better to use a large value DEPTH for add-hook
>> to add the hook to the end. The problem is that repeat-mode
>> also uses the same hook 'post-command-hook'. So the cursor
>> indication hook should be called afterwards as the last hook.
> Would it be better to use an idle timer instead? post-command-hook
> tends to make Emacs sluggish.
Yeah, that is that what worried me when i decided to use that hook.
I've fixed the patch to use only idle-timer instead.
--==-=-=
Content-Type: text/html
Eli Zaretskii <eliz@gnu.org> writes:
From: Juri Linkov <juri@linkov.net>
Cc: Eli Zaretskii <eliz@gnu.org>, 77224@debbugs.gnu.org
Date: Wed, 26 Mar 2025 09:58:06 +0200
I've updated the patch following Juri suggestions.
Now all the conditions are inside a single defcustom.
Thanks! I tested that everything works nicely.
There is only one small problem for repeat-mode:
+ (add-hook 'post-command-hook #'cursor-indicators–update-indications)
It would be better to use a large value DEPTH for add-hook
to add the hook to the end. The problem is that repeat-mode
also uses the same hook 'post-command-hook'. So the cursor
indication hook should be called afterwards as the last hook.
Would it be better to use an idle timer instead? post-command-hook
tends to make Emacs sluggish.
Yeah, that is that what worried me when i decided to use that hook.
I've fixed the patch to use only idle-timer instead.
--==-=-=--
--=-=-=
Content-Type: text/x-patch; charset=utf-8
Content-Disposition: attachment;
filename=0001-New-minor-mode-cursor-indicators-mode.patch
Content-Transfer-Encoding: quoted-printable
>From 03099d0bfe4f2e56444973d9eb1c93ec7896465d Mon Sep 17 00:00:00 2001
From: =3D?UTF-8?q?El=3DC3=3DADas=3D20Gabriel=3D20P=3DC3=3DA9rez?=3D
Date: Sat, 22 Mar 2025 22:56:01 -0600
Subject: [PATCH] New minor mode 'cursor-indicators-mode'
This minor mode changes the cursor appearance to indicate
buffers states, such as if overwrite-mode is active or current
buffer is read-only. (Bug#77224)
Acts similar to 'cua-enable-cursor-indications'
* etc/NEWS: Document changes.
* lisp/cursor-indicators.el
(cursor-indicators-conditions): New user option.
(cursor-indicators--default-cursor-color)
(cursor-indicators--idle-timer)
(cursor-indicators-idle-time): New use internal variables.
(cursor-indicators--update-indications)
(cursor-indicators--remove-idle-timer)
(cursor-indicators--change-cursor): New use internal functions.
(cursor-indicators-mode): New minor mode definition.
---
etc/NEWS | 9 +++
lisp/cursor-indicators.el | 153 ++++++++++++++++++++++++++++++++++++++
2 files changed, 162 insertions(+)
create mode 100644 lisp/cursor-indicators.el
diff --git a/etc/NEWS b/etc/NEWS
index cc63d03eafe..e87afc8c1b6 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1566,6 +1566,15 @@ This user option replaces 'follow-mode-prefix', whic=
h had to be set
before loading Follow mode. This new option allows you to change the
prefix even after it was loaded, using 'customize-option' or 'setopt'.
=20
+---
+*** New minor mode 'cursor-indicators-mode'
+This mode changes cursor appearance (color and/or type) to indicate
+different buffer states according to 'cursor-indicators-conditions'.
+The mode have cursor indicators out the box for:
+- Overwrite mode
+- Read-only buffers
+- Input method activation
+
---
*** cdl.el is now obsolete.
Use 'shell-command' and 'shell-command-on-region' instead.
diff --git a/lisp/cursor-indicators.el b/lisp/cursor-indicators.el
new file mode 100644
index 00000000000..64db160f390
--- /dev/null
+++ b/lisp/cursor-indicators.el
@@ -0,0 +1,153 @@
+;;; cursor-indicators.el --- Cursor indicators for some states -*- lexica=
l-binding: t; -*-
+
+;; Copyright (C) 2025 Free Software Foundation, Inc.
+
+;; Version: 1.0.0
+;; Author: El=C3=ADas Gabriel P=C3=A9rez
+;; Package-Requires: ((emacs "26.1") (compat "30.0.1.0"))
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see .
+
+;;; Commentary:
+;; This package changes cursor appearance (color and/or type) to indicate
+;; different buffer states.
+
+;;; Code:
+(require 'map)
+(require 'compat)
+
+;;; User options
+
+(defcustom cursor-indicators-conditions
+ '((overwrite-mode . "red")
+ (buffer-read-only . "green")
+ (current-input-method . "blue"))
+ "Alist of conditions to which cursor should change its appearence.
+Only used when `cursor-indicators-mode' is enabled.
+
+Each element is an alist entry in one of these forms:
+ (CONDITION . COLOR) Change cursor color
+ (CONDITION . TYPE) Change cursor type
+ (CONDITION TYPE COLOR) Change cursor color and type
+
+CONDITION must be a function (without arguments) or a variable that
+must return non-nil.
+COLOR is a string specifying the cursor color.
+TYPE specifies cursor type.
+
+Colors can be any valid color name or hex RGB value.
+Valid cursor types are:
+ `box' - Filled box
+ `bar' - Vertical bar
+ `hbar' - Horizontal bar
+ `hollow' - Hollow box
+
+Each element in this alist takes predominance according to its order.
+
+If none of the conditions return non-nil, the cursor will use default
+cursor type and color."
+ :group 'cursor
+ :version "31.1"
+ :type '(alist :key-type
+ (choice :tag "Condition"
+ (const :tag "Overwrite mode" overwrite-mode)
+ (const :tag "Read-only mode" buffer-read-only)
+ (const :tag "Repeat mode" repeat-in-progress)
+ (const :tag "Activated input method" current-input=
-method)
+ ;; User-defined conditions
+ (function :tag "Variable")
+ (variable :tag "Function"))
+ :value-type
+ (choice
+ (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))
+ (group :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")))))
+
+;;; Internal Code
+
+(defvar cursor-indicators--default-cursor-color (frame-parameter nil 'curs=
or-color))
+(defvar cursor-indicators--idle-timer nil)
+
+(defun cursor-indicators--change-cursor (key val)
+ "Helper function to `cursor-indicators--update-indications'."
+ ;; Check if KEY is non-nil
+ (when (or (and (symbolp key) (boundp key) (symbol-value key))
+ (and (interpreted-function-p key) (funcall key))
+ (and (functionp key) (symbolp key) (not (boundp key)) (funcall=
key)))
+ (cond
+ ;; Set cursor color
+ ((and (stringp val) (not (equal val (frame-parameter nil 'cursor-colo=
r))))
+ (set-cursor-color val)
+ (setq-local cursor-type (default-value 'cursor-type))) ; Set to defa=
ult cursor type
+ ;; Set cursor type
+ ((and (symbolp val) (not (eq val (default-value 'cursor-type))))
+ (setq-local cursor-type val)
+ (set-cursor-color cursor-indicators--default-cursor-color)) ; Set to=
default cursor color
+ ;; Set cursor color and type
+ ((consp val)
+ (let ((type (car val))
+ (color (cadr val)))
+ (when (and (symbolp type) (not (eq type (default-value 'cursor-typ=
e)))
+ (stringp color) (not (equal color (frame-parameter nil =
'cursor-color))))
+ (set-cursor-color color)
+ (setq-local cursor-type type)))))
+ ;; And exit from loop.
+ (throw 'c-i-exit t)))
+
+(defun cursor-indicators--update-indications ()
+ ;; C-I-EXIT is used here for exit from loop.
+ (when (and cursor-type
+ (not (catch 'c-i-exit (map-do #'cursor-indicators--change-cur=
sor cursor-indicators-conditions))))
+ (setq-local cursor-type (default-value 'cursor-type))
+ (set-cursor-color cursor-indicators--default-cursor-color)))
+
+(defun cursor-indicators--remove-idle-timer ()
+ "Stop and Remove idle time set."
+ (when cursor-indicators--idle-timer
+ (cancel-timer cursor-indicators--idle-timer)
+ (setq cursor-indicators--idle-timer nil)))
+
+(defvar cursor-indicators-idle-time 0.1
+ "Time used for set an idle-timer.")
+
+;;;###autoload
+(define-minor-mode cursor-indicators-mode
+ "Change cursor type and/or face for indications.
+When enabled, this mode changes the cursor appearance to indicate
+different buffer states."
+ :group 'cursor
+ :version "31.1"
+ :global t
+ (if cursor-indicators-mode
+ (progn
+ (cursor-indicators--remove-idle-timer)
+ (setq cursor-indicators--idle-timer
+ (run-with-idle-timer cursor-indicators-idle-time t
+ #'cursor-indicators--update-indications=
)))
+ (cursor-indicators--remove-idle-timer)
+ (set-cursor-color cursor-indicators--default-cursor-color)
+ (setq-local cursor-type (default-value 'cursor-type))))
+
+(provide 'cursor-indicators)
+;;; cursor-indicators.el ends here
--=20
2.49.0
--=-=-=
Content-Type: text/plain
--
- E.G via GNU Emacs and Org.
--=-=-=--
From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 26 22:52:29 2025
Received: (at 77224) by debbugs.gnu.org; 27 Mar 2025 02:52:29 +0000
Received: from localhost ([127.0.0.1]:45668 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from )
id 1txdM3-0005VF-LF
for submit@debbugs.gnu.org; Wed, 26 Mar 2025 22:52:29 -0400
Received: from mail-oo1-xc41.google.com ([2607:f8b0:4864:20::c41]:53714)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from )
id 1txdM0-0005Ti-0e
for 77224@debbugs.gnu.org; Wed, 26 Mar 2025 22:52:25 -0400
Received: by mail-oo1-xc41.google.com with SMTP id
006d021491bc7-601b1132110so332449eaf.3
for <77224@debbugs.gnu.org>; Wed, 26 Mar 2025 19:52:23 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1743043938; x=1743648738; darn=debbugs.gnu.org;
h=mime-version:user-agent:message-id:date:references:in-reply-to
:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
bh=2bHIyP0JWXA/qlab1DPj+VlansYYd2gz7avX0f/NNVI=;
b=blrr7cOHEjonOwwsKA2nrlm7UMLwy93Yr98Bd4konIYlE1Tp7O5fSkvbTFRk/3voEA
tLWdKEc3sBsU0x2qyl6mA2RL8r/cbihSQ7SNvqmWd3WbuylX7BNEFty8gJm05eZumLCB
tBxJzFvGMDL+i1yN36QfJTQAy+L8WnZFIajfkbSD9WZfUlMw18k/BF02k+i1Dm+jrXlj
QAirIA7WmieRpboZECgG8cpTtM/XcpmP3Q5qpyRZZHh/t9SWk9u6r/UZcyc2NPWiqaTb
3qUvtoLtKKxIiGhTDk51T9nIm5k9sBzd3QTX9nyLICv4c4YdUVv73L7hP9vbC0qNuWxo
kbdA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1743043938; x=1743648738;
h=mime-version:user-agent:message-id:date:references:in-reply-to
:subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to;
bh=2bHIyP0JWXA/qlab1DPj+VlansYYd2gz7avX0f/NNVI=;
b=wsxcY0hB3BgcT6G+SyVFgyWkoFW8kkf/MMxubJp7DkiBku0+pfKBLN5kGFeSS43IPe
1URajHADVMmTE0kD/0BxzkeVmiCeVz9qK6jurlt4n7lamJqSf/yrS73Vxg0+xxZzXdCx
Jat9X8IKA+bP/qO4M0wZbfXhQzt3LHgROxg4oYnq8o6VO7TAoUwZT/yvJhLWcA4B+ziK
dNS9gS2pXW6W8fYJIRXQCEOiIhrP0Aa0rPOoKhkj9k+30366LYqribIkmrDisNQ0qrFN
yu5PTMHWvyfOrTHn9zFY8JZNJdNFg2p+yJb0DReKtuWHTkOOPE7TkMY3PObxaIeT2V6e
6ToA==
X-Gm-Message-State: AOJu0YyAmv0jFgyNVIqh56spz4wSH1qwucy88hiEMDUJGglvljnBozAg
P2MxdRS4nGooJ7f6TyIHwfZwLxs3JQw5GgkBj8hhagZJLxKLR61K
X-Gm-Gg: ASbGncvPbahMQXG/6ajkoCeidMM9zgRvYi4aNdASqoFp0qvjMnewKtEvtFDz4hljGbx
8dBGzo1zj00s+hHciGvjp4fgNQXZUg756ZGMzkfOabFYRi7MUx2Dg3aUkha4iZ4Drn4J/TUsHyr
4++RPY3NMudXs2RAkDdA8or/exsHdi6X1GH4Iki9aPyVzV9QjSztgUZaFRCWwmARImXtJHYcoWC
q0y7xNPCBSxITLbbBLCLjC6gkbWXFcFR+265WmYzJ1vSqTm35Ci0KKIihX98mHqjisIdqvTcK2e
aHlYhX+0lUMF
X-Google-Smtp-Source: AGHT+IHv3S2wFWT7AVmFYLHCx8BBlqJx34NQFdZAMQCZWMitqYH7jTq1XQu/4VC//dwquB09UlbJmw==
X-Received: by 2002:a05:6870:d113:b0:29d:c764:f873 with SMTP id
586e51a60fabf-2c84819d07emr1147638fac.31.1743043937676;
Wed, 26 Mar 2025 19:52:17 -0700 (PDT)
Received: from fedora ([2806:10ae:e:5fce::1]) by smtp.gmail.com with ESMTPSA id
586e51a60fabf-2c77f05ec85sm3413184fac.32.2025.03.26.19.52.16
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Wed, 26 Mar 2025 19:52:16 -0700 (PDT)
From: =?utf-8?Q?Elijah_Gabe_P=C3=A9rez?=
To: Eli Zaretskii
Subject: Re: bug#77224: [PATCH] New minor mode 'cursor-indicators-mode'
In-Reply-To: <875xjvcn4o.fsf@gmail.com>
References: <87iknzxski.fsf@gmail.com> <87o6xq6fud.fsf@mail.linkov.net>
<875xjymh93.fsf@gmail.com> <87ikny2rio.fsf@gmail.com>
<86o6xpe2cx.fsf@gnu.org> <87o6xobdcc.fsf@gmail.com>
<875xjwyzvt.fsf@mail.linkov.net> <8634f0dkhq.fsf@gnu.org>
<875xjvcn4o.fsf@gmail.com>
Date: Wed, 26 Mar 2025 20:52:15 -0600
Message-ID: <87r02jb2xs.fsf@gmail.com>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 77224
Cc: 77224@debbugs.gnu.org, Juri Linkov
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit"
X-Spam-Score: -0.7 (/)
--=-=-=
Content-Type: multipart/alternative; boundary="==-=-="
--==-=-=
Content-Type: text/plain
I forgot to update commit message properly.
Sending fixed patch.
--==-=-=
Content-Type: text/html
I forgot to update commit message properly.
Sending fixed patch.
--==-=-=--
--=-=-=
Content-Type: text/x-patch; charset=utf-8
Content-Disposition: attachment;
filename=0001-New-package-cursor-indicators-mode-Bug-77224.patch
Content-Transfer-Encoding: quoted-printable
>From 09400072236d8297b2cf8af644bfeeaa8c63593e Mon Sep 17 00:00:00 2001
From: =3D?UTF-8?q?El=3DC3=3DADas=3D20Gabriel=3D20P=3DC3=3DA9rez?=3D
Date: Sat, 22 Mar 2025 22:56:01 -0600
Subject: [PATCH] New package 'cursor-indicators-mode' (Bug#77224)
This minor mode changes the cursor appearance to indicate
buffers states, such as if overwrite-mode is active or current
buffer is read-only.
Acts similar to 'cua-enable-cursor-indications'
* etc/NEWS: Document new package.
* lisp/cursor-indicators.el: New file.
---
etc/NEWS | 10 +++
lisp/cursor-indicators.el | 167 ++++++++++++++++++++++++++++++++++++++
2 files changed, 177 insertions(+)
create mode 100644 lisp/cursor-indicators.el
diff --git a/etc/NEWS b/etc/NEWS
index cc63d03eafe..2745d467722 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1566,6 +1566,16 @@ This user option replaces 'follow-mode-prefix', whic=
h had to be set
before loading Follow mode. This new option allows you to change the
prefix even after it was loaded, using 'customize-option' or 'setopt'.
=20
+---
+*** New package 'cursor-indicators-mode'
+This provides a new minor mode, 'cursor-indicators-mode'.
+This mode changes cursor appearance (color and/or type) to indicate
+different buffer states according to 'cursor-indicators-conditions'.
+The mode have cursor indicators out the box for:
+- Overwrite mode
+- Read-only buffers
+- Input method activation
+
---
*** cdl.el is now obsolete.
Use 'shell-command' and 'shell-command-on-region' instead.
diff --git a/lisp/cursor-indicators.el b/lisp/cursor-indicators.el
new file mode 100644
index 00000000000..c9122ae864b
--- /dev/null
+++ b/lisp/cursor-indicators.el
@@ -0,0 +1,167 @@
+;;; cursor-indicators.el --- Cursor indicators for some states -*- lexica=
l-binding: t; -*-
+
+;; Copyright (C) 2025 Free Software Foundation, Inc.
+
+;; Version: 1.0.0
+;; Author: El=C3=ADas Gabriel P=C3=A9rez
+;; Package-Requires: ((emacs "26.1") (compat "30"))
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see .
+
+;;; Commentary:
+;; This package allows changes cursor appearance (color and/or type) to
+;; indicate different buffer states such as if current buffer is
+;; read-only or if overwrite mode is currently active.
+;;
+;; Usage:
+;; For use this mode enable: cursor-indicators-mode.
+;; By default it will set cursor color if overwrite mode is currently
+;; active, if buffer is read-only or if input method is active.
+;;
+;; To change this behavior customize `cursor-indicators-conditions'.
+;; For example, change cursor type to bar when there is a region active:
+;; (setopt cursor-indicators-conditions '((use-region-p . bar)))
+;; Or change both cursor color and type when current buffer have a
+;; specific name:
+;; (setopt cursor-indicators-conditions `((,(lambda () (string-prefix-p " =
*" (buffer-name)))
+;; hollow "yellow")))
+
+;;; Code:
+(require 'map)
+(require 'compat)
+
+;;; User options
+
+(defcustom cursor-indicators-conditions
+ '((overwrite-mode . "red")
+ (buffer-read-only . "green")
+ (current-input-method . "blue"))
+ "Alist of conditions to which cursor should change its appearence.
+Only used when `cursor-indicators-mode' is enabled.
+
+Each element is an alist entry in one of these forms:
+ (CONDITION . COLOR) Change cursor color
+ (CONDITION . TYPE) Change cursor type
+ (CONDITION TYPE COLOR) Change cursor color and type
+
+CONDITION must be a function (without arguments) or a variable that
+must return non-nil. If variable shares name with a function,
+the variable will be used instead.
+COLOR is a string specifying the cursor color.
+TYPE specifies cursor type.
+
+Valid cursor types are:
+ `box' - Filled box
+ `bar' - Vertical bar
+ `hbar' - Horizontal bar
+ `hollow' - Hollow box
+
+Each element in this alist takes predominance according to its order.
+
+If none of the conditions return non-nil, the cursor will use default
+cursor type and color."
+ :group 'cursor
+ :version "31.1"
+ :type '(alist :key-type
+ (choice :tag "Condition"
+ (const :tag "Overwrite mode" overwrite-mode)
+ (const :tag "Read-only mode" buffer-read-only)
+ (const :tag "Repeat mode" repeat-in-progress)
+ (const :tag "Activated input method" current-input=
-method)
+ ;; User-defined conditions
+ (function :tag "Variable")
+ (variable :tag "Function"))
+ :value-type
+ (choice
+ (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))
+ (group :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")))))
+
+;;; Internal Code
+
+(defvar cursor-indicators--default-cursor-color (frame-parameter nil 'curs=
or-color))
+(defvar cursor-indicators--idle-timer nil)
+
+(defun cursor-indicators--change-cursor (key val)
+ "Helper function to `cursor-indicators--update-indications'."
+ ;; Check if KEY is non-nil
+ (when (or (and (symbolp key) (boundp key) (symbol-value key))
+ (and (interpreted-function-p key) (funcall key))
+ (and (functionp key) (symbolp key) (not (boundp key)) (funcall=
key)))
+ (cond
+ ;; Set cursor color
+ ((and (stringp val) (not (equal val (frame-parameter nil 'cursor-colo=
r))))
+ (set-cursor-color val)
+ (setq-local cursor-type (default-value 'cursor-type))) ; Set to defa=
ult cursor type
+ ;; Set cursor type
+ ((and (symbolp val) (not (eq val (default-value 'cursor-type))))
+ (setq-local cursor-type val)
+ (set-cursor-color cursor-indicators--default-cursor-color)) ; Set to=
default cursor color
+ ;; Set cursor color and type
+ ((consp val)
+ (let ((type (car val))
+ (color (cadr val)))
+ (when (and (symbolp type) (not (eq type (default-value 'cursor-typ=
e)))
+ (stringp color) (not (equal color (frame-parameter nil =
'cursor-color))))
+ (set-cursor-color color)
+ (setq-local cursor-type type)))))
+ ;; And exit from loop.
+ (throw 'c-i-exit t)))
+
+(defun cursor-indicators--update-indications ()
+ ;; C-I-EXIT is used here for exit from loop.
+ (when (and cursor-type
+ (not (catch 'c-i-exit (map-do #'cursor-indicators--change-cur=
sor cursor-indicators-conditions))))
+ (setq-local cursor-type (default-value 'cursor-type))
+ (set-cursor-color cursor-indicators--default-cursor-color)))
+
+(defun cursor-indicators--remove-idle-timer ()
+ "Stop and Remove idle time set."
+ (when cursor-indicators--idle-timer
+ (cancel-timer cursor-indicators--idle-timer)
+ (setq cursor-indicators--idle-timer nil)))
+
+(defvar cursor-indicators-idle-time 0.1
+ "Time used for set an idle-timer.")
+
+;;;###autoload
+(define-minor-mode cursor-indicators-mode
+ "Change cursor type and/or face for indications.
+When enabled, this mode changes the cursor appearance to indicate
+different buffer states."
+ :group 'cursor
+ :version "31.1"
+ :global t
+ (if cursor-indicators-mode
+ (progn
+ (cursor-indicators--remove-idle-timer)
+ (setq cursor-indicators--idle-timer
+ (run-with-idle-timer cursor-indicators-idle-time t
+ #'cursor-indicators--update-indications=
)))
+ (cursor-indicators--remove-idle-timer)
+ (set-cursor-color cursor-indicators--default-cursor-color)
+ (setq-local cursor-type (default-value 'cursor-type))))
+
+(provide 'cursor-indicators)
+;;; cursor-indicators.el ends here
--=20
2.49.0
--=-=-=
Content-Type: text/plain
--
- E.G via GNU Emacs and Org.
--=-=-=--
From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 27 01:48:27 2025
Received: (at 77224) by debbugs.gnu.org; 27 Mar 2025 05:48:28 +0000
Received: from localhost ([127.0.0.1]:46749 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from )
id 1txg6M-0006kf-6R
for submit@debbugs.gnu.org; Thu, 27 Mar 2025 01:48:27 -0400
Received: from server.qxqx.de ([2a01:4f8:c012:9177::1]:55919 helo=mail.qxqx.de)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from )
id 1txg6J-0006jO-Ew
for 77224@debbugs.gnu.org; Thu, 27 Mar 2025 01:48:25 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
d=daniel-mendler.de; s=key; h=Content-Transfer-Encoding:Content-Type:
MIME-Version:Message-ID:Date:References:In-Reply-To:Subject:Cc:To:From:Sender
:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:
Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:
List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive;
bh=AWiZdf+esAl3vmTRbB6BYnk6udggjyh6gtZXwNdUBSU=; b=pzFPZ2L7karvvmwr8IzO5qx/m7
LGh9bSaZ3UKNDE0cofkn580Uu+ROyNkQGzpjZ8dofwV34I6aiF+vvZFjca5rEF5O5FXZW/HVNfNRr
W52MKNAs5u4EtCRS0855iFb/nNQslnD2jfU0PZHvjkSOxfHbKfRVz1+4sYqofX0gO+nE=;
From: Daniel Mendler
To: Elijah Gabe =?utf-8?Q?P=C3=A9rez?=
Subject: Re: bug#77224: [PATCH] New minor mode 'cursor-indicators-mode'
In-Reply-To: <875xjvcn4o.fsf@gmail.com> ("Elijah Gabe =?utf-8?Q?P=C3=A9rez?=
=?utf-8?Q?=22's?= message of "Wed, 26 Mar 2025 18:50:47 -0600")
References: <87iknzxski.fsf@gmail.com> <87o6xq6fud.fsf@mail.linkov.net>
<875xjymh93.fsf@gmail.com> <87ikny2rio.fsf@gmail.com>
<86o6xpe2cx.fsf@gnu.org> <87o6xobdcc.fsf@gmail.com>
<875xjwyzvt.fsf@mail.linkov.net> <8634f0dkhq.fsf@gnu.org>
<875xjvcn4o.fsf@gmail.com>
Date: Thu, 27 Mar 2025 06:48:15 +0100
Message-ID: <877c4b81nk.fsf@daniel-mendler.de>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 77224
Cc: 77224@debbugs.gnu.org, Eli Zaretskii ,
Juri Linkov
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit"
X-Spam-Score: -1.7 (-)
Elijah Gabe P=C3=A9rez writes:
> Eli Zaretskii writes:
>
>>> From: Juri Linkov
>>> Cc: Eli Zaretskii , 77224@debbugs.gnu.org
>>> Date: Wed, 26 Mar 2025 09:58:06 +0200
>
>>> > I've updated the patch following Juri suggestions.
>>> > Now all the conditions are inside a single defcustom.
>
>>> Thanks! I tested that everything works nicely.
>>> There is only one small problem for repeat-mode:
>
>>> > + (add-hook 'post-command-hook #'cursor-indicators--update-ind=
ications)
>
>>> It would be better to use a large value DEPTH for add-hook
>>> to add the hook to the end. The problem is that repeat-mode
>>> also uses the same hook 'post-command-hook'. So the cursor
>>> indication hook should be called afterwards as the last hook.
>
>> Would it be better to use an idle timer instead? post-command-hook
>> tends to make Emacs sluggish.
>
> Yeah, that is that what worried me when i decided to use that hook.
>
> I've fixed the patch to use only idle-timer instead.
The problem with the idle timer is that it might not run immediately.
However when the user changes the input method, overwrite mode or
similar, the users expects that the cursor reflects the change
immediately after the last key press and does not lag behind. Therefore
I think there is no alternative to the `post-command-hook'. It seems to
me that only a bunch of mode variables are checked and then
`cursor-type' is set. In CUA the cursor indicator is also updated in the
`post-command-hook'. So this should not be too costly?
Daniel
From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 27 04:38:17 2025
Received: (at 77224) by debbugs.gnu.org; 27 Mar 2025 08:38:17 +0000
Received: from localhost ([127.0.0.1]:47352 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from )
id 1txiki-0000vZ-Ef
for submit@debbugs.gnu.org; Thu, 27 Mar 2025 04:38:17 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:50958)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from ) id 1txike-0000uI-Ky
for 77224@debbugs.gnu.org; Thu, 27 Mar 2025 04:38:13 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1) (envelope-from )
id 1txikX-000265-Sc; Thu, 27 Mar 2025 04:38:05 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
Date; bh=5beOnUPrzxOJny3vZrylTsXbRXsKu5oR0Z1q9CA1duA=; b=I0kio0m2kP21jszBdOnY
jGJVHjYtr3u/aT+XM04QGHvXj5eqEzjotICnXFq8kMEJVC6DSI4zT6nhsl74fkl3Y6qJKRivGMz62
Zf2tH77YcFK1vCB34SlXyVevm4ln5Fv7GBm1aliXhOpQVu1fWdoA6fJwxtuN6CCfuBPvIhCP5iRBk
RJ1MBr/AhZCY8lHaDhQEtgj6bRheZbicObda5dUie5TXN33gFxRkSRQbpzhn8nlW8H0vxRQYiwGLM
IDkdhoqsR0AzOIw69dBVETVKtBq/hmEYJePUz0uJuMN220roZMdmSQQT4Z0FQNVzgPFdhqdJX4Iwc
HOm4MlkS3oJdsQ==;
Date: Thu, 27 Mar 2025 10:38:02 +0200
Message-Id: <86ecyidg2d.fsf@gnu.org>
From: Eli Zaretskii
To: Daniel Mendler
In-Reply-To: <877c4b81nk.fsf@daniel-mendler.de> (message from Daniel Mendler
on Thu, 27 Mar 2025 06:48:15 +0100)
Subject: Re: bug#77224: [PATCH] New minor mode 'cursor-indicators-mode'
References: <87iknzxski.fsf@gmail.com> <87o6xq6fud.fsf@mail.linkov.net>
<875xjymh93.fsf@gmail.com> <87ikny2rio.fsf@gmail.com>
<86o6xpe2cx.fsf@gnu.org> <87o6xobdcc.fsf@gmail.com>
<875xjwyzvt.fsf@mail.linkov.net> <8634f0dkhq.fsf@gnu.org>
<875xjvcn4o.fsf@gmail.com> <877c4b81nk.fsf@daniel-mendler.de>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 77224
Cc: 77224@debbugs.gnu.org, eg642616@gmail.com, juri@linkov.net
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit"
X-Spam-Score: -3.3 (---)
> From: Daniel Mendler
> Cc: Eli Zaretskii , 77224@debbugs.gnu.org, Juri Linkov
>
> Date: Thu, 27 Mar 2025 06:48:15 +0100
>
> Elijah Gabe Pérez writes:
>
> >> Would it be better to use an idle timer instead? post-command-hook
> >> tends to make Emacs sluggish.
> >
> > Yeah, that is that what worried me when i decided to use that hook.
> >
> > I've fixed the patch to use only idle-timer instead.
>
> The problem with the idle timer is that it might not run immediately.
That depends on the value of the SECS argument to run-with-idle-timer,
doesn't it.
> However when the user changes the input method, overwrite mode or
> similar, the users expects that the cursor reflects the change
> immediately after the last key press and does not lag behind. Therefore
> I think there is no alternative to the `post-command-hook'. It seems to
> me that only a bunch of mode variables are checked and then
> `cursor-type' is set. In CUA the cursor indicator is also updated in the
> `post-command-hook'. So this should not be too costly?
Sorry, I object to adding stuff to post-command-hook in these cases.
Emacs becomes very sluggish, and we should avoid that as much as we
can.
From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 27 05:42:32 2025
Received: (at 77224) by debbugs.gnu.org; 27 Mar 2025 09:42:32 +0000
Received: from localhost ([127.0.0.1]:47581 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from )
id 1txjku-0005mS-0V
for submit@debbugs.gnu.org; Thu, 27 Mar 2025 05:42:32 -0400
Received: from server.qxqx.de ([2a01:4f8:c012:9177::1]:39307 helo=mail.qxqx.de)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from )
id 1txjks-0005lE-6i
for 77224@debbugs.gnu.org; Thu, 27 Mar 2025 05:42:30 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
d=daniel-mendler.de; s=key; h=Content-Transfer-Encoding:Content-Type:
MIME-Version:Message-ID:Date:References:In-Reply-To:Subject:Cc:To:From:Sender
:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:
Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:
List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive;
bh=3b2vce8KPq8hoMoKIGGRdnMviQtP3LYVEmCHxjTdf94=; b=iWa1PC1LHV9z8OMF2skU6yQHf4
rBXUHj8KHcy9+WXu/zsdZtINT3/4gfWHw3yekfcrME3piAXPxKpspWMfdEmouoNt0X3YsPBerTwAo
Tep/qbxheVWAZb3cLnJoWtdUzIDSsnvW8MiuKv2riwi4sEjvFJSBa+tQTwa+4g6YQ9Ds=;
From: Daniel Mendler
To: Eli Zaretskii
Subject: Re: bug#77224: [PATCH] New minor mode 'cursor-indicators-mode'
In-Reply-To: <86ecyidg2d.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 27 Mar
2025 10:38:02 +0200")
References: <87iknzxski.fsf@gmail.com> <87o6xq6fud.fsf@mail.linkov.net>
<875xjymh93.fsf@gmail.com> <87ikny2rio.fsf@gmail.com>
<86o6xpe2cx.fsf@gnu.org> <87o6xobdcc.fsf@gmail.com>
<875xjwyzvt.fsf@mail.linkov.net> <8634f0dkhq.fsf@gnu.org>
<875xjvcn4o.fsf@gmail.com> <877c4b81nk.fsf@daniel-mendler.de>
<86ecyidg2d.fsf@gnu.org>
Date: Thu, 27 Mar 2025 10:42:21 +0100
Message-ID: <87h63ekdxe.fsf@daniel-mendler.de>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 77224
Cc: 77224@debbugs.gnu.org, eg642616@gmail.com, juri@linkov.net
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit"
X-Spam-Score: -1.7 (-)
Eli Zaretskii writes:
>> From: Daniel Mendler
>> Cc: Eli Zaretskii , 77224@debbugs.gnu.org, Juri Linkov
>>
>> Date: Thu, 27 Mar 2025 06:48:15 +0100
>>=20
>> Elijah Gabe P=C3=A9rez writes:
>>=20
>> >> Would it be better to use an idle timer instead? post-command-hook
>> >> tends to make Emacs sluggish.
>> >
>> > Yeah, that is that what worried me when i decided to use that hook.
>> >
>> > I've fixed the patch to use only idle-timer instead.
>>=20
>> The problem with the idle timer is that it might not run immediately.
>
> That depends on the value of the SECS argument to run-with-idle-timer,
> doesn't it.
No, there is no guarantee that the idle timer will run soon enough after
the given time if Emacs stays busy.
>> However when the user changes the input method, overwrite mode or
>> similar, the users expects that the cursor reflects the change
>> immediately after the last key press and does not lag behind. Therefore
>> I think there is no alternative to the `post-command-hook'. It seems to
>> me that only a bunch of mode variables are checked and then
>> `cursor-type' is set. In CUA the cursor indicator is also updated in the
>> `post-command-hook'. So this should not be too costly?
>
> Sorry, I object to adding stuff to post-command-hook in these cases.
> Emacs becomes very sluggish, and we should avoid that as much as we
> can.
I see your point about sluggishness and I am very careful myself to not
enable modes which add expensive computations to the
`post-command-hook'. Nevertheless in this case using the
`post-command-hook' is the right thing, such that the `cursor-type' is
changed effective immediately, as had been done before in CUA, see
`cua--post-command-handler-1'. The computation in this case is not
expensive.
Daniel
From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 27 07:14:58 2025
Received: (at 77224) by debbugs.gnu.org; 27 Mar 2025 11:14:58 +0000
Received: from localhost ([127.0.0.1]:47782 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from )
id 1txlCL-0003qc-Uv
for submit@debbugs.gnu.org; Thu, 27 Mar 2025 07:14:58 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:34434)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from ) id 1txlCI-0003pN-M5
for 77224@debbugs.gnu.org; Thu, 27 Mar 2025 07:14:55 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1) (envelope-from )
id 1txlCB-0004Yy-VC; Thu, 27 Mar 2025 07:14:47 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
mime-version; bh=b5bJ1yCqygWpnDQ8Zy0f85l7OqNBSAimReiII1hpNzQ=; b=n1vb2FX9v0Ea
96gDao7wgDPkS7z8HH+vm0fqQbW1fks+vhYvh6GGGLu6CbRdAj8kFBUTjvyIbwG7LzkYSbozolI9z
i3mG7yG38npDkJJtgf3BGgs1qJr/kl7bpMRzm0TyupARFG8LBOh4h8uE5sLcFqJDCX2wtJetSrluF
VjC9YTcgfZoJjcKQVPvn0VhTgGA6IzA1DzgZDd6CY3KGLv9EYHokG91zW77X8ElLLeiM6RJOhadRg
opm2rQPjuL+vM3WLzvNW/ADcH74/1P4DCP8oHp2+EjlPjyEY6tNGlN1mLJMUnyWNJhPykw4KNeFqk
rnt9PAejwXeAxVcFdQMppw==;
Date: Thu, 27 Mar 2025 13:14:45 +0200
Message-Id: <86cye2d8t6.fsf@gnu.org>
From: Eli Zaretskii
To: Daniel Mendler
In-Reply-To: <87h63ekdxe.fsf@daniel-mendler.de> (message from Daniel Mendler
on Thu, 27 Mar 2025 10:42:21 +0100)
Subject: Re: bug#77224: [PATCH] New minor mode 'cursor-indicators-mode'
References: <87iknzxski.fsf@gmail.com> <87o6xq6fud.fsf@mail.linkov.net>
<875xjymh93.fsf@gmail.com> <87ikny2rio.fsf@gmail.com>
<86o6xpe2cx.fsf@gnu.org> <87o6xobdcc.fsf@gmail.com>
<875xjwyzvt.fsf@mail.linkov.net> <8634f0dkhq.fsf@gnu.org>
<875xjvcn4o.fsf@gmail.com> <877c4b81nk.fsf@daniel-mendler.de>
<86ecyidg2d.fsf@gnu.org> <87h63ekdxe.fsf@daniel-mendler.de>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 77224
Cc: 77224@debbugs.gnu.org, eg642616@gmail.com, juri@linkov.net
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit"
X-Spam-Score: -3.3 (---)
> From: Daniel Mendler
> Cc: eg642616@gmail.com, 77224@debbugs.gnu.org, juri@linkov.net
> Date: Thu, 27 Mar 2025 10:42:21 +0100
>
> Eli Zaretskii writes:
>
> >> The problem with the idle timer is that it might not run immediately.
> >
> > That depends on the value of the SECS argument to run-with-idle-timer,
> > doesn't it.
>
> No, there is no guarantee that the idle timer will run soon enough after
> the given time if Emacs stays busy.
If Emacs is busy, the post-command-hook will not run, either. When a
command exits, it return to the main loop, and unless the user types
something before that, Emacs then becomes "idle".
> > Sorry, I object to adding stuff to post-command-hook in these cases.
> > Emacs becomes very sluggish, and we should avoid that as much as we
> > can.
>
> I see your point about sluggishness and I am very careful myself to not
> enable modes which add expensive computations to the
> `post-command-hook'. Nevertheless in this case using the
> `post-command-hook' is the right thing, such that the `cursor-type' is
> changed effective immediately, as had been done before in CUA, see
> `cua--post-command-handler-1'. The computation in this case is not
> expensive.
I disagree that the cursor must change "immediately", in the rigorous
sense of that word. I think if it changes after 10 or 20 or 50
milliseconds, that's "immediately" for any practical purpose.
From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 27 07:41:26 2025
Received: (at 77224) by debbugs.gnu.org; 27 Mar 2025 11:41:26 +0000
Received: from localhost ([127.0.0.1]:47861 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from )
id 1txlby-00033H-0P
for submit@debbugs.gnu.org; Thu, 27 Mar 2025 07:41:26 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:51708)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from ) id 1txlbs-00032N-K4
for 77224@debbugs.gnu.org; Thu, 27 Mar 2025 07:41:24 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1) (envelope-from )
id 1txlbl-0000M2-Uo; Thu, 27 Mar 2025 07:41:13 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
mime-version; bh=s61E38v8kGhUvYGkbehDbKjxf4DWECI333URkFAAPvI=; b=p1Vp4Cy34woy
K+VWr4eg+t2isml6RlLvsVHGzdcWBGkxRSdVG7xp5ksmzg6gDYG/7sTxCvgyFg5ElvEhd/G0XzUY7
mbgCrffgC5aQXerNF8iEoD+lql2W4oJDO7tZs8ba8Ob3WVYHglDjX5q0aWOyX/J/LRYkyrNOKhDdq
3/DFAaFc7zuO5D2onR0gdqg5jmQQq1yTaFtw7Sdpx79WjLwPgV7oZ/j8vMmqKJzk/xwPyhWcVTuw1
0C3iKl9rtBob6svgaCUW5hn8YkYnPqeV+10HL2AbujjxRCEp07/VBXzKiUJaIJ0FByHZn8Nb1nLGl
ILtnUC+R4YtBCRSWAAzh8g==;
Date: Thu, 27 Mar 2025 13:41:10 +0200
Message-Id: <86a596d7l5.fsf@gnu.org>
From: Eli Zaretskii
To: mail@daniel-mendler.de
In-Reply-To: <86cye2d8t6.fsf@gnu.org> (message from Eli Zaretskii on Thu, 27
Mar 2025 13:14:45 +0200)
Subject: Re: bug#77224: [PATCH] New minor mode 'cursor-indicators-mode'
References: <87iknzxski.fsf@gmail.com> <87o6xq6fud.fsf@mail.linkov.net>
<875xjymh93.fsf@gmail.com> <87ikny2rio.fsf@gmail.com>
<86o6xpe2cx.fsf@gnu.org> <87o6xobdcc.fsf@gmail.com>
<875xjwyzvt.fsf@mail.linkov.net> <8634f0dkhq.fsf@gnu.org>
<875xjvcn4o.fsf@gmail.com> <877c4b81nk.fsf@daniel-mendler.de>
<86ecyidg2d.fsf@gnu.org> <87h63ekdxe.fsf@daniel-mendler.de>
<86cye2d8t6.fsf@gnu.org>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 77224
Cc: 77224@debbugs.gnu.org, eg642616@gmail.com, juri@linkov.net
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive: