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 ---------------&#x= 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

Then I could replace:

#+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

with just

#+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: 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, eg642616@gmail.com, juri@linkov.net > Date: Thu, 27 Mar 2025 13:14:45 +0200 > From: Eli Zaretskii > > > 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. Btw, a possibly even better way is to modify the cursor looks from the hooks of the relevant commands, like overwrite-mode. If some of them don't have a hook, we could add a hook. This is better because it doesn't unnecessarily "punish" Emacs anywhere else, only the commands that could affect the cursor. Does this make sense? From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 27 10:53:51 2025 Received: (at 77224) by debbugs.gnu.org; 27 Mar 2025 14:53:51 +0000 Received: from localhost ([127.0.0.1]:50781 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1txoc8-0003tZ-T4 for submit@debbugs.gnu.org; Thu, 27 Mar 2025 10:53:50 -0400 Received: from mail-qv1-xf41.google.com ([2607:f8b0:4864:20::f41]:61498) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1txoc4-0003sE-3t for 77224@debbugs.gnu.org; Thu, 27 Mar 2025 10:53:47 -0400 Received: by mail-qv1-xf41.google.com with SMTP id 6a1803df08f44-6e41e17645dso9781306d6.2 for <77224@debbugs.gnu.org>; Thu, 27 Mar 2025 07:53:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743087218; x=1743692018; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=wxY5BoFvWy+7xUdZC7oSpueOhpYjhebcTTrMgihzESQ=; b=BWbduz18b4NG4ljXcnG6mk2S3ZTkZpxLpUSvQziUa77zP5FKYzPuiN/Ij5cg7CHJxt 1II9e2ynxy5NZG+QtNtppjAAvCZydDOYmthmx+5dR9LOsJMgk6xY9qu7plNsq/NITwVH gZqiN1gk+jM8+2nj+7xkuTG2IMQh6O9ajFnTpM9u1roxgUOuZg9nRfumBP32/u6JUuxo cjv2QLn5+cvfXwS4q23Oo4+x5poI2yEKdXl0qRyIwipM/sD4TQxY4yhvLcGN5OwhKkSs IjMB8wWKuK/x/vaxL5vmDaFwUS+MbWRLc4hkMUECN0lwvZEUdYC5pAm90w7nFpZM44d8 4MFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743087218; x=1743692018; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=wxY5BoFvWy+7xUdZC7oSpueOhpYjhebcTTrMgihzESQ=; b=xF57rU8S7Ey5FwwaEk4EBXsvmN+YzuLMTWYdaRtD9iRLxRDj9OXPgSKI/Kv3sb8fPi CPU0eMGcerXRbAAw1iRguzfTkaW6qONAVIB8FrouAUmd/p0uskqDj+kDPu8mo5FkDx3n AqXwpjTaYg2n3VHGyne2j6YS1YDrFE4s016Ny/g+j8cw6QrMDTB+ONMeirIvyBnW649e 81M88cN1kam6RbFIu/wcIeEKCazMRXaGtkvuEKOUe9ej9l2aEn1qBePrWB4+fX48oO66 9CydAdO4ZPUC3Z6c9xmhCUrgwPm5oVlXqfIiEJG7qieXuREyPQI3Xnuh+UQoPyos3Z94 npag== X-Forwarded-Encrypted: i=1; AJvYcCWfhiCe9eCpAlNjZR9jkv4xZn3fLkz+yp01XfHeKHqg99b+cxtToFXz1x3rSRZDt4p4H3vssQ==@debbugs.gnu.org X-Gm-Message-State: AOJu0Yw16Y5hVW59ismzXAgDT5SDSOt0vZ+BOtwLBTeJHOk8UsOeTHog Lw4N/k/y5m0QAuvG4uMEgsf1+OzkRMpA3EeIuoRtfHY3NeXhGfl7AKe4Pak4vq0NiNKVZnsOvrd B92ut9sqL2B5tNyC7OXFaD/BKe0METSJD X-Gm-Gg: ASbGncsurjLP9Q/GlB/XZVbYc6dgaJtJanIqNUlrvXryKcgfi+DC9Qw3s3PYUhhLvrA 8gZUN4G4gGGxyGNhc6idR9jacUWKQP2lqtdSBlrx2ZetEsz9P/93UBT3UONjKVjqaW5EBPc3itT fqM5pOtNX+nJaA+o/1GEYPqlgaUmDQocDJXiqS6pJdxUKsVIyZz5T1p0Y7 X-Google-Smtp-Source: AGHT+IH444NnQ1kevV6AHxSNe8D1hiLOHrQf25LJwCSNWUt+L1nAF6MlhxKnZkQTlcWD/068bzR44ppMzy0Pr6samLg= X-Received: by 2002:a05:6214:5194:b0:6ea:d393:962c with SMTP id 6a1803df08f44-6ed2390f966mr39958806d6.30.1743087218338; Thu, 27 Mar 2025 07:53:38 -0700 (PDT) MIME-Version: 1.0 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> <86a596d7l5.fsf@gnu.org> In-Reply-To: <86a596d7l5.fsf@gnu.org> From: =?UTF-8?Q?Elijah_Gabe_P=C3=A9rez?= Date: Thu, 27 Mar 2025 08:53:25 -0600 X-Gm-Features: AQ5f1JqqOGY0xQQ3wsEG8i-NFC8zquDwG8vIdKiyIhs8dwWTgSwUzZmNtqabvNE Message-ID: Subject: Re: bug#77224: [PATCH] New minor mode 'cursor-indicators-mode' To: Eli Zaretskii Content-Type: multipart/alternative; boundary="0000000000007634490631541e34" X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 77224 Cc: mail@daniel-mendler.de, Juri Linkov , 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 (/) --0000000000007634490631541e34 Content-Type: text/plain; charset="UTF-8" Eli Zaretskii writes: > Btw, a possibly even better way is to modify the cursor looks from the > hooks of the relevant commands, like overwrite-mode. If some of them > don't have a hook, we could add a hook. This is better because it > doesn't unnecessarily "punish" Emacs anywhere else, only the commands > that could affect the cursor. > But what if user prefer using a lambda instead a function? For example for a specific mode or action from a key binding package such as evil or meow, also i don't know if buffer-read-only have a proper hook. > --0000000000007634490631541e34 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Eli Zaretskii <eliz@gnu.org> writes:
Btw, a possibly even better way is to modify the cursor looks from the
hooks of the relevant commands, like overwrite-mode.=C2=A0 If some of them<= br> don't have a hook, we could add a hook.=C2=A0 This is better because it=
doesn't unnecessarily "punish" Emacs anywhere else, only the = commands
that could affect the cursor.

But what if user prefer using a lambda instead= a function? For example for a specific mode or action from a key binding p= ackage such as evil or meow, also i don't know if buffer-read-only have= a proper hook.
--0000000000007634490631541e34-- From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 27 11:45:56 2025 Received: (at 77224) by debbugs.gnu.org; 27 Mar 2025 15:45:57 +0000 Received: from localhost ([127.0.0.1]:50953 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1txpQZ-0004dl-J5 for submit@debbugs.gnu.org; Thu, 27 Mar 2025 11:45:56 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]:25384) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1txpQW-0004d2-Ir for 77224@debbugs.gnu.org; Thu, 27 Mar 2025 11:45:54 -0400 Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 52RFfrU0022236; Thu, 27 Mar 2025 15:45:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=SPNhtk/4c2ztjTquh+9OI4zVfA0msckLaGRz+r7m1Cg=; b= Zt+zFUleSu0zXx1/NaApPnSlCZpZ9QAu3Nc1B4QSHNrJDSgw7ONFYYliu7ntflh2 NvkEL/flTtzzmo9HIy7qJyBQpZj2mYOPPMyjXT/Zpvxvc+hDVvxZsLzyltu9QQ76 i9zh+A5a05KbguQcaFWGePfcipeRgWm5C27vQ4WnC+lkdyVvrpIyzFf1ahADDprj HCdJ+PmhFIJUX+K9ZYVDnAB6W9t14ajsOoj4zNbD3pixgYNniU3TkCYIddPV90xZ TMgc9sYS6/mkqebNBndORB1A3CqqXrc9HpKGuzF47IyAGRu+bhuD0SzRPpGWeL59 Uz/x2x05Y65bFusignx9DA== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 45hnd6cuck-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 27 Mar 2025 15:45:48 +0000 (GMT) Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 52RFVQo3028708; Thu, 27 Mar 2025 15:45:47 GMT Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1nam02lp2046.outbound.protection.outlook.com [104.47.57.46]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 45jj6vhvrb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 27 Mar 2025 15:45:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=WJI2HhSk+ew8DF3UVlbK2iptbP2CwWkHtPon780BEbYGjQf2S5wd1fE71qt0UdvX+kaO8EVTHOfBGEf9FzIuL53jTZ526ARoZI2SYkWCJxuUpfeCWb4381xbz7E6yZ/ul+hxA772kvkJ8NdUcB5w1EwfCmBTrfYTM4lo01EM8du7auuSj/qiu69eTdf+Bv2yWqdm/kldCpCTRYmRoeBdsdfm1MoAaFhVDTO71oeCpVAsnG64awcS2R0jJ1q5nJMl0EPdtCO6ASvqqArsLq37+WSRKI/Svp1Z3gDNuxC3Z1ZZ1rzrpvLK4iXIYzsc6zx9ttC+6VndmFrvaAHKSfW4VQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=SPNhtk/4c2ztjTquh+9OI4zVfA0msckLaGRz+r7m1Cg=; b=OQLUQrzf5CN1oGI+qYf7qISuHrrSRLOcueuIV2aO9g0a72FMWFOL2HZbfyo5m1AVSp/I20rEjIsrsQDxEIbpV5GJVEF8zluHEdns+4WgD6IingEWyt8k5yalksKbE3XsiL61D4T3oVZOsoLjk+Lhbh0Gqh83FT55qnLNpefwlPQylGu++RCZev34dvOPoiNgbjl3Nw/pzPckxEytIuhd+zzAvXZ7079etsnatga5kGeDVMoxs66umsghAs1sRRHPqXpPxM8RFxH0ateMCwV06AuztAlVNxXV0yYTX1/g/3R6jK/V2oPvVa+qkLNjY7FPD001Y7Rdv7gstR4EUTDRkA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SPNhtk/4c2ztjTquh+9OI4zVfA0msckLaGRz+r7m1Cg=; b=KAWzyjINm2VYA0W9m4u+wBiF8Bu+pb23nuchBAlKByMNl4E1A7wudiT5BDb2ZAopBaW887W3lXc9RPpuYaVN9s3YcVQPvV7YWrroY1NKPFWT4rC1ZBK/Rqua8t0pZQnDdGY+5pd0MpVWQg6fg220zm+Ak9F6H8FjlLNYNTsEz74= Received: from DS7PR10MB5232.namprd10.prod.outlook.com (2603:10b6:5:3aa::24) by PH8PR10MB6315.namprd10.prod.outlook.com (2603:10b6:510:1ce::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8534.44; Thu, 27 Mar 2025 15:45:45 +0000 Received: from DS7PR10MB5232.namprd10.prod.outlook.com ([fe80::8303:658f:14f8:2324]) by DS7PR10MB5232.namprd10.prod.outlook.com ([fe80::8303:658f:14f8:2324%5]) with mapi id 15.20.8534.043; Thu, 27 Mar 2025 15:45:45 +0000 From: Drew Adams To: Eli Zaretskii , "mail@daniel-mendler.de" Subject: RE: [External] : bug#77224: [PATCH] New minor mode 'cursor-indicators-mode' Thread-Topic: [External] : bug#77224: [PATCH] New minor mode 'cursor-indicators-mode' Thread-Index: AQHbnw1eQoMma3FWQ0OswldzO6qz5LOHHQ4Q Date: Thu, 27 Mar 2025 15:45:44 +0000 Message-ID: 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> <86a596d7l5.fsf@gnu.org> In-Reply-To: <86a596d7l5.fsf@gnu.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DS7PR10MB5232:EE_|PH8PR10MB6315:EE_ x-ms-office365-filtering-correlation-id: f7630142-444b-4f69-32df-08dd6d466ff7 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|366016|376014|1800799024|38070700018; x-microsoft-antispam-message-info: =?us-ascii?Q?fkdNRUZhBacVcEJGB2PsLoI3OrbK/Hmr7XZisvzaoDcG8hbugLSwyrGsdjcm?= =?us-ascii?Q?uuyDIfVlPuM3S8qWuGmPoVICETkxuzZncffYTpJHwxKJd9ycQ/jza8YdRvdl?= =?us-ascii?Q?UWlNkyRiETCewMIB4tbr78z3Yp427h3+6vQwi+G0YT3ZYr3VIaLrdw1dI8hM?= =?us-ascii?Q?XILtdl5INObf6YOxqwBbhNEzlMeJdfLg40Ux6enTuLBMII5HK1UiQ7lhgaOb?= =?us-ascii?Q?LBLKwbPUxDs4yys381uBKULoYe5gg/0qdjqz4ElPBiM0L3Bawxlwzz1AA2fK?= =?us-ascii?Q?pe4g1ESujuCMMOXPOIK9DAXM3ojjDO8pXt2sG2E86nZwDt5C/dmQ0AxsSIu2?= =?us-ascii?Q?Fbq+bv1kGgub1NhyVPzFvVGMXfvtu0GhpiebTLee86dDmRPmSeEQEandynGx?= =?us-ascii?Q?Oskie5vuk1MGSm1ldtDUtlr2S4WUCO2T5lgLINCcsL/fLE+NvVNCdCLO4H13?= =?us-ascii?Q?G6S4z9OLkkIaABw3l90CvVfFGKbInrrpxvbg4lFZJ37SvdCrp5RGrUbIBaoa?= =?us-ascii?Q?Y0z20Wh1QHWCTwBI0x0IDCH2q5BSTwAKq0L+QSrljCnSB89w8asIjAJ8s3qP?= =?us-ascii?Q?+IjG36Y0C56Gl38MBbRQJNtlfpT0H9uxVqAmq9xnxv8+KDHKvFV7mMW+46mC?= =?us-ascii?Q?KFqGCe1BxYdLWLNgad3iU8wevk0GroNCgq3ad4LfNR1cWoRLsP1nSIjVUN3i?= =?us-ascii?Q?ErAllgO5YiW8hEdkUbjN4DVA31KrP52FcxgmtzRiTn51+/KLJWZYH8mOD60F?= =?us-ascii?Q?vha7pk0kVEazsaUVYJPxlMpyyFGJi4cxO/RFsus0RLwyz3Vi9Vz4pSP8MAzN?= =?us-ascii?Q?OlINf9YGOxoqNo+xrVkemz6KRrvS4eAEairGjBOc3dM0q07oLnG1sYGSlXAG?= =?us-ascii?Q?VqnGV3It7qa2zbLwfvYdrv5e93cAAgD3PQoiy0aXfk3JU9efmboajoY3MoEK?= =?us-ascii?Q?bjsoEYFG8JLFr5tbth0TAqyvF84+ycT7P4yPBCrwN/MQ14S1CyFLYxnICRNZ?= =?us-ascii?Q?JJ1QNPZWuQNt5P6+zYC/vEq1ztUZbcJKpuNiiscMwcpH2wse989akyklhdod?= =?us-ascii?Q?birpVTf1sRurpj7hzRXXe61K64w+JOdMogQHdWaE4hwAhHl4DqGpeEtA77w4?= =?us-ascii?Q?eAtf3XUrJbB1CZZVwNnL2ZquQ0mgLGNFmgpaXElYdfgTsDBCkIjFb5w055gV?= =?us-ascii?Q?qE3VhzZ+zTIcxLataC2l/XOqx6jffdInerMnYk1y9k7n3eTBA1EVWeT6C2z2?= =?us-ascii?Q?TA3WfhFN84chPw/WPKxeH2B4elqyGXcW+ujEkzCffE8iAazGaQT3N9q0Mudb?= =?us-ascii?Q?9G0syFrvk2ZLTk8lxHRWsIjFAH0cQLW9iODxvWTSsPDavqrIouXs+jZbuzTJ?= =?us-ascii?Q?tAe6CTEOTY3j4TT1YjiHhSnFHtgpj+wfvTDEWzn9OqJHYAXxuQ=3D=3D?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DS7PR10MB5232.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(376014)(1800799024)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?/Ms/TAy+MeK4YuND5+Peop+BkQVJWIWg4LL0iWcrD40Y93ceFQR9sRUKiXjX?= =?us-ascii?Q?z/oc+u4lOrt6BlsABDiSteijRZVfoSQlXBlTR9pT7wzn7uqwmPNgks1icrTs?= =?us-ascii?Q?yTKObszVRdYllSLgDt4s8iwGovoS+IS+QwnlbWFU1KVeCYJhk2hbzOkoEBWN?= =?us-ascii?Q?MdH5bCU/QAk/HAJUzlwpr7cmJgClZsmhBSmkOaK+16JGlGVnKpaIgMP4Sy8l?= =?us-ascii?Q?Mh89Hui3VzRmICyX9SGTUIC/hloaWxGIj0PfTVLoEBtt8wCDzbjos/OUlIeR?= =?us-ascii?Q?slSwmiK3TJuOGtcnqKMjq1w+KHaisnT5oHH+UqYvVUigjwCoAOEUx/4iBL/6?= =?us-ascii?Q?cxjAxv+0/5yCbREk3bfo4VDvzkbnAKhLrUvUjzBs8uEwd3gyOd1lpTv22pXP?= =?us-ascii?Q?lsuLu4/SURuN8OLPSPKhu42E7nX3YCXm7DcfdTrYrwGyAEOqFoYaWpfiULq5?= =?us-ascii?Q?U5qR6gV4rNGP/MX8vAFBq9o6JNKfTfTEynSvoCXqHup56BsDrfqm6x8CDSZY?= =?us-ascii?Q?JhB6VBHT4NdM5HY5bWtN3/VLdYKWTSH+R05UriAMQcn3WA8eZc4aErCieYYa?= =?us-ascii?Q?E9/xETakUcxrlx8FANfnNUuVPsDjCidqx/AklmA9v0KM7XXRaAJIY3P5R/oU?= =?us-ascii?Q?4XRnhigsTFz4iYBzOxYyWONjNKpOTDCUUVQrFmUnV7M8TshUHt5FxJCtHb8C?= =?us-ascii?Q?9k5ItMmzwQBoa/i5ugNbi0CsRXhuZle3CuJNG9riX5oRcRP4TOJ/dXHQpSCw?= =?us-ascii?Q?cukX/R51/VD2KLx917kfbBIUBrR76PlMu/00kRK1p6cGZnwo9IDJPDz7hXM9?= =?us-ascii?Q?n+PfZtUk5C4//egUDwc89E/vXtaDu72UmX8bQ0EQgrqEl2TKhACe/G/3NLGb?= =?us-ascii?Q?3W39qleI7m6OkRm+ifx6s6hOnCpZsTm06xtVBZMiaO6Po7awiVQ80ePv6OKp?= =?us-ascii?Q?grlG0/WVzbPrxgCpAt12B9p9OhJOYvnOmSRxqDqGiAAH1g6clDl/8vTkgGkK?= =?us-ascii?Q?4UQJzkdD4X6U+0sBPe0aNgUCoDhsVxUIwzKoXkkehuB2kUj+5ygZVFyWOIB6?= =?us-ascii?Q?sEB26zx02g3q/Q9R1PJPwKiXohl3y2Cm47Q9KuJTv95CUlKp003gNUjHeZSr?= =?us-ascii?Q?9kynTId+pFUKcojA0Z10iDsmIcNln5uoc4rIe34ZqZG7h8vpbwOTDFLHmoa/?= =?us-ascii?Q?cX09+y/8Nhp5cw9m9p5ZC6+ljq3B54Z0dzm+o0eGpJutSDbIPK1lYuLUGnmi?= =?us-ascii?Q?TMeuy9F8ffuNEMy8Pcnu8B/Whg5xzePM5c4NTH8vBkQW3Efi0SbgPF5pDHcP?= =?us-ascii?Q?xFI6tDd1Wp6DKjXajIH3TkzE40g/mVDedzbK37Bbgdi/HYxF5qvUjs2kdMfn?= =?us-ascii?Q?k0ApTzzwUPJuHYOV6c7ax9XWfOkiLnPqKvPG2NphqS0cZbVTNF7O8RE5cdAT?= =?us-ascii?Q?gY3hx8nGnk0igZpGrlKLJgiTVwDIuEEtGzrv3NeQWPkx49Qu2MO5o4uMZuUJ?= =?us-ascii?Q?fioD33bW4Q2E47fQrcAp6uyTfdHWokakiFnni6If8bX7lYeXTvfwf9+TAzK4?= =?us-ascii?Q?DFT8LswsjhkMh4Eaj5LxTykwRtHAYsT3coVNVy8R?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: UbeUEXNq6JjQ2hDBwEhBgiGRhqw5p2FZwK5MYFlnL9SodATrXNurV2LyycgzAkSGOe8bsgJuX+oTphDvBYZr2fABGXk9DG3I0MHhTOAR216KJRVyPohuHQT6ZYHoeuQl0j8VONV0gkQ4XsxzDGDCZfsf7s7iKfjqYtLOvwV+RVuIq76jHiJEwFdaMbvrNKkCBYCWvAznvE6IAZzQMgCpyWy0YzeSnzm8weyp+Yw+WcQvPIusEBxqnt8NhwnmtRTCfvXA/wqtx3Xsf74tg2CR2E3sjU1lxS8yKxj258leW5qRuAAZDzMwY2X/p7vg/LGiL1N8zglfpeBMO04jPBLN478TUaZf3WboHK/+6xFKr0Oxpot9myjMJdBU0qivi8PA3Z2bRwtq2o6tEllD9DIAB4LDA0juFOg/H+4m3WWvQggPZM1WDbUJCFmtz8wGHZMYHr4/zHvk3eGg3c0gFHOzSqD2g2+e61iFvEBuxG7Acn0mK5mB6gXOG3BwkPF6rOBAfJY8ts5TXG1GwMYdcI2JdweeCbDCFHKuLPPeNcx63wQ777T8VASRzj+m9qyIn9kS/vr8P2Q6fVFB2Ml3rtOkP2Ipva9Vh2XJZ9mvsbQjJjA= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5232.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f7630142-444b-4f69-32df-08dd6d466ff7 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Mar 2025 15:45:45.0012 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: ACKzeG7ruEPCmn+q96IlmNETiWV3yds50zZVORYcH2EJ3hSaB/P7buDLI/93PjK6glOsQxjyalsEYQbXWmcRsQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR10MB6315 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1095,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-27_02,2025-03-26_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 bulkscore=0 suspectscore=0 adultscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2502280000 definitions=main-2503270107 X-Proofpoint-ORIG-GUID: 95xZM2sZEUf8X-pHmg-UDOVqOOnVsWW- X-Proofpoint-GUID: 95xZM2sZEUf8X-pHmg-UDOVqOOnVsWW- X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 77224 Cc: "77224@debbugs.gnu.org" <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 (-) > > > I see your point about sluggishness and I am very careful myself to n= ot > > > 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' i= s > > > 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. >=20 > Btw, a possibly even better way is to modify the cursor looks from the > hooks of the relevant commands, like overwrite-mode. If some of them > don't have a hook, we could add a hook. This is better because it > doesn't unnecessarily "punish" Emacs anywhere else, only the commands > that could affect the cursor. >=20 > Does this make sense? It does make sense, to me. However, FWIW (haven't read all of this thread): Based on input from Juri and others many moon ago, library `cursor-chg.el' = has used pre(post)-command-hook since 2006 to optionally change the cursor = shape for overwrite/read-only, idleness, and/or use of an input method. Min= or mode `change-cursor-mode' does all but the idleness, which is done by `c= urchg-toggle-cursor-when-idle'. I agree with the general motivation not to overuse pre(post)-command-hook, = but FWIW I haven't noticed any problems with the use made of it in this cas= e. https://www.emacswiki.org/emacs/ChangingCursorDynamically https://www.emacswiki.org/emacs/download/cursor-chg.el From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 27 12:02:51 2025 Received: (at 77224) by debbugs.gnu.org; 27 Mar 2025 16:02:51 +0000 Received: from localhost ([127.0.0.1]:51002 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1txpgw-0007O9-SA for submit@debbugs.gnu.org; Thu, 27 Mar 2025 12:02:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56028) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1txpgs-0007ML-OY for 77224@debbugs.gnu.org; Thu, 27 Mar 2025 12:02:49 -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 1txpgl-0000tK-CO; Thu, 27 Mar 2025 12:02:39 -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=eQ0A8T3tuUHH5vv5sxh+XiUZUo/KqoyVsXSAgiq6vSg=; b=ZffZNs7Xt0D0vQLOpp1e 9nzEfbc5kiF0Q+IZt1nndGdF98CLYamMwFlbQQeD30xVhkVez/77NXnMrLXfhFAV9e6Us7ykDNjBQ XVve656t9frUatqrzQMUFPgl3PwZHneciuDD4bWUjjg1s+on0+9i+aHXnWPBcxQRAf9qNOnE48Nf7 eibvcJwu7Os7ExG39znxcr+R41VzXe1x9/DlH1+1ZSmKu7c8uc+HHEVXvC2O9aUIjNI21rlzXTSF8 WnNQktRU6xe0fYVej3Pa+DbMCseMOJl6YPM9YTKtr0GQOzCg7fUAPAWFYS0KPIXCUUGtBcI3+BrAi patHfGsMKwD6Eg==; Date: Thu, 27 Mar 2025 18:02:36 +0200 Message-Id: <86y0wqbgwz.fsf@gnu.org> From: Eli Zaretskii To: Elijah Gabe =?utf-8?Q?P=C3=A9rez?= In-Reply-To: (message from Elijah Gabe =?utf-8?Q?P=C3=A9rez?= on Thu, 27 Mar 2025 08:53:25 -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> <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> <86a596d7l5.fsf@gnu.org> 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: mail@daniel-mendler.de, juri@linkov.net, 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: -3.3 (---) > From: Elijah Gabe Pérez > Date: Thu, 27 Mar 2025 08:53:25 -0600 > Cc: mail@daniel-mendler.de, 77224@debbugs.gnu.org, > Juri Linkov > > Eli Zaretskii writes: > > Btw, a possibly even better way is to modify the cursor looks from the > hooks of the relevant commands, like overwrite-mode. If some of them > don't have a hook, we could add a hook. This is better because it > doesn't unnecessarily "punish" Emacs anywhere else, only the commands > that could affect the cursor. > > But what if user prefer using a lambda instead a function? For example for a specific mode or action from a > key binding package such as evil or meow Sorry, I don't understand: what lambda? Aren't all the modes you want to catch normal minor modes with a hook? > also i don't know if buffer-read-only have a proper hook. read-only-mode does have a hook. From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 27 12:04:25 2025 Received: (at 77224) by debbugs.gnu.org; 27 Mar 2025 16:04:26 +0000 Received: from localhost ([127.0.0.1]:51006 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1txpiQ-0007bS-Jz for submit@debbugs.gnu.org; Thu, 27 Mar 2025 12:04:25 -0400 Received: from server.qxqx.de ([2a01:4f8:c012:9177::1]:53067 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 1txpiM-0007Zh-I3 for 77224@debbugs.gnu.org; Thu, 27 Mar 2025 12:04:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=daniel-mendler.de; s=key; h=Content-Type:MIME-Version:Message-ID:Date: References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding: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=tqNVSYAhp3jy8ZjzelE5xoiWFxuzfkLq8XYxG88famM=; b=Wwo28GNR69lR/IPoTw6hywWdOM 1pDC9hDLNWLlaH44+TkqYVtUyYQz1C5mTuLZd3kpGwX2H4+mnN+RUoG07E/k+PvIhZK7uOOdG85QL hcuE/85m4I/x96gFWu7kF6NGEMKznChYQ4J7aWvDK1g0CJt7edPtte00oI07ils9rlb8=; From: Daniel Mendler To: Eli Zaretskii Subject: Re: bug#77224: [PATCH] New minor mode 'cursor-indicators-mode' In-Reply-To: <86cye2d8t6.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 27 Mar 2025 13:14:45 +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> <87h63ekdxe.fsf@daniel-mendler.de> <86cye2d8t6.fsf@gnu.org> Date: Thu, 27 Mar 2025 17:04:09 +0100 Message-ID: <87a596a29y.fsf@daniel-mendler.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain 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: 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". There is a difference. When Emacs executes a command and hangs during command execution it is expected that the cursor does not update immediately. The cursor will however update after the command has finished. The commands which we talk about regarding cursor changes are usually executed quickly, like enabling some modes like `overwrite-mode'. >> > 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. No, 50ms are not acceptable for the user if they except an immediate response to a key press. I have seen bug reports to my packages where people complained about latency in the range of 10 to 20ms. The problem is also that idle timers are not bounded. If the user continues on typing, Emacs won't become idle and the cursor can change much later. This would look like a bug then. Again - CUA also used a `post-command-hook'. Why not preserve this, given that the mode is essentially extracted from CUA where it works well? I see your point about using specialized hooks though (e.g. `overwrite-mode-hook'), but this will make customization much more difficult, and for some variables there might not be a hook. Regarding Emacs sluggishness, the `cursor-indicators-mode' is an optional mode. If it increases sluggishness unnacceptably (which it won't), users can turn it off. Daniel From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 27 12:30:19 2025 Received: (at 77224) by debbugs.gnu.org; 27 Mar 2025 16:30:19 +0000 Received: from localhost ([127.0.0.1]:51059 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1txq7W-0002jP-H4 for submit@debbugs.gnu.org; Thu, 27 Mar 2025 12:30:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60276) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1txq7P-0002di-GA for 77224@debbugs.gnu.org; Thu, 27 Mar 2025 12:30:15 -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 1txq7H-0004sB-Rf; Thu, 27 Mar 2025 12:30:04 -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=cdG6dQqrFyPHrvjwgNRpqc6ZxyLSNFvWzUQoLWz2L4Q=; b=FluXTE3d9E6m Mn6mxFFjDAeAXjLAJjlf9y3t3YP38Kkz7NsqqAITxQyXpMFyDuz8rrlok2g+7SbAeabngYJ1b6leS Ed3GU5xc2KFIItDpOBDg3nLxzo9rn6WscGjVsar6jQwnX7Sq5HvONISWaS8EN8HRP7qBW5u5btE5f Cu21xZT9Qn4NlFZvSi6lboAaK9RTu+OcLoSPH56QC3LVA/XpZJnGE3MIDk0yzJr77RafCNrJgQ5X1 C7BuzPEVLeECyu+AT0oSpcj0y1ZU8V3b4DRNUIVul/Obfn1RiCfhY0/I6XJgHt27IalFHNbC5MFYs 1tIe77RenXe2E4XqV+wnUw==; Date: Thu, 27 Mar 2025 18:29:59 +0200 Message-Id: <86tt7ebfnc.fsf@gnu.org> From: Eli Zaretskii To: Daniel Mendler In-Reply-To: <87a596a29y.fsf@daniel-mendler.de> (message from Daniel Mendler on Thu, 27 Mar 2025 17:04:09 +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> <86cye2d8t6.fsf@gnu.org> <87a596a29y.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 17:04:09 +0100 > > Eli Zaretskii writes: > > > 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. > > No, 50ms are not acceptable for the user if they except an immediate > response to a key press. 50ms was just an example, and it is actually quite improbable to be that large. post-command-hook is run by the same loop that decides that Emacs is idle and runs timers, so the difference in practice should be very small if at all. > Regarding Emacs sluggishness, the `cursor-indicators-mode' is an > optional mode. If it increases sluggishness unnacceptably (which it > won't), users can turn it off. Experience shows that many users turn on a lot of features which rely on post-command-hook, and then complain that Emacs is slow to respond. Telling them to turn off features they like doesn't really work. Anyway, I think making the cursor change from a mode hook is a better solution. From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 27 12:40:12 2025 Received: (at 77224) by debbugs.gnu.org; 27 Mar 2025 16:40:13 +0000 Received: from localhost ([127.0.0.1]:51073 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1txqH6-0003vO-6y for submit@debbugs.gnu.org; Thu, 27 Mar 2025 12:40:12 -0400 Received: from server.qxqx.de ([2a01:4f8:c012:9177::1]:34589 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 1txqH2-0003p3-Ks for 77224@debbugs.gnu.org; Thu, 27 Mar 2025 12:40:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=daniel-mendler.de; s=key; h=Content-Type:MIME-Version:Message-ID:Date: References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding: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=S7CASjzTyGJ5+hoYyjBAWTx6hXPwIc3E3j2BY2XgjB4=; b=NeG8sYr+y0KFd6HFaFgkFsD7wO DRv+wBdQ4KGYAeP2pXrH4Binlv9kNsN0WLuyg3i0n2XArKSgrmdcdvCNCGWGz1Oq3fMyL01SAnUsy taX64RALqCIZUe091Ma4ioVcqN13BEJAEI6TqyrET/r07TcRbIFzJ9TwVmZmRemWDd8Y=; From: Daniel Mendler To: Eli Zaretskii Subject: Re: bug#77224: [PATCH] New minor mode 'cursor-indicators-mode' In-Reply-To: <86tt7ebfnc.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 27 Mar 2025 18:29:59 +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> <87h63ekdxe.fsf@daniel-mendler.de> <86cye2d8t6.fsf@gnu.org> <87a596a29y.fsf@daniel-mendler.de> <86tt7ebfnc.fsf@gnu.org> Date: Thu, 27 Mar 2025 17:39:59 +0100 Message-ID: <877c4aa0m8.fsf@daniel-mendler.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain 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: eg642616@gmail.com, 77224@debbugs.gnu.org, juri@linkov.net >> Date: Thu, 27 Mar 2025 17:04:09 +0100 >> >> Eli Zaretskii writes: >> >> > 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. >> >> No, 50ms are not acceptable for the user if they except an immediate >> response to a key press. > > 50ms was just an example, and it is actually quite improbable to be > that large. > > post-command-hook is run by the same loop that decides that Emacs is > idle and runs timers, so the difference in practice should be very > small if at all. The `post-command-hook' is guaranteed to run after a command while the idle timer is delayed until no new events are in the queue. This is why I argue that the delay can be too large, such that it will become noticeable. >> Regarding Emacs sluggishness, the `cursor-indicators-mode' is an >> optional mode. If it increases sluggishness unnacceptably (which it >> won't), users can turn it off. > > Experience shows that many users turn on a lot of features which rely > on post-command-hook, and then complain that Emacs is slow to respond. > Telling them to turn off features they like doesn't really work. I agree that this is a problem. However in this case the PCH will not cause problems, as has also been noted by Drew and as has been shown by CUA over the years. In contrast the idle timer will cause problems. I am actually looking forward to using `cursor-indicators-mode', but if it operates with an idle timer, I don't think it will indicate the editing status reliably enough. > Anyway, I think making the cursor change from a mode hook is a better > solution. As has been mentioned, the problem is that not every scenario is covered by hooks, while the PCH is a potentially universal solution which can check arbitrary conditions. But if hooks work sufficiently well for most scenarios, then why not. I think Stefan and Juri should chime in with their experience about this, since as I've seen, they both want to replace some custom cursor code with the new mode in their configuration. Daniel From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 27 12:56:35 2025 Received: (at 77224) by debbugs.gnu.org; 27 Mar 2025 16:56:35 +0000 Received: from localhost ([127.0.0.1]:51113 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1txqWw-0005io-0k for submit@debbugs.gnu.org; Thu, 27 Mar 2025 12:56:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37904) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1txqWt-0005hy-Cr for 77224@debbugs.gnu.org; Thu, 27 Mar 2025 12:56:31 -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 1txqWl-0008FR-P7; Thu, 27 Mar 2025 12:56:23 -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=8kfbPiaBz9uv83sIjKtvBAAfzbPZvxzKeIuybSLfolo=; b=KY07OtUwa+bK nugw655xZohK+PLdYpSCVXh2QShiRok1mX2zdoEUqXbXihZkmwWF3SYU2O96pRdim4YNJL9YcC0qW nvlXsOWM7BXJlutf7Ot2wcZPRCFAye8eyEBld8MIcOmD5go9fvJ8YSZYLdJh4yRGq6t3fZ1CBz7gv sT8d0KQNHdSsV/zlDtJZabsWcvzMxpCFruwddlw6uAG5IYpfcmAYjB1b7nSul27pUOKfWMFuCfNqP wvNo01kqFQ60klvquW4y99HoNzYrDO4yRoEu/4TRZQMBj8mCyjw6KpS65Bw6cPe46kXBsIIDThqyn tEJliBqjJLKcsT/FxMbTOQ==; Date: Thu, 27 Mar 2025 18:56:21 +0200 Message-Id: <86pli2befe.fsf@gnu.org> From: Eli Zaretskii To: Daniel Mendler In-Reply-To: <877c4aa0m8.fsf@daniel-mendler.de> (message from Daniel Mendler on Thu, 27 Mar 2025 17:39:59 +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> <86cye2d8t6.fsf@gnu.org> <87a596a29y.fsf@daniel-mendler.de> <86tt7ebfnc.fsf@gnu.org> <877c4aa0m8.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 17:39:59 +0100 > > Eli Zaretskii writes: > > > post-command-hook is run by the same loop that decides that Emacs is > > idle and runs timers, so the difference in practice should be very > > small if at all. > > The `post-command-hook' is guaranteed to run after a command while the > idle timer is delayed until no new events are in the queue. No, the idle time is run immediately if there's no input. Emacs doesn't wait or delay the timer. > > Anyway, I think making the cursor change from a mode hook is a better > > solution. > > As has been mentioned, the problem is that not every scenario is covered > by hooks, while the PCH is a potentially universal solution which can > check arbitrary conditions. But if hooks work sufficiently well for most > scenarios, then why not. If there are cases that this indication supports but there's no mode hook for them, let's discuss those cases one by one and see how to solve them. I see overwrite-mode, read-only-mode, and input-method activation, all of which have hooks, AFAIR. From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 27 13:10:32 2025 Received: (at 77224) by debbugs.gnu.org; 27 Mar 2025 17:10:32 +0000 Received: from localhost ([127.0.0.1]:51136 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1txqkR-0007Ar-L8 for submit@debbugs.gnu.org; Thu, 27 Mar 2025 13:10:32 -0400 Received: from mail-oi1-x243.google.com ([2607:f8b0:4864:20::243]:61697) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1txqkA-00072Z-Qb for 77224@debbugs.gnu.org; Thu, 27 Mar 2025 13:10:18 -0400 Received: by mail-oi1-x243.google.com with SMTP id 5614622812f47-3fa6c54cdb2so830183b6e.3 for <77224@debbugs.gnu.org>; Thu, 27 Mar 2025 10:10:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743095409; x=1743700209; 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=pAr6HuZ30kpTiC+9rOTNNmm0ucFxb+umdhduVcSEUZo=; b=f8snBIGeDkt297uqb/rPR9PRHo7D31XxSTKXfa5VgTZHAMW3/wrpMvbg4k/iuLwnQK +Uo4ofkFmnK95gbOAh2ZKa+uTwREefHEc6JaBVUJILEjmJOO3+slaSxGwNoRtRyN1JrL eQ7kr7pwCGwRWwdOLBI8diZeFrr+DsLSopZTjI95jtLVbGHA1qsijADEr7qIq5+k+w6i 2cZZjILzRZwvB0mZ7bzAHMxZgxkT9gUFBGfubsdfbBhU07wIL+R6IXi7VbY4UhvY1oti +Sx5BY04erQnopf2rizhLz+u9MGYKWtrTBmZdWAL7Ru049IxzvcA5gabj4lLqe2U5XbR EdTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743095409; x=1743700209; 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=pAr6HuZ30kpTiC+9rOTNNmm0ucFxb+umdhduVcSEUZo=; b=mNJ9cHnLNMfC5EKaNTC9/K9DWnzr2T4uliBNHbozAJ+Go0ALcGBtQHA6Ml8Qhp2zqb xpzjxUJWFlLpc2GEfi4AqeX7ZeU46QlpM1enoX2T2lrMk3pyGD0ndHX+Ph4cK55hBbtl 5lomvWm3vvBTgDd8NgMcmN4Aa4j71NKbDD6Qq6SthDUHcwBsISzbC2+eT5J33xeSgCfH N6IG36WpUuO3JoYHmrrmkdTJ5JH7rCR0OYu5752kNS82mhDR2V8VXJyx/dy0yMWvf9+a QZSxXeWKJdyHv38eKqsRCbI7DleNiBbdPeNbY1l/gbteevmJ/FZeKZh4mPkp4UoUa/vU fCyg== X-Forwarded-Encrypted: i=1; AJvYcCVug1Ush69APpRS8L0EBGApIwCqXn5KHCisLRGwNcM8IuHXqrxSJMgjwH18DhY0rByDNVPv/A==@debbugs.gnu.org X-Gm-Message-State: AOJu0YwnevfTu8vgGC7U9NPk0GefITCl7ZFwmeuns97Q3eagYljPIpI1 tTPJ+15cHQ72jHM8RLPt4zOubwYViMChKo40ItWM4oNB1K6PdaoKlMAuQj5H X-Gm-Gg: ASbGncs0+0RTIWEjoFAnfbhfZ991Cuj2YD1g31YtnMHGMsSJVdWHHL8+W/k2hkESYTt R2BeTxDYOgqmdUz8l9zGujf+ZGAzVz9HxVRNPoyUUiGcD79JYsfr9sM80f+tIUDvs5aYl8nmmeW 6r7JrHekNmXN9Fsbbm9Ws52VwFLxKvSF1Ly4GFg3zZRNC9TGd5tKTXAF5j8k0zRRSN7WOstIU7z i6WK6/tMFZ7DubfHNwLKRKNk/UCtGnpSQmH3/qth1JifBjnfJJudPcSHpVi9r62GCrviOInKJfk GxFLz2ES4wno X-Google-Smtp-Source: AGHT+IHwI/W/0AuTPfJXVTqTJDUtEUBjkly3f31RPEY1A2FcibWKcA1SEFXPC2gUzutwUlHPJWNv0Q== X-Received: by 2002:a05:6808:1694:b0:3f7:d16c:e283 with SMTP id 5614622812f47-3fefa5248c0mr2566957b6e.11.1743095408533; Thu, 27 Mar 2025 10:10:08 -0700 (PDT) Received: from fedora ([2806:10ae:e:5fce::1]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-602845008c9sm26043eaf.10.2025.03.27.10.10.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Mar 2025 10:10:07 -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: <86y0wqbgwz.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> <875xjvcn4o.fsf@gmail.com> <877c4b81nk.fsf@daniel-mendler.de> <86ecyidg2d.fsf@gnu.org> <87h63ekdxe.fsf@daniel-mendler.de> <86cye2d8t6.fsf@gnu.org> <86a596d7l5.fsf@gnu.org> <86y0wqbgwz.fsf@gnu.org> Date: Thu, 27 Mar 2025 11:10:06 -0600 Message-ID: <87zfh6z9g1.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: mail@daniel-mendler.de, 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; charset=utf-8 Content-Transfer-Encoding: quoted-printable Eli Zaretskii writes: >> From: Elijah Gabe P=C3=A9rez >> Date: Thu, 27 Mar 2025 08:53:25 -0600 >> Cc: mail@daniel-mendler.de, 77224@debbugs.gnu.org,=20 >> Juri Linkov >> Eli Zaretskii writes: >> Btw, a possibly even better way is to modify the cursor looks from the >> hooks of the relevant commands, like overwrite-mode. If some of them >> don't have a hook, we could add a hook. This is better because it >> doesn't unnecessarily "punish" Emacs anywhere else, only the commands >> that could affect the cursor. >> But what if user prefer using a lambda instead a function? For example f= or a specific mode or action from a >> key binding package such as evil or meow > Sorry, I don't understand: what lambda? Aren't all the modes you want > to catch normal minor modes with a hook? Not only minor mode, also functions (function symbols or anonymous ones). for example if user wants to change cursor appearance if a text at current cursor position have an overlay or whatever, can do it defining a function in their config: #+begin_src elisp (defun my/cursor-change () (string-prefix-p " *" (buffer-name))) (setopt cursor-indicators-conditions `((my/cursor-change hollow "yellow"))) #+end_src or #+begin_src elisp (setopt cursor-indicators-conditions `((,(lambda () (string-prefix-p " *" (= buffer-name))) hollow "yellow"))) #+end_src The current code only check if symbol is a variable or a function symbol (since minor modes also defines a variable with same minor mode name) or a lambda, and it must return =3Dnon-nil=3D. --==-=-= Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable

Eli Zaretskii <eliz@gnu.org> writes:

From: Elijah Gabe P=C3=A9rez <eg642616@gmail.com>
Date: Thu, 27 Mar 2025 08:53:25 -0600
Cc: mail@daniel-mendler.de, 77224@debbugs.gnu.org,
Juri Linkov <juri@linkov.net>

Eli Zaretskii <eliz@gnu.org> writes:

Btw, a possibly even better way is to modify the cursor looks from the=
hooks of the relevant commands, like overwrite-mode. If some of them
don't have a hook, we could add a hook. This is better because it
doesn't unnecessarily "punish" Emacs anywhere else, only the commands
that could affect the cursor.

But what if user prefer using a lambda instead a function? For example= for a specific mode or action from a
key binding package such as evil or meow
Sorry, I don't understand: what lambda? Aren't all the modes you want
to catch normal minor modes with a hook?

Not only minor mode, also functions (function symbols or anonymous ones). for example if user wants to change cursor appearance if a text at
current cursor position have an overlay or whatever, can do it
defining a function in their config:

=
(defun my/cursor-change ()
  (string-prefix-p " *" (buffer-n=
ame)=
))

(set=
opt cursor-indicators-conditions `(<=
/span>(my/cursor-change hollow "yellow")=
))

or

=
(setopt cursor-indicators-con=
ditions `((,(lambda () (string-prefix-p " *" (buffer-name))<=
span style=3D"color: #bd93f9;">)
                                        hollow "yellow")))

The current code only check if symbol is a variable or a function
symbol (since minor modes also defines a variable with same minor
mode name) or a lambda, and it must return non-nil.

--==-=-=-- --=-=-= Content-Type: text/plain -- - E.G via GNU Emacs and Org. --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 27 13:46:45 2025 Received: (at 77224) by debbugs.gnu.org; 27 Mar 2025 17:46:45 +0000 Received: from localhost ([127.0.0.1]:51219 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1txrJV-0005Og-1R for submit@debbugs.gnu.org; Thu, 27 Mar 2025 13:46:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46028) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1txrJS-0005O9-P2 for 77224@debbugs.gnu.org; Thu, 27 Mar 2025 13:46:43 -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 1txrJL-0006uB-NS; Thu, 27 Mar 2025 13:46:35 -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=5N86iZ5fOdK8Lx8vSj/fBLDvm5W9W4ICwgDg5QsJF9M=; b=RIcfGl1CYrKr9qVSSmoC z9ubBfwVmxEPlnw/ZSRx/C8d4V6080vbSKfOFaV/UaAV8QawijIVfDflM764ir5MxYVWlz0LAUjja TFqI+bRQKqbH4wyKCNJ7OTjYdfwDBbS/o4y5X8OMA/tgbJTp+710lLeSuc89AHeP50Kumw/DMsNfg 53qK21bv+tu2GRM+MQmkj/2iyAdupAS6QEN+5dJVvjKV6bbcmfZCu4kLo9X6uNUKOsS0Wa0wnwiQN ChqsJrtg8lp/ZsYxLj5WIx00ruq+OIem23/pjqQV7Rq3++lVyWm0R7To/iRNJPZo74i9YoXqOnAL5 +zP1oA5q4sPhfA==; Date: Thu, 27 Mar 2025 19:46:34 +0200 Message-Id: <86msd6bc3p.fsf@gnu.org> From: Eli Zaretskii To: Elijah Gabe =?utf-8?Q?P=C3=A9rez?= In-Reply-To: <87zfh6z9g1.fsf@gmail.com> (message from Elijah Gabe =?utf-8?Q?P=C3=A9rez?= on Thu, 27 Mar 2025 11:10:06 -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> <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> <86a596d7l5.fsf@gnu.org> <86y0wqbgwz.fsf@gnu.org> <87zfh6z9g1.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: mail@daniel-mendler.de, 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: -3.3 (---) > From: Elijah Gabe Pérez > Cc: mail@daniel-mendler.de, juri@linkov.net, 77224@debbugs.gnu.org > Date: Thu, 27 Mar 2025 11:10:06 -0600 > > But what if user prefer using a lambda instead a function? For example for a specific mode or action > from a > key binding package such as evil or meow > > Sorry, I don't understand: what lambda? Aren't all the modes you want > to catch normal minor modes with a hook? > > Not only minor mode, also functions (function symbols or anonymous ones). > for example if user wants to change cursor appearance if a text at > current cursor position have an overlay or whatever, can do it > defining a function in their config: > > (defun my/cursor-change () > (string-prefix-p " *" (buffer-name))) > > (setopt cursor-indicators-conditions `((my/cursor-change hollow "yellow"))) > > or > > (setopt cursor-indicators-conditions `((,(lambda () (string-prefix-p " *" (buffer-name))) > hollow "yellow"))) We have buffer-list-update-hook and window-configuration-change-hook, which I think should cover these. From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 27 14:00:16 2025 Received: (at 77224) by debbugs.gnu.org; 27 Mar 2025 18:00:16 +0000 Received: from localhost ([127.0.0.1]:51252 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1txrWZ-0006iU-RP for submit@debbugs.gnu.org; Thu, 27 Mar 2025 14:00:16 -0400 Received: from relay1-d.mail.gandi.net ([2001:4b98:dc4:8::221]:44827) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1txrWW-0006bG-Jg for 77224@debbugs.gnu.org; Thu, 27 Mar 2025 14:00:13 -0400 Received: by mail.gandi.net (Postfix) with ESMTPSA id 860164433D; Thu, 27 Mar 2025 18:00:03 +0000 (UTC) From: Juri Linkov To: Daniel Mendler Subject: Re: bug#77224: [PATCH] New minor mode 'cursor-indicators-mode' In-Reply-To: <877c4aa0m8.fsf@daniel-mendler.de> 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> <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> <87a596a29y.fsf@daniel-mendler.de> <86tt7ebfnc.fsf@gnu.org> <877c4aa0m8.fsf@daniel-mendler.de> Date: Thu, 27 Mar 2025 19:45:56 +0200 Message-ID: <87semywfkr.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: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduieeltdejucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufgjohhffffkfgggtgesthdtredttdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucggtffrrghtthgvrhhnpeffgeetfeevlefhleejfeeuheeiudeitdffhfdutdekfeffgffhveehteegueekheenucfkphepledurdduvdelrddutdehrdduudejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepledurdduvdelrddutdehrdduudejpdhhvghlohepmhgrihhlrdhgrghnughirdhnvghtpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhgspghrtghpthhtohepgedprhgtphhtthhopeejjedvvdegseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtohepvghgieegvdeiudeisehgmhgrihhlrdgtohhmpdhrtghpthhtohepvghlihiisehgnhhurdhorhhgpdhrtghpthhtohepmhgrihhlsegurghnihgvlhdqmhgvnhgulhgvrhdruggv X-GND-Sasl: juri@linkov.net X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 77224 Cc: 77224@debbugs.gnu.org, Eli Zaretskii , 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: -1.0 (-) > I think Stefan and Juri should chime in with their experience about > this, since as I've seen, they both want to replace some custom cursor > code with the new mode in their configuration. I tried the patch with 'run-with-idle-timer', and even the delay 0.1 is noticeable and causes the feeling that Emacs became sluggish and can't update the cursor immediately. So I'd prefer to use 'post-command-hook' that updates the cursor immediately. I already used this for many years, and there were no problems. As for adding more specific hooks, this is not simple to do since the cursor color depends on the current buffer and should be updated every time after switching to another buffer. And even with adding it to the display-buffer hook the complexity will explode. From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 27 14:25:13 2025 Received: (at 77224) by debbugs.gnu.org; 27 Mar 2025 18:25:13 +0000 Received: from localhost ([127.0.0.1]:51296 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1txrui-0000d6-Ht for submit@debbugs.gnu.org; Thu, 27 Mar 2025 14:25:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50338) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1txruf-0000Xe-Dc for 77224@debbugs.gnu.org; Thu, 27 Mar 2025 14:25:10 -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 1txruW-0003Zw-12; Thu, 27 Mar 2025 14:25:00 -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=/uY1ow7ciAcJS2pWCJSW2/WMIkpzuAULx2KcjhFhuCo=; b=QdeiTD0bMbgp 11FM7KAkWcSB+uaZMzOQukyYG6Ro/whNbJJSJXDtbYuQ2zWKL9TRgn5E3r3DvU4aQKERrFm64iOCD 8ioAT4xaUzJPUUaL4mcGeMk3Hql63vO2sUMa8OlnHLlFgAYpwhQqhSrRJHvdDMWqB0fn402rtloQm U+EJPpoYqA8aNFBCetfV1LVbuHgLmMmtUImV8fVvKsnvtHNOrLhvM3kG868NNbHishOrJwCZGMn01 VVoPaaKPUhDES5vNL1VQdc478zN5hxNHTVweTN5+/hLdKv3gbhGhFOsl1tpzG6ZwObIqqSN50vIoo ZdBa6SetNLGFMcqF0feJZA==; Date: Thu, 27 Mar 2025 20:24:54 +0200 Message-Id: <86jz8ababt.fsf@gnu.org> From: Eli Zaretskii To: Juri Linkov In-Reply-To: <87semywfkr.fsf@mail.linkov.net> (message from Juri Linkov on Thu, 27 Mar 2025 19:45:56 +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> <87a596a29y.fsf@daniel-mendler.de> <86tt7ebfnc.fsf@gnu.org> <877c4aa0m8.fsf@daniel-mendler.de> <87semywfkr.fsf@mail.linkov.net> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 77224 Cc: mail@daniel-mendler.de, eg642616@gmail.com, 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: -3.3 (---) > From: Juri Linkov > Cc: Eli Zaretskii , eg642616@gmail.com, 77224@debbugs.gnu.org > Date: Thu, 27 Mar 2025 19:45:56 +0200 > > > I think Stefan and Juri should chime in with their experience about > > this, since as I've seen, they both want to replace some custom cursor > > code with the new mode in their configuration. > > I tried the patch with 'run-with-idle-timer', > and even the delay 0.1 is noticeable and causes > the feeling that Emacs became sluggish > and can't update the cursor immediately. What about the delay of zero? From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 27 14:27:33 2025 Received: (at 77224) by debbugs.gnu.org; 27 Mar 2025 18:27:33 +0000 Received: from localhost ([127.0.0.1]:51315 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1txrwz-0000n6-Db for submit@debbugs.gnu.org; Thu, 27 Mar 2025 14:27:33 -0400 Received: from mail-ot1-x341.google.com ([2607:f8b0:4864:20::341]:61825) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1txrww-0000mp-FN for 77224@debbugs.gnu.org; Thu, 27 Mar 2025 14:27:31 -0400 Received: by mail-ot1-x341.google.com with SMTP id 46e09a7af769-72c03d237a7so609844a34.3 for <77224@debbugs.gnu.org>; Thu, 27 Mar 2025 11:27:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743100044; x=1743704844; 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=y/7u6oSjsS9xyxdFZ8ZUEQXgnfOIkPtylYGI6tvkwpk=; b=JQFf8ELj+wBNHHgaqXGHasAbWAOULCNYu5OcYDHAYTL6C1zzs7T6whPxtc9AZ3oLJ5 bTHktB50lqzBNR3IsnPsI/KkmtSU09d0kuquAouKFd1d+fHrjBiUM8ZHZljrTXdBE6KY L4NfYjGgJ5MpeFwGIuoXuP25vt8gJNrwuSHvaRgvcqmcDvJcb3e1RrNxPSczv1k+FtPI dyrcrLvV7kzdOaOoYCbJOOpiXqPC4wXB1wy/ke+NNNhf81q/ahTCJa+696BrNm8rITsp vsD8tTE0HEJwEGaC6aNJxOshY0PcdXxmvMpweVgIKnJLdd6CkjJwPOOqTEwFHN111lLV qdvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743100044; x=1743704844; 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=y/7u6oSjsS9xyxdFZ8ZUEQXgnfOIkPtylYGI6tvkwpk=; b=sgy7Z4I1rk/yiQjYjvp0yVwKhUdfONHS1WA6Qy2Z2uckUK/4zclAfk2AWzUCtdKa8o bE/SL4jCOddAFBMLHD69E88WX52mV2fvadqsbUXGAudn2MDlah3LBUgKS3/tQgXi2nzq C1TDt6fESfQwT/osxbjjsmRREMEYD4cUyWjBOeew/lmRE9fnf0RBZzWbTZKDYrlu5BHD G52hPb34cMDf7j5bagIUIMgacSZJ3Ne+MXwGdTDFubDva2jT02chUAunM4v934vBuXcp 3LGWorKG+AX2agPPGvIci8J4YCttHkKJFZ9QK/ahwYwn00fUxIBqt4WYpLd4M5yIPxM5 JNVw== X-Forwarded-Encrypted: i=1; AJvYcCXjmRJfH+KREVqn6Zq1vPwaSeCMtsLXiyoh2xvt3PLRcw6l4rUWawI1sMhk7Qiv+Vx6bBBXfQ==@debbugs.gnu.org X-Gm-Message-State: AOJu0YyFz0ZuUicEkV5FRtvvnCMOw0L7nv1IX/t0a6bzPdK9S5FRrVva hKB9RkHMd7MBSm3h2W/jemNivx6Xy8iZdEWlrLqb930aHwkqvtL1N95Wt/4t X-Gm-Gg: ASbGnctMNqnJMphztQeJZqqTJwSR7fILpz2d7d+JRfXHYSqoiBGZQWUrWSccZXR/hpj 2k6072IJ8yf92OxbGr4H9E8c7Q8DRRmju9tTWt1npmIJf1RGlYM8/VrcxQiKNJ8lERz4iYz8Nmh TFW8ukICncHFH19brITRBR+AKR6ga8Z473OJVorapyxBhAVFrydux5Sn6dv5t3ge70r/ex/QuJM JYy+wcJg8jhlayQglwA2GFjPtndomszGWjhE6ArLagXvMOSncIznPvAoXohL48sFyYWzmcs791j WpnmkZUWP0wX X-Google-Smtp-Source: AGHT+IHeXC9tzsASZ/kNhKdvEW3rQ4u5thPQH9+2XEi7kni0QJKSB5HBANUju9c8pOUfQjN5CywapQ== X-Received: by 2002:a05:6830:d15:b0:72b:872f:efc8 with SMTP id 46e09a7af769-72c4ca44954mr3689117a34.24.1743100044178; Thu, 27 Mar 2025 11:27:24 -0700 (PDT) Received: from fedora ([2806:10ae:e:5fce::1]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-72c58267f54sm78126a34.55.2025.03.27.11.27.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Mar 2025 11:27:23 -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: <86pli2befe.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> <875xjvcn4o.fsf@gmail.com> <877c4b81nk.fsf@daniel-mendler.de> <86ecyidg2d.fsf@gnu.org> <87h63ekdxe.fsf@daniel-mendler.de> <86cye2d8t6.fsf@gnu.org> <87a596a29y.fsf@daniel-mendler.de> <86tt7ebfnc.fsf@gnu.org> <877c4aa0m8.fsf@daniel-mendler.de> <86pli2befe.fsf@gnu.org> Date: Thu, 27 Mar 2025 12:27:22 -0600 Message-ID: <87pli2z5v9.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: Daniel Mendler , juri@linkov.net, 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 Eli Zaretskii writes: >> > Anyway, I think making the cursor change from a mode hook is a better >> > solution. >> As has been mentioned, the problem is that not every scenario is covered >> by hooks, while the PCH is a potentially universal solution which can >> check arbitrary conditions. But if hooks work sufficiently well for most >> scenarios, then why not. > If there are cases that this indication supports but there's no mode > hook for them, let's discuss those cases one by one and see how to > solve them. I see overwrite-mode, read-only-mode, and input-method > activation, all of which have hooks, AFAIR. But the problem with using hooks is that modes sometimes defines a specific name for hook or use different hooks for that, for example overwrite-mode only defines overwrite-mode-hook, however input-method defines input-method-activate-hook and input-method-deactivate-hook or mark/region have activate-mark-hook and deactivate-mark-hook. --==-=-= Content-Type: text/html

Eli Zaretskii <eliz@gnu.org> writes:

Anyway, I think making the cursor change from a mode hook is a better
solution.

As has been mentioned, the problem is that not every scenario is covered
by hooks, while the PCH is a potentially universal solution which can
check arbitrary conditions. But if hooks work sufficiently well for most
scenarios, then why not.

If there are cases that this indication supports but there's no mode
hook for them, let's discuss those cases one by one and see how to
solve them. I see overwrite-mode, read-only-mode, and input-method
activation, all of which have hooks, AFAIR.

But the problem with using hooks is that modes sometimes defines a
specific name for hook or use different hooks for that, for example
overwrite-mode only defines overwrite-mode-hook, however input-method
defines input-method-activate-hook and input-method-deactivate-hook or
mark/region have activate-mark-hook and deactivate-mark-hook.

--==-=-=-- --=-=-= Content-Type: text/plain -- - E.G via GNU Emacs and Org. --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 27 14:35:54 2025 Received: (at 77224) by debbugs.gnu.org; 27 Mar 2025 18:35:54 +0000 Received: from localhost ([127.0.0.1]:51327 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1txs53-0001Co-Ho for submit@debbugs.gnu.org; Thu, 27 Mar 2025 14:35:54 -0400 Received: from mail-oi1-x244.google.com ([2607:f8b0:4864:20::244]:44434) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1txs4z-0001CY-0c for 77224@debbugs.gnu.org; Thu, 27 Mar 2025 14:35:50 -0400 Received: by mail-oi1-x244.google.com with SMTP id 5614622812f47-3feaedb6670so777279b6e.1 for <77224@debbugs.gnu.org>; Thu, 27 Mar 2025 11:35:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743100543; x=1743705343; 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=ASIP97p7J05zMWWyNFJMSX09KUqL/cD/GgDlDzKcrIM=; b=SCqAg0DhZi1b4zFfkx6J8ot0b0ahOCDljN+JQxrVNWA5XV1xF1VmRPf6TyVR0WYU19 XCW4BsypH9pkJWEGpiqMUHR7YmzzLYDTMaFRBnruLL0tXwaLHdxnrFoqXL7nSet9mR/p blo3YTiyYJAVlvOJHEww/Oh436UoVAE6F4zfJtgBLHIjQPn2BWXGDyRFzM/GdwMSC5I5 ubgWYKiWh3Viauag3YM9DlRbrO9fTk+0fjOfIawOrWildbYn8cX17SxjK9bSwMUt6mcT RE/2EaR5lihUeqigwGUHjjw5nBG9sgtbkaRQYS32wDFOnmbQFFREkLK7FHWEQHiRkQnj 1Gow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743100543; x=1743705343; 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=ASIP97p7J05zMWWyNFJMSX09KUqL/cD/GgDlDzKcrIM=; b=Nj8QgC2rQq94lSz4z78ADd4k2Pt01JmAafA5K0iTpNYN8qi6cIDGnxxcfDkvu/Spzi dCk1BFpMmeHrbY1UwYkcphDtiAYdgmKGxPQgRxN5hbKpsUyT6PcR6byeiq5JO2z+AT9K DIkP9N4bap9o5EyJ6FodMg0UmymLY5pVmUrezISR2HkToQzNE55ZjrWpLg24XF77NjIk MxQX5k4If3VDI52TMDBkcYLoy5TNJc2GknPLK4wcrKLq7w/0RYjok0yzFrc57djP8hmN AI61zRYJ8eSKjS6vry31WvV3OxDpgb8cRZXw32kknq9AWmcNHa9O5LiNhRdmeXDeZTf8 o3gg== X-Forwarded-Encrypted: i=1; AJvYcCX4ElQyQQuWeNfAs9ZiDSajxRQgNgXPthQ2arXSxbUOTgAgPF2sSftH7HS+POC4el4OK3c+Fw==@debbugs.gnu.org X-Gm-Message-State: AOJu0Yyyx5KWaqV2pvvfLPzonANGhAvE5CUaZ+4ShkPd7NUy54J53LoX nBWVMCanWbHoeCcLfN8uf+4/nzDmQOp1zRLGyLAhu8e0nbmHlaWL X-Gm-Gg: ASbGncvX8oI+KIal0oDrXleOUQhTSmIfyS3XYDb9JkH1bkRsx16tb25wfSyCXdSdmrY HHldxT+TFweZOCoLSJ1ItqAn9O6NBnTtZJhcxJJ8I2LDsp5uDAJA+CjJj4F61gxbco8nzWMDNQV /4r2hvkAkE2ZVRM8KRDzt904/sZKvXZdK8wXgrQ68Bkrtw9KLJYsLVYoch16c1t8yFr4NVOlAgm ppYrMXja0SJY79DI9OgkhtrgDl17Cu0lJ/uyxarqhyuOYM6xztgMHlF8ibUuaDlHrG1WM/sWJ2I nmiJ1tTPaDCa X-Google-Smtp-Source: AGHT+IFIWcGChHWXHsV2qzJfIAXVRa+PiyM05c6H68+SWakEdM7y4dEtwsVKYZlD6H9QEOsk+2P9CA== X-Received: by 2002:a05:6808:3844:b0:3f6:7b62:942e with SMTP id 5614622812f47-3fefa3ad594mr2837422b6e.0.1743100542841; Thu, 27 Mar 2025 11:35:42 -0700 (PDT) Received: from fedora ([2806:10ae:e:5fce::1]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3ff05167347sm30620b6e.6.2025.03.27.11.35.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Mar 2025 11:35:42 -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: <87semywfkr.fsf@mail.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> <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> <87a596a29y.fsf@daniel-mendler.de> <86tt7ebfnc.fsf@gnu.org> <877c4aa0m8.fsf@daniel-mendler.de> <87semywfkr.fsf@mail.linkov.net> Date: Thu, 27 Mar 2025 12:35:41 -0600 Message-ID: <87jz8az5he.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: Daniel Mendler , Eli Zaretskii , 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: >> I think Stefan and Juri should chime in with their experience about >> this, since as I've seen, they both want to replace some custom cursor >> code with the new mode in their configuration. > I tried the patch with 'run-with-idle-timer', > and even the delay 0.1 is noticeable and causes > the feeling that Emacs became sluggish > and can't update the cursor immediately. I think with 0.005 is most that fine, it's not immediate but also not too lazy IMO. Anyways the user can change the delay to 0. --==-=-= Content-Type: text/html

Juri Linkov <juri@linkov.net> writes:

I think Stefan and Juri should chime in with their experience about
this, since as I've seen, they both want to replace some custom cursor
code with the new mode in their configuration.

I tried the patch with 'run-with-idle-timer',
and even the delay 0.1 is noticeable and causes
the feeling that Emacs became sluggish
and can't update the cursor immediately.

I think with 0.005 is most that fine, it's not immediate but also not
too lazy IMO.

Anyways the user can change the delay to 0.

--==-=-=-- --=-=-= Content-Type: text/plain -- - E.G via GNU Emacs and Org. --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 27 15:13:38 2025 Received: (at 77224) by debbugs.gnu.org; 27 Mar 2025 19:13:38 +0000 Received: from localhost ([127.0.0.1]:51383 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1txsfa-0005tx-Du for submit@debbugs.gnu.org; Thu, 27 Mar 2025 15:13:38 -0400 Received: from relay6-d.mail.gandi.net ([217.70.183.198]:35231) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1txsfX-0005td-8W for 77224@debbugs.gnu.org; Thu, 27 Mar 2025 15:13:35 -0400 Received: by mail.gandi.net (Postfix) with ESMTPSA id 23CFA442AC; Thu, 27 Mar 2025 19:13:24 +0000 (UTC) From: Juri Linkov To: Eli Zaretskii Subject: Re: bug#77224: [PATCH] New minor mode 'cursor-indicators-mode' In-Reply-To: <86jz8ababt.fsf@gnu.org> 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> <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> <87a596a29y.fsf@daniel-mendler.de> <86tt7ebfnc.fsf@gnu.org> <877c4aa0m8.fsf@daniel-mendler.de> <87semywfkr.fsf@mail.linkov.net> <86jz8ababt.fsf@gnu.org> Date: Thu, 27 Mar 2025 21:13:06 +0200 Message-ID: <87pli2qocd.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: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduieelvddvucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufgjohhffffkfgggtgesthdtredttdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucggtffrrghtthgvrhhnpeffgeetfeevlefhleejfeeuheeiudeitdffhfdutdekfeffgffhveehteegueekheenucfkphepledurdduvdelrddutdehrdduudejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepledurdduvdelrddutdehrdduudejpdhhvghlohepmhgrihhlrdhgrghnughirdhnvghtpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhgspghrtghpthhtohepgedprhgtphhtthhopeejjedvvdegseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtohepvghgieegvdeiudeisehgmhgrihhlrdgtohhmpdhrtghpthhtohepmhgrihhlsegurghnihgvlhdqmhgvnhgulhgvrhdruggvpdhrtghpthhtohepvghlihiisehgnhhurdhorhhg X-GND-Sasl: juri@linkov.net X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 77224 Cc: mail@daniel-mendler.de, eg642616@gmail.com, 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 (-) >> > I think Stefan and Juri should chime in with their experience about >> > this, since as I've seen, they both want to replace some custom cursor >> > code with the new mode in their configuration. >> >> I tried the patch with 'run-with-idle-timer', >> and even the delay 0.1 is noticeable and causes >> the feeling that Emacs became sluggish >> and can't update the cursor immediately. > > What about the delay of zero? Ok, will try zero for a while. From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 27 15:25:41 2025 Received: (at 77224) by debbugs.gnu.org; 27 Mar 2025 19:25:41 +0000 Received: from localhost ([127.0.0.1]:51417 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1txsrE-0006X9-RE for submit@debbugs.gnu.org; Thu, 27 Mar 2025 15:25:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40288) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1txsrA-0006Wq-7g for 77224@debbugs.gnu.org; Thu, 27 Mar 2025 15:25:37 -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 1txsr3-000326-2z; Thu, 27 Mar 2025 15:25:29 -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=xZiyZIhdg9yQRybG9pX1oDipf3DffQyQBau+Hunkegg=; b=JnchDMyg/w3wHTyvjqGK B7QmQ5yKFQREe/1COySo1SxrZCnu0NWMnDpCwtN7i9CMVNTcxgkOd7e0fsjPm92f4UXe9iS09LHB7 0tsCCnGvwI8m4ykW2oJfLLRTuydhI5+GEIO+ygnZmdjNDooQRTUCGiqtabtsbRNFWT7cq56iYqecK p1h/iz7ZIt4xCK7Te+DrBZK4yj9cNqPhX9JWCfUWFdbQ8sX1KZ0UKJBfJHLGklIhvDRS+9xuUS4ow AaRj8s/TerEIqD1JDdbswE+0QxBnH6y/lZfedR8lZC8b2UK+NWZVUxSYBiQHvVaPO9KIFYHkPpQ3d YI2ZTWSuCH5QaQ==; Date: Thu, 27 Mar 2025 21:25:22 +0200 Message-Id: <86iknub7j1.fsf@gnu.org> From: Eli Zaretskii To: Elijah Gabe =?utf-8?Q?P=C3=A9rez?= In-Reply-To: <87pli2z5v9.fsf@gmail.com> (message from Elijah Gabe =?utf-8?Q?P=C3=A9rez?= on Thu, 27 Mar 2025 12:27:22 -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> <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> <87a596a29y.fsf@daniel-mendler.de> <86tt7ebfnc.fsf@gnu.org> <877c4aa0m8.fsf@daniel-mendler.de> <86pli2befe.fsf@gnu.org> <87pli2z5v9.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: mail@daniel-mendler.de, juri@linkov.net, 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: -3.3 (---) > From: Elijah Gabe Pérez > Cc: Daniel Mendler , 77224@debbugs.gnu.org, > juri@linkov.net > Date: Thu, 27 Mar 2025 12:27:22 -0600 > > Eli Zaretskii writes: > > Anyway, I think making the cursor change from a mode hook is a better > solution. > > As has been mentioned, the problem is that not every scenario is covered > by hooks, while the PCH is a potentially universal solution which can > check arbitrary conditions. But if hooks work sufficiently well for most > scenarios, then why not. > > If there are cases that this indication supports but there's no mode > hook for them, let's discuss those cases one by one and see how to > solve them. I see overwrite-mode, read-only-mode, and input-method > activation, all of which have hooks, AFAIR. > > But the problem with using hooks is that modes sometimes defines a > specific name for hook or use different hooks for that, for example > overwrite-mode only defines overwrite-mode-hook, however input-method > defines input-method-activate-hook and input-method-deactivate-hook or > mark/region have activate-mark-hook and deactivate-mark-hook. If there's a single hook, it is called both when turning the mode on and when turning it off, so I'm not sure I see the problem. Anyway, I think I'm done arguing. I'm quite sure you all understand my opinions and suggestions; if you want to disregard them and use the post-command-hook anyway, feel free, but don't be surprised if someone then complains that Emacs became a tad slower: it's because of all these features that take the easy way out and use post-command-hook, and by that add yet another one of those small slowdowns, which add up and up... From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 27 16:17:44 2025 Received: (at 77224) by debbugs.gnu.org; 27 Mar 2025 20:17:44 +0000 Received: from localhost ([127.0.0.1]:51495 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1txtfY-0000Sh-G7 for submit@debbugs.gnu.org; Thu, 27 Mar 2025 16:17:44 -0400 Received: from server.qxqx.de ([2a01:4f8:c012:9177::1]:34123 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 1txtfS-0000SN-9W for 77224@debbugs.gnu.org; Thu, 27 Mar 2025 16:17:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=daniel-mendler.de; s=key; h=Content-Type:MIME-Version:Message-ID:Date: References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding: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=byP74CLiKgIVYjs+xBmOMXWFZ/zIgDzSUFYBi0WRk4I=; b=nxeOT4/2KiBmzXZCAiGI32Fsdf mIwO45Bq3cm6N001UmP0N3/tgISZvTFYedmLWRdtuUBtVdcBXzhg/uz4lqRtYKw/1p7JQb3fz0t0m 9AzhmIktXo1tg7AvABgHXBnkf4/VnoPpKzVkzyyi5BAr75y7h/fMMHwcECBv8anyANPU=; From: Daniel Mendler To: Eli Zaretskii Subject: Re: bug#77224: [PATCH] New minor mode 'cursor-indicators-mode' In-Reply-To: <86pli2befe.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 27 Mar 2025 18:56:21 +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> <87h63ekdxe.fsf@daniel-mendler.de> <86cye2d8t6.fsf@gnu.org> <87a596a29y.fsf@daniel-mendler.de> <86tt7ebfnc.fsf@gnu.org> <877c4aa0m8.fsf@daniel-mendler.de> <86pli2befe.fsf@gnu.org> Date: Thu, 27 Mar 2025 21:17:25 +0100 Message-ID: <878qoq5iui.fsf@daniel-mendler.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain 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: eg642616@gmail.com, 77224@debbugs.gnu.org, juri@linkov.net >> Date: Thu, 27 Mar 2025 17:39:59 +0100 >> >> Eli Zaretskii writes: >> >> > post-command-hook is run by the same loop that decides that Emacs is >> > idle and runs timers, so the difference in practice should be very >> > small if at all. >> >> The `post-command-hook' is guaranteed to run after a command while the >> idle timer is delayed until no new events are in the queue. > > No, the idle time is run immediately if there's no input. Emacs > doesn't wait or delay the timer. We are saying the same thing here. Yes, if there is no input, the idle timer will run immediately. But if the user continues typing and events are in the queue, then the timer will not run for some time. A delay also occurs when an asynchronous process runs and fills a buffer in the background like the *compilation* buffer. Then the cursor update will lag behind. I am with you that one should not carelessly add `post-command-hooks'. I use various modes which use `post-command-hooks', idle timers and regular timers, each for their proper use case. For example `post-command-hooks' lead to sluggishness if they were used for auto completion, spell checking or help at point (like Eldoc). For such use cases idle timers or regular timers are the better tool since they defer the expensive computation of completion strings, talking to a language server, completion backend or a spell checker. Here we discuss changing only the color of the cursor, a much much less complex operation. The `cursor-type' update and checking a few variables to find the color is a cheap operation which will not lead to sluggishness. If this were an expensive operation, I would look elsewhere for places to optimize, but avoiding `post-command-hook' is not the solution. Daniel From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 27 16:32:27 2025 Received: (at 77224) by debbugs.gnu.org; 27 Mar 2025 20:32:27 +0000 Received: from localhost ([127.0.0.1]:51521 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1txttr-0001Ac-05 for submit@debbugs.gnu.org; Thu, 27 Mar 2025 16:32:27 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]:47205) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1txttn-0001AI-9N for 77224@debbugs.gnu.org; Thu, 27 Mar 2025 16:32:23 -0400 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-22401f4d35aso33754135ad.2 for <77224@debbugs.gnu.org>; Thu, 27 Mar 2025 13:32:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743107537; x=1743712337; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=x1dsDPJbWq5m/yxj29hPc0nnXV0NdKnnJ+P5ll8JtjU=; b=TaseePNzixY4QexJZ6LWkdWvLF4YMaV718Tki01DV7I4sdM5jzYZ6pwziqmENdtuu8 7WaSCQqPwp+PHgrh2QJvQ36cSeO/HPaOHfoGsxW5AoIRWrwIaOvWUfiOfLCZZqteniCZ tDZMXfNp6ImgTfG/q2vBug4tUbp6I21u3AGan85MKtgc/J5hCH7xHa2T1ai+EqGZsN4U r/dWmmxm0TVmlAp/ruN4/vexYi4Ix6kShbGQcnUHf5Q1DSwgKLCPj4ADFfJ9I0xHm1je Hg2/bNOjXx3Jtg9UhHGNpvK4BXtwqQZFZB2Pr7wT3lXYQ0KKvpLopSS2t5YW1gTcpPe3 lp+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743107537; x=1743712337; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=x1dsDPJbWq5m/yxj29hPc0nnXV0NdKnnJ+P5ll8JtjU=; b=DfNNSO7vNQTkeOwT9dTPDoew6Vg754TvAxXGDjCy2/TPaQK93UbzVQ01mYfXlGu6vK WuAJ54xriwFOpHMM5EVEmSqrIjUQFqMJaOFcrpH+Yb/hFRwkpRrO5yMhuhvlHyXlUlVy dxvsdjzQ22JshEDUfUqKZmXVzXhh9GpnfHLYASQeMEErd5SzLvvLm6eiIuLPk+kR9Fmg F45csZDqJy0rLL4UmORUJ0dl76hBYePywpZ0tdgqqBoljYsa3ayc4CqL5sQPEe3hloPe xY3P/YWhkcHcYzouNdy6Umh02LZayfPGoS/7xUO3hf91bJMcadYI9d8sS4qDS3Oi7HFn pQDg== X-Gm-Message-State: AOJu0Yyv2dXgkDqnOtgJ/uRHp2WvD11s5nsHbVV33zmJhRKAqHfL6rZ7 RmB/zxvvTftUk2oTAtLbT9MMwCdyACh1C+Xxp70tJ3mMc5cEV8HR X-Gm-Gg: ASbGnctx9IJoCgphCFCuCU93kYuiE2K7ibLu/iS7/J1Y1y9L0QjPPj6jVZiDx7QoGEF VMuyy0UJlhSFzuCUJ5LTOdrykkunKhfT4A7tHqV4w9D2vuVLZVMwXHQqkkHr49xv4N5MC6ZrZ9p QvCGofOGrB9NJEu6niHtZls5n9SMrOa5zApMNIrKd6+K/1VSQo+PtMqvVe6MLDFSIXvy1J1YV9d 3zHvKhQg/o47u1YbQClVq6mQiPGGEC6QRsg3yTihzRLZWn07MzljBFUcCoacbAQjB79U8YoyOF4 Veq7P9Evgf7bD8LCO38n4JBbY9ME3oLTEA/aug2j9VizGkz7dZa/Y3jUys/GIaYoFZ+P1jEwoQ7 Us3dynp5uR47OAXldeFgitrKc X-Google-Smtp-Source: AGHT+IF9lMyZ2Pl1qCNLwpNE9Ic5cws4DvNiyhDYZFm1II40amkQJWJ9g5Lr+IcQMVdfGdZqUi4Vqg== X-Received: by 2002:a05:6a21:3a46:b0:1f5:619a:7f4c with SMTP id adf61e73a8af0-1fea2f4c253mr9741863637.29.1743107536809; Thu, 27 Mar 2025 13:32:16 -0700 (PDT) Received: from [192.168.1.2] (syn-023-240-109-202.res.spectrum.com. [23.240.109.202]) by smtp.googlemail.com with ESMTPSA id d2e1a72fcca58-7397106b01asm273378b3a.102.2025.03.27.13.32.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Mar 2025 13:32:16 -0700 (PDT) Message-ID: Date: Thu, 27 Mar 2025 13:32:16 -0700 MIME-Version: 1.0 Subject: Re: bug#77224: [PATCH] New minor mode 'cursor-indicators-mode' Content-Language: en-US To: Eli Zaretskii , mail@daniel-mendler.de 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> <86a596d7l5.fsf@gnu.org> From: Jim Porter In-Reply-To: <86a596d7l5.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) 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.0 (-) On 3/27/2025 4:41 AM, Eli Zaretskii wrote: > Btw, a possibly even better way is to modify the cursor looks from the > hooks of the relevant commands, like overwrite-mode. If some of them > don't have a hook, we could add a hook. This is better because it > doesn't unnecessarily "punish" Emacs anywhere else, only the commands > that could affect the cursor. > > Does this make sense? That makes sense to me, and is approximately what I have in my own configuration to do the same sort of thing as this patch. I update the cursor by adding a hook to 'after-change-major-mode-hook' and then adding variable watchers for 'buffer-read-only' and 'overwrite-mode'. That was the most-reliable method I could find at the time. If there were appropriate hooks for read-only/overwrite, then I think that would be the ideal solution. From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 27 16:42:01 2025 Received: (at 77224) by debbugs.gnu.org; 27 Mar 2025 20:42:01 +0000 Received: from localhost ([127.0.0.1]:51545 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1txu34-0001cJ-Aa for submit@debbugs.gnu.org; Thu, 27 Mar 2025 16:42:01 -0400 Received: from dancol.org ([2600:3c01:e000:3d8::1]:41568) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1txu2x-0001c3-SJ for 77224@debbugs.gnu.org; Thu, 27 Mar 2025 16:41:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dancol.org; s=x; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID: References:In-Reply-To:Subject:CC:To:From:Date: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=DR+s+MO9eKJedPblRkdogF9UD47g/Ap8ilT5MINlC+s=; b=Hr5SdC8sYpMAar6G0Pq/Lss/pU uwcEeXxFciUKQdUlOfr0OmxovBVbrhRAEp5uBFyfQiFZ76nsdwPp1v7EX/izB3oPYGwg7kiSbsTGt WGbQDJdrKTfqN+q1VIduEbxXI85FkmAM+jgTO1dzkfOk30sZ4q93pN7OFvYm00a1MDCYXer6EKVyO w3ezhJ0hUeJM9a/Scxor2weGeO0HZeN4E+5iUWm8O49aTTSfK9TrO7Sh6w+leG7OgQfT/ZncvUz3B jj2bROqcXc2vbQiud3c7bN7BNSEq6oQw3lDSBxS5tyGrZNwTRxHwAMsW03C47G0CT/ZUQ6NruwnxA orKJki8g==; Received: from 2603-9001-4203-1ab2-6547-8c8c-bd19-5cb4.inf6.spectrum.com ([2603:9001:4203:1ab2:6547:8c8c:bd19:5cb4]:47182 helo=[IPv6:::1]) by dancol.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1txu2R-004FNd-1w; Thu, 27 Mar 2025 16:41:19 -0400 Date: Thu, 27 Mar 2025 16:41:39 -0400 From: Daniel Colascione To: bug-gnu-emacs@gnu.org, Eli Zaretskii , Daniel Mendler Subject: Re: bug#77224: [PATCH] New minor mode 'cursor-indicators-mode' User-Agent: K-9 Mail for Android In-Reply-To: <86tt7ebfnc.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> <875xjvcn4o.fsf@gmail.com> <877c4b81nk.fsf@daniel-mendler.de> <86ecyidg2d.fsf@gnu.org> <87h63ekdxe.fsf@daniel-mendler.de> <86cye2d8t6.fsf@gnu.org> <87a596a29y.fsf@daniel-mendler.de> <86tt7ebfnc.fsf@gnu.org> Message-ID: <44319BF5-31B5-4ECD-95AB-591A216D0072@dancol.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) 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.0 (-) On March 27, 2025 12:29:59 PM EDT, Eli Zaretskii wrote: >> From: Daniel Mendler >> Cc: eg642616@gmail=2Ecom, 77224@debbugs=2Egnu=2Eorg, juri@linkov=2Ene= t >> Date: Thu, 27 Mar 2025 17:04:09 +0100 >>=20 >> Eli Zaretskii writes: >>=20 >> > I disagree that the cursor must change "immediately", in the rigorous >> > sense of that word=2E I think if it changes after 10 or 20 or 50 >> > milliseconds, that's "immediately" for any practical purpose=2E >>=20 >> No, 50ms are not acceptable for the user if they except an immediate >> response to a key press=2E > >50ms was just an example, and it is actually quite improbable to be >that large=2E > >post-command-hook is run by the same loop that decides that Emacs is >idle and runs timers, so the difference in practice should be very >small if at all=2E > >> Regarding Emacs sluggishness, the `cursor-indicators-mode' is an >> optional mode=2E If it increases sluggishness unnacceptably (which it >> won't), users can turn it off=2E > >Experience shows that many users turn on a lot of features which rely >on post-command-hook, and then complain that Emacs is slow to respond=2E >Telling them to turn off features they like doesn't really work=2E Nor does telling external package authors not to use post-command-hook=2E = I think there are two worthwhile approaches: 1) time the entries in post-co= mmand-hook and alert users about slow ones, and 2) provide a "do something = when X, Y, or Z changes" API that authors could use when they would otherwi= se put something on PCH and check X, Y, and Z internally=2E Internally, we = could DTRT and omit running those hooks when the relevant conditions haven'= t changed=2E For example, instead of putting something buffer and focus dependent in PC= H or fiddling with buffer and window and frame hooks, you could write somet= hing like (call-on-change (:buffer :window :focus) #'my-thing) or something like that=2E It's not that you can't do the equivalent by manually adding my-thing to t= he appropriate hooks directly, but the convenient one stop syntax might gui= de people away from PCH=2E > >Anyway, I think making the cursor change from a mode hook is a better >solution=2E +1=20 > From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 27 16:48:39 2025 Received: (at submit) by debbugs.gnu.org; 27 Mar 2025 20:48:39 +0000 Received: from localhost ([127.0.0.1]:51568 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1txu9W-0001ug-Hv for submit@debbugs.gnu.org; Thu, 27 Mar 2025 16:48:39 -0400 Received: from lists.gnu.org ([2001:470:142::17]:56470) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1txu9O-0001uC-Jy for submit@debbugs.gnu.org; Thu, 27 Mar 2025 16:48:31 -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 1txu9J-0008R1-8H for bug-gnu-emacs@gnu.org; Thu, 27 Mar 2025 16:48:25 -0400 Received: from dancol.org ([2600:3c01:e000:3d8::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1txu9G-0005yI-Ir; Thu, 27 Mar 2025 16:48:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dancol.org; s=x; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID: References:In-Reply-To:Subject:CC:To:From:Date: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=7W0lMmcYGrq9215poGXmQMBRSfVYhZVbTZOOumdZIO4=; b=oM1iv/qDy2IgSExxwaXfmZK1bG g6x3DGNLsLHy4kvHlOaoO9tonJy923iogB34bVC0c0b2kQxAEjAPU0KURUDmcT6qLvuVCtdhlRnU0 plIDNs3Dkcai1C52LN/rJWZh9a6g68fKdwGyFKxIQl2L2Puzj4g5sUhdYx8bPJoq1KmlQqs/XIPdE bg7CN/wVu7ZiFbTcjIp17quqP+XrbCa1e8WQf1UscI4m4+exgsSPu1tWgqZM0WR6dJGqQpid1yMjC uzJ7r9f5//NLGTRneqHn5vTt5ZghS/XHdz6HpV0NCU0WzIcWzFK3bkqEx/p8j00GIvi56EBNEtEEG DdBPV45w==; Received: from 2603-9001-4203-1ab2-6547-8c8c-bd19-5cb4.inf6.spectrum.com ([2603:9001:4203:1ab2:6547:8c8c:bd19:5cb4]:39814 helo=[IPv6:::1]) by dancol.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1txu8o-004FOx-0d; Thu, 27 Mar 2025 16:47:55 -0400 Date: Thu, 27 Mar 2025 16:47:03 -0400 From: Daniel Colascione To: bug-gnu-emacs@gnu.org, Eli Zaretskii , Daniel Mendler Subject: Re: bug#77224: [PATCH] New minor mode 'cursor-indicators-mode' User-Agent: K-9 Mail for Android In-Reply-To: <44319BF5-31B5-4ECD-95AB-591A216D0072@dancol.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> <875xjvcn4o.fsf@gmail.com> <877c4b81nk.fsf@daniel-mendler.de> <86ecyidg2d.fsf@gnu.org> <87h63ekdxe.fsf@daniel-mendler.de> <86cye2d8t6.fsf@gnu.org> <87a596a29y.fsf@daniel-mendler.de> <86tt7ebfnc.fsf@gnu.org> <44319BF5-31B5-4ECD-95AB-591A216D0072@dancol.org> Message-ID: <93E6AF16-CA6C-443F-9712-B395E2403F60@dancol.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2600:3c01:e000:3d8::1; envelope-from=dancol@dancol.org; helo=dancol.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) X-Debbugs-Envelope-To: submit 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: -0.1 (/) On March 27, 2025 4:41:39 PM EDT, Daniel Colascione = wrote: > > >On March 27, 2025 12:29:59 PM EDT, Eli Zaretskii wrote: >>> From: Daniel Mendler >>> Cc: eg642616@gmail=2Ecom, 77224@debbugs=2Egnu=2Eorg, juri@linkov=2En= et >>> Date: Thu, 27 Mar 2025 17:04:09 +0100 >>>=20 >>> Eli Zaretskii writes: >>>=20 >>> > I disagree that the cursor must change "immediately", in the rigorou= s >>> > sense of that word=2E I think if it changes after 10 or 20 or 50 >>> > milliseconds, that's "immediately" for any practical purpose=2E >>>=20 >>> No, 50ms are not acceptable for the user if they except an immediate >>> response to a key press=2E >> >>50ms was just an example, and it is actually quite improbable to be >>that large=2E >> >>post-command-hook is run by the same loop that decides that Emacs is >>idle and runs timers, so the difference in practice should be very >>small if at all=2E >> >>> Regarding Emacs sluggishness, the `cursor-indicators-mode' is an >>> optional mode=2E If it increases sluggishness unnacceptably (which it >>> won't), users can turn it off=2E >> >>Experience shows that many users turn on a lot of features which rely >>on post-command-hook, and then complain that Emacs is slow to respond=2E >>Telling them to turn off features they like doesn't really work=2E > >Nor does telling external package authors not to use post-command-hook=2E= I think there are two worthwhile approaches: 1) time the entries in post-c= ommand-hook and alert users about slow ones, and 2) provide a "do something= when X, Y, or Z changes" API that authors could use when they would otherw= ise put something on PCH and check X, Y, and Z internally=2E Internally, we= could DTRT and omit running those hooks when the relevant conditions haven= 't changed=2E > >For example, instead of putting something buffer and focus dependent in P= CH or fiddling with buffer and window and frame hooks, you could write some= thing like > >(call-on-change (:buffer :window :focus) #'my-thing) > >or something like that=2E > >It's not that you can't do the equivalent by manually adding my-thing to = the appropriate hooks directly, but the convenient one stop syntax might gu= ide people away from PCH=2E Also, we'd be able to coalesce and debounce calls to these change function= s=2E From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 27 20:49:42 2025 Received: (at 77224) by debbugs.gnu.org; 28 Mar 2025 00:49:42 +0000 Received: from localhost ([127.0.0.1]:51963 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1txxuo-0008Dq-EA for submit@debbugs.gnu.org; Thu, 27 Mar 2025 20:49:42 -0400 Received: from mout.web.de ([212.227.17.11]:42629) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1txxul-0008DZ-7O for 77224@debbugs.gnu.org; Thu, 27 Mar 2025 20:49:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=web.de; s=s29768273; t=1743122972; x=1743727772; i=michael_heerdegen@web.de; bh=UIDQm8GgVpragslBQILHtHA5rHzSQkEshzpfPzrP2F4=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date: Message-ID:MIME-Version:Content-Type:cc:content-transfer-encoding: content-type:date:from:message-id:mime-version:reply-to:subject: to; b=mbqlrWoyUMxymzzMKe6JrtDK6OcPJl8UZkBE0cfhSHQ7JWmLaOTatTwan87dZgCB GjdI7tw5PjWnbDNyDwwm/OefXbn5+sSFkoD8F0TJAxwCmeNxJbjD7KbBL2+zOc/ja jfepkd80hRIhbQltSjuqoB1HJ7ZkWdSaz7Nh8BJdlQX+JVOCuuwpGGC8ERr3UKNAM HtgtFcGXBypfpoqWy3kwQ0kGnRkOw2gAZF+GWVRVxLuKZycORxXuVuCFJemfZuAzR mtkMdOjYNjovhFt4SJVpnnE1tJa5wveB9H5/5oV64M7DyhZB++TFBFuuM1jod7kRm Q9xBinfgTRkXnWAxbw== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from drachen.dragon ([88.66.201.136]) by smtp.web.de (mrweb106 [213.165.67.124]) with ESMTPSA (Nemesis) id 1MTOli-1tYZqC35A4-00U4gq; Fri, 28 Mar 2025 01:49:32 +0100 From: Michael Heerdegen 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: Fri, 28 Mar 2025 01:51:03 +0100 Message-ID: <87ldsq7zbc.fsf@web.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K1:ElsFRiSRAiq2el/n6kelZXhwsk2Z4opaFHMrhQItPo0dx7A9Tcq VMY2euJq0/5eOU6i+yA70dltqPUg4E6GM4fQNTG28T+HLrX7gW3kyxpVV+PbzWEkZRHOZfJ FQcWS7bs1IesnKyG9CVsiYSEGaz2CHj0/ZHmHGKQfhqSo/uG0e/u7ni0dV3geVvN2eH8VUq IkCN31ClyP5MmauuevGHg== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:fdzsq2nvuEA=;asMHFyXPb7tBhLHIj36VxrrOska nEqm18BO+IrLPdqVfYtS0/otIfrhm+y9doxOv5/woj+DdSQ8nPyP7/QaIP6MfQb3DFQk1V2Z+ 78db6+iduBfwP9+nd7OGooN+vC/QybP0B7rMTMpWfKiUg0aNiXnemwMhDZafGzPE2rJXLfFxY 3jwGMI7yfqfC27Gqj9Gal7FG8u4m65r7W3rRGtc8hhuNiIW3Kl71AHhgoUwInxKKGm4wzOCkX 3knUmwNsTw3d1jIRnBieHdhDkmkVLl6yyNWPbQNFZJdmRBaE6X9DT9VyC4LlKQcR27REmIfHI s4pfPaB2wdg0kGvAX/xjZL5Z0ETQZdo5lSzO/25dyt439VhK7S2BpHps3/9WgCzTECshD4MWW GNhy0YYlPtCnZnprjn3pf6A2bJEQSdLgfPfIQYFoxOCd8iCkZWkPcbYjgQ3B8SsfAH+YSUda9 jRSHI8X8gSzxN3YSXFFhQdnC7zs8O6IOnCk8cVL98NjMPoTA7c0c8HdyX/ppxlVRjjErS6+V4 WdATYWDhKLozofxMsmn9S3BC7fYeaOHKNny/8KFn47vqg7zuzaz0SB+Dsw1W4K8LluVYokw1k 7NdSbqGczXyb/90qE4WsSqpr5MAZ5dCZjJHfY7hNbGPWltnwh8+H4628xbEdX8tO53nzNpWFG 2PvNZ5HeER6PNH/No1x3xs4VASNhL3QqfsDMN46v7gmG64kuQVGgBnqg1AIwfwGZYGGrDAxPe loUhfkhL9qudn/Sz8shHt27NM+7Z8TtQexrt8ODwEzNX95Oiguxj8g97X7VXerVqmN+cg3bPk oHfH0JE39yjwaM73ot9gUIvcbpH9/efmdpdKudDlfYWKlIy1g62jDkuXRe6Z96QKnKAy7RYRW Y+Kxbollqdf7qRfi+B7tsfR0BLN3AgHCH5jaQTFaZGN6/5hC6rdu1qeYO3Mo8XNXhGebQmhp7 jO0H//XnStDpyKXK54ZR/iHUyhVQ0eqlJIIcFadq1leGq+Xg/de7kE7XsiFYORZdPu8xMwWrz w3Vv5JwMX3ykkMCQFlXqIG/ZhWlU9g2g4UmCHdmipyP5ZzyEdT9Tl6+UIMQ03l5K1qYt+Bc3m 0OJMUi8phvRBw8N9B98vUdkvIn+uvpTVycrGji1b9NcIFGWk59Z38MwgmI47OtCBcUP8CYljJ RPEMqzmmd4tTAuUQ2AcE8XqHE8R1Tl1/0pDvCoIFagnWg0hNpek0hcyJLPJow/vA6lMQT7OXy lqv5TRSALCfERZsNlj9L3QD1JOeB3N49BHcH0KiBtAEzB/JKLtwKb0OC5Xo9TwB88BYMUMlF6 mWck3E1YhGKMjLXloE5mIcahlnFKr/3Sy/blKARFbRdyRAa7SRGgAa3F1H+5dLJKdf6kj7xGy 2yjhfsYn1fuR9fQbgKkPsJmSpYARaepzXKiCpqp4Zwar0F8LPJYdfePofBXxZl6yOvug0Ge5h vF9S5RyeUt5dJ6L7ilAaYJSYIgsM= X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 77224 Cc: 77224@debbugs.gnu.org, eg642616@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: -1.7 (-) Eli Zaretskii writes: > Would it be better to use an idle timer instead? post-command-hook > tends to make Emacs sluggish. post-command-hook is the most general, and thus the simplest way to implement something like this, but not necessarily a good way. A solution using such a general tool like post-command-hook also comes with problems. What if something adds something to post-command-hook that changes one of the conditions that should trigger a cursor type change? And yes, obviously, the conditions are checked much too often when using post-command-hook, and yes, people will complain because they are will add conditions where checking is not that cheap. Timers are a bit better, but are also far from optimal. I would really prefer to use other hooks. If we miss a hook, let's add those hooks we miss. Nearly all uses of hooks could be replaced by adding something to post-command-hook, but the other hooks are there for a reason. What's different in this case that justifies this measure here (the question does not go to Eli, obviously)? If we can't use other hooks, are there other alternatives? Variable watchers have been mentioned - would using those be possible? Or, could we at least try to use the buffer local binding of post-command-hook, at least for conditions that are buffer local anyway? Michael. From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 28 02:49:07 2025 Received: (at 77224) by debbugs.gnu.org; 28 Mar 2025 06:49:07 +0000 Received: from localhost ([127.0.0.1]:52535 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ty3Wc-00005T-Hs for submit@debbugs.gnu.org; Fri, 28 Mar 2025 02:49:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34402) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ty3WW-00004r-So for 77224@debbugs.gnu.org; Fri, 28 Mar 2025 02:49:04 -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 1ty3WP-0004dB-Mx; Fri, 28 Mar 2025 02:48:53 -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=Qy0bSPaDOR/FadewCm5OWfV0F+OECa8d0HAchJZjgVM=; b=GA3q9KiLyptc 01fOOFqwynJUYoz8V3UUjlspmDsI6P71VH75cOlcZTlKOs00zmeTK5kSnw5PBOOkP3q0lA2KbLC7v GwwuLuXW8b+OtIeB1HnbbTc9vsl5ATLVXrcf4Opu608JOuzU3dHVAWWu2OGZZwS9QTtLACfay34lH E+pjnmQg6lXmM+iCEmFEuUVUSTn5MTri8qyF6QSPO48jjr9g1y8WeldTRRVNtoi8n65rfX3AkKpCX 5gcXL1nFZdn7kIGY6PDwraWEL7yGWq2QnTKl7Fe5lV9RCOAQ5XSTgubNykqWNCA+g8gUN/+/uu08F mCkQqXeMnjCIz/w0/9knKw==; Date: Fri, 28 Mar 2025 09:48:49 +0300 Message-Id: <86bjtlbqge.fsf@gnu.org> From: Eli Zaretskii To: Daniel Mendler In-Reply-To: <878qoq5iui.fsf@daniel-mendler.de> (message from Daniel Mendler on Thu, 27 Mar 2025 21:17:25 +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> <86cye2d8t6.fsf@gnu.org> <87a596a29y.fsf@daniel-mendler.de> <86tt7ebfnc.fsf@gnu.org> <877c4aa0m8.fsf@daniel-mendler.de> <86pli2befe.fsf@gnu.org> <878qoq5iui.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 21:17:25 +0100 > > Here we discuss changing only the color of the cursor, a much much less > complex operation. My point is that when the list on post-command-hook is long, it takes Emacs time to process all the functions on the list, and the longer the list, the less responsive Emacs will be. These small insignificant delays add up. How long is the post-command-hook list in your production sessions? Should we poll users to give their data? Just yesterday someone complained on Reddit that Emacs is too slow, and I have no doubt that features that use post-command-hook are at least part of the reason if not _the_ reason. So I maintain that we should try to avoid post-command-hook for operations that should happen very rarely (this case is one such case: we only want to run this code when something is turned on or off). Even if the reaction to the change is a bit slower, it is worth our while to pay that price: users will be a tad happier with Emacs response times. And if there are alternative methods of doing the same, like the respective mode hooks in this case, we should use them without thinking twice. Ideally, post-command-hook should only be used for stuff that really must be done after almost every command; for any other cases we should look for other Emacs features to do the job. Emacs is a very old program, and if we do it right, it will live a long time since. We should realize the long-run effects of (ab)using stuff like post-command-hook, and try to imagine how much more stuff will be accrued in post-command-hook 40 years hence if we lower our guards in this regard. But I repeat myself. From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 28 03:07:15 2025 Received: (at 77224) by debbugs.gnu.org; 28 Mar 2025 07:07:15 +0000 Received: from localhost ([127.0.0.1]:52557 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ty3oA-00011g-TR for submit@debbugs.gnu.org; Fri, 28 Mar 2025 03:07:15 -0400 Received: from mail-oa1-x43.google.com ([2001:4860:4864:20::43]:61564) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1ty3o6-00011D-Ef for 77224@debbugs.gnu.org; Fri, 28 Mar 2025 03:07:13 -0400 Received: by mail-oa1-x43.google.com with SMTP id 586e51a60fabf-2a01bcd0143so2054297fac.2 for <77224@debbugs.gnu.org>; Fri, 28 Mar 2025 00:07:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743145625; x=1743750425; 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=KB3aacvJLrgHpwY6nUAQOXnQQYG5+QbRK8mJGbrv5B4=; b=j+tcKmlVmXqeCxK0d4UNfkDVNeHRPnJk38bw3vpE+EYcVBbDsyPsU9733wtdiCTP2w U47b24+Lq4J2G6pOHACNBayIEigUYNyF98Cg7Gl/kGr0LKVu128GJFLwvxId/3J7JWcx FAGuK+2qWC1cf9EX+J41PKGfhBZsFK1FxFqGxnj+1qvOCNiOLWLcAUCxTxfhIMJxxp5y 88Mch9+7pVEQKfgPjWLyfo21freDXyJsJ+mk1g1KcmgryQ+lwzfqjZ2FOGJVhbYW3zeg meNdxe5vUQWr04jFN6CdVNgqhsg7OG/GhSZ3gfF2j67ZUd34DB/yIh6s3RU/YTOfBmAj OLIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743145625; x=1743750425; 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=KB3aacvJLrgHpwY6nUAQOXnQQYG5+QbRK8mJGbrv5B4=; b=GDJNY2LsuRf7o4LrpMWg276zSHFf3rbfPZOP/RmhJ9uSs8ivoug6hqHIs4iX2pmCPm /Q1eYSYLSOzuVtc5AG42EBEZiwSC20tWe982frsdyBYa7kDIHvzt6auHadpiX9aCC7jb zWGVCXNmiaRBhWCKmhvu7seDtsI58F4Al53N0uYFS+GN3LioMGkCVrNqQzVMawRiOg3S mbhCvhtpBtPwO8wPr+q8tnW41B3WxWvhn5Eoi+v/YQZf8fj3RhX8HmxfuJMF9xLKTXIA T5I6kSv7xL7zqHhIB6VswLO9GpC9PrymqNluF5EMJwXdfHrWhNwnTMVtl85UAcLxZNMR qQTw== X-Gm-Message-State: AOJu0YwqqubFPc2x8WZK5njBIwwskiF/a7ChIMGat9dgy7UIAUd9a7BO fnrwV0y9CUlW15m7qc6ubYaNliUVXmPfuc6+3WkZlBs/tJlzveOU X-Gm-Gg: ASbGncsoXxVE1OxAzmddzDAM8IzikQtxTfzgFgOwJnL69Kqp+xJb0wtnDe4C207UFdM ZVo99qNl9/SikYcQ1CEa267o1wh+qBEZatvM7xItB2JLvEFxFYNkD/q/jUYod1Epc5I27UWA6LW Y0sDLmcWa5+budWtcD76xHOltV4iv33bRtLJrutJ0kyG3wOz/0+Q4ElgQe4fenNRkcOzVYpEWly pmhjlYxV4hr6qk5KBkTWCoycsN09NWzWywSSgZSPd6ZtbikUFZ+VsH3IbBfNsTvAjcjN3tO4Thj 37FIwOmrQLLm X-Google-Smtp-Source: AGHT+IH2QqZZjr3YNgEPEinE884lzBL6vjaK0m9AGFFYhE7n9pso20rUHnt3B8x3qgwPLJNV0YeCKQ== X-Received: by 2002:a05:6871:1cc:b0:2a3:d9b3:3d01 with SMTP id 586e51a60fabf-2c8481de2d5mr4653294fac.29.1743145624451; Fri, 28 Mar 2025 00:07:04 -0700 (PDT) Received: from fedora ([2806:10ae:e:5fce::1]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-2c86a855d21sm307927fac.34.2025.03.28.00.07.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Mar 2025 00:07:03 -0700 (PDT) From: =?utf-8?Q?Elijah_Gabe_P=C3=A9rez?= To: Daniel Colascione Subject: Re: bug#77224: [PATCH] New minor mode 'cursor-indicators-mode' In-Reply-To: <44319BF5-31B5-4ECD-95AB-591A216D0072@dancol.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> <875xjvcn4o.fsf@gmail.com> <877c4b81nk.fsf@daniel-mendler.de> <86ecyidg2d.fsf@gnu.org> <87h63ekdxe.fsf@daniel-mendler.de> <86cye2d8t6.fsf@gnu.org> <87a596a29y.fsf@daniel-mendler.de> <86tt7ebfnc.fsf@gnu.org> <44319BF5-31B5-4ECD-95AB-591A216D0072@dancol.org> Date: Fri, 28 Mar 2025 01:07:02 -0600 Message-ID: <87a595tyzt.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, eliz@gnu.org, juri@linkov.net, mail@daniel-mendler.de 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 Daniel Colascione writes: >>Anyway, I think making the cursor change from a mode hook is a better >>solution. I've updated the patch which should use the mode hook instead using =post-command-hook= or idle timers (and allows (implicitly) to user use post-command-hook (but that is user responsibility add it or not)). Also this should refresh the cursor while switching windows. However I've deleted the function/lambdas support as conditions because i found it problematic. I've test it only for overwrite-mode, I ask if anyone wants to give it a try. --==-=-= Content-Type: text/html

Daniel Colascione <dancol@dancol.org> writes:

Anyway, I think making the cursor change from a mode hook is a better
solution.

I've updated the patch which should use the mode hook instead using
post-command-hook or idle timers (and allows (implicitly) to user use
post-command-hook (but that is user responsibility add it or not)).

Also this should refresh the cursor while switching windows.

However I've deleted the function/lambdas support as conditions because
i found it problematic.

I've test it only for overwrite-mode, I ask if anyone wants to give it a try.

--==-=-=-- --=-=-= 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 275d3ca5fcea03890e422b845477735f3c30d9ad 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 | 164 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 174 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..c97e6d0748a --- /dev/null +++ b/lisp/cursor-indicators.el @@ -0,0 +1,164 @@ +;;; 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 'compat) + +;;; User options + +(defcustom cursor-indicators + '((overwrite-mode-hook overwrite-mode "red") + (read-only-mode-hook buffer-read-only "green") + (input-method-activate-hook current-input-method "blue") + (input-method-deactivate-hook 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: + (HOOK CONDITION COLOR) Change cursor color + (HOOK CONDITION TYPE) Change cursor type + (HOOK CONDITION TYPE COLOR) Change cursor color and type + +HOOK must be a hook where conditions will be trigger. +CONDITION must be a variable that must return non-nil. +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 + (variable :tag "Hook") + :value-type + (group + (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-inpu= t-method) + ;; User-defined conditions + (function :tag "Variable") + (variable :tag "Function")) + (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 () + "Helper function to `cursor-indicators--update-indications'." + ;; Check if KEY is non-nil + (dolist (el cursor-indicators) + (let ((con (nth 1 el)) + (type-or-color (nth 2 el)) + (color (nth 3 el))) + (when (and (symbolp con) (boundp con) (symbol-value con)) + (cond + ;; Set cursor color + ((and (stringp type-or-color) (not (equal type-or-color (frame-pa= rameter nil 'cursor-color)))) + (set-cursor-color type-or-color) + (setq-local cursor-type (default-value 'cursor-type))) ; Set to = default cursor type + ;; Set cursor type + ((and (symbolp type-or-color) (not (eq type-or-color (default-val= ue 'cursor-type)))) + (setq-local cursor-type type-or-color) + (set-cursor-color cursor-indicators--default-cursor-color)) ; Se= t to default cursor color + ;; Set cursor color and type + (color + (when (and (symbolp type-or-color) (not (eq type-or-color (defau= lt-value 'cursor-type))) + (stringp color) (not (equal color (frame-parameter ni= l 'cursor-color)))) + (set-cursor-color color) + (setq-local cursor-type type-or-color)))) + ;; And exit from loop. + (throw 'c-i-exit t))))) + +(defun cursor-indicators--update-indications (&rest _) + ;; C-I-EXIT is used here for exit from loop. + (when (and cursor-type + (not (catch 'c-i-exit (cursor-indicators--change-cursor)))) + (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 'after-change-major-mode-hook #'cursor-indicators--updat= e-indications) + (add-hook 'window-selection-change-functions #'cursor-indicators--= update-indications) + ;; Set indicators hooks + (dolist (key cursor-indicators) + (let ((hook (car key))) + (add-hook hook #'cursor-indicators--update-indications 100 t))= )) + ;; Remove all hooks done + (remove-hook 'after-change-major-mode-hook #'cursor-indicators--update= -indications) + (remove-hook 'window-selection-change-functions #'cursor-indicators--u= pdate-indications) + (dolist (el cursor-indicators) + (remove-hook (car el) #'cursor-indicators--update-indications)) + (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 Fri Mar 28 03:18:09 2025 Received: (at 77224) by debbugs.gnu.org; 28 Mar 2025 07:18:09 +0000 Received: from localhost ([127.0.0.1]:52579 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ty3yi-0001Xn-K2 for submit@debbugs.gnu.org; Fri, 28 Mar 2025 03:18:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37390) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ty3yg-0001XN-IT for 77224@debbugs.gnu.org; Fri, 28 Mar 2025 03:18:07 -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 1ty3yZ-0000iP-Rn; Fri, 28 Mar 2025 03:17:59 -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=9XKdFaS5q0O+JFHNpzuePCCGtVkPwJndkt9GcEOBSKU=; b=BnAgms6t9oyR M+OSuNecRJwrpcizkVqWqhbAAD6lT1oHGtsMS2ox/24QNpglTH4PMvYCl7FG9WED9imcLix4UH6hq 1E7eMRwCUAvZhXsd08AE+v9NcFSTuDlRXj5UdJBynR9o5sYgLztsahrxukOefzt0IsfVbkH2d/VVW QgrpiKkRkw61rVqkEuf3R2nqdarbE0tggPToiDOAkNAJxLNkZMfK0VwPetaNnlUA7c6Xgl/LL6lPo LHIKxEbAcLw7kwckjuiz6kvNq6mUYQoStQQPeN1FNImxZnvc2r5cDm8ppuX0iGczMmE9wXKfKOq9l 5VqPCMFR6H3eVkLL6OtNWQ==; Date: Fri, 28 Mar 2025 10:17:51 +0300 Message-Id: <868qopbp40.fsf@gnu.org> From: Eli Zaretskii To: Daniel Colascione In-Reply-To: <44319BF5-31B5-4ECD-95AB-591A216D0072@dancol.org> (message from Daniel Colascione on Thu, 27 Mar 2025 16:41:39 -0400) 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> <87a596a29y.fsf@daniel-mendler.de> <86tt7ebfnc.fsf@gnu.org> <44319BF5-31B5-4ECD-95AB-591A216D0072@dancol.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 77224 Cc: mail@daniel-mendler.de, eg642616@gmail.com, juri@linkov.net, 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: -3.3 (---) > Date: Thu, 27 Mar 2025 16:41:39 -0400 > From: Daniel Colascione > CC: 77224@debbugs.gnu.org, eg642616@gmail.com, juri@linkov.net > > >> Regarding Emacs sluggishness, the `cursor-indicators-mode' is an > >> optional mode. If it increases sluggishness unnacceptably (which it > >> won't), users can turn it off. > > > >Experience shows that many users turn on a lot of features which rely > >on post-command-hook, and then complain that Emacs is slow to respond. > >Telling them to turn off features they like doesn't really work. > > Nor does telling external package authors not to use post-command-hook. Well, I could at least try ;-) Who knows, some of them might even listen... > I think there are two worthwhile approaches: 1) time the entries in post-command-hook and alert users about slow ones, and 2) provide a "do something when X, Y, or Z changes" API that authors could use when they would otherwise put something on PCH and check X, Y, and Z internally. Internally, we could DTRT and omit running those hooks when the relevant conditions haven't changed. I'd be okay with developing 1), I think it's a good feature, given the proliferation of features that use this hook. As for 2), I think we already have that: add-variable-watcher. We already use this for a small number of features. Does that fit the bill? From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 28 03:32:37 2025 Received: (at 77224) by debbugs.gnu.org; 28 Mar 2025 07:32:37 +0000 Received: from localhost ([127.0.0.1]:52618 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ty4Cj-0002KI-6e for submit@debbugs.gnu.org; Fri, 28 Mar 2025 03:32:37 -0400 Received: from relay1-d.mail.gandi.net ([217.70.183.193]:46043) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ty4Cb-0002JY-Qt for 77224@debbugs.gnu.org; Fri, 28 Mar 2025 03:32:30 -0400 Received: by mail.gandi.net (Postfix) with ESMTPSA id 8B7B344351; Fri, 28 Mar 2025 07:32:21 +0000 (UTC) From: Juri Linkov To: Eli Zaretskii Subject: Re: bug#77224: [PATCH] New minor mode 'cursor-indicators-mode' In-Reply-To: <86bjtlbqge.fsf@gnu.org> 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> <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> <87a596a29y.fsf@daniel-mendler.de> <86tt7ebfnc.fsf@gnu.org> <877c4aa0m8.fsf@daniel-mendler.de> <86pli2befe.fsf@gnu.org> <878qoq5iui.fsf@daniel-mendler.de> <86bjtlbqge.fsf@gnu.org> Date: Fri, 28 Mar 2025 09:25:02 +0200 Message-ID: <874izdsjop.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: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddujedtjedtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufgjohhffffkfgggtgesthdtredttdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucggtffrrghtthgvrhhnpeffgeetfeevlefhleejfeeuheeiudeitdffhfdutdekfeffgffhveehteegueekheenucfkphepledurdduvdelrddutdehrdduudejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepledurdduvdelrddutdehrdduudejpdhhvghlohepmhgrihhlrdhgrghnughirdhnvghtpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhgspghrtghpthhtohepgedprhgtphhtthhopeejjedvvdegseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtohepvghgieegvdeiudeisehgmhgrihhlrdgtohhmpdhrtghpthhtohepmhgrihhlsegurghnihgvlhdqmhgvnhgulhgvrhdruggvpdhrtghpthhtohepvghlihiisehgnhhurdhorhhg X-GND-Sasl: juri@linkov.net X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 77224 Cc: Daniel Mendler , eg642616@gmail.com, 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 (-) > How long is the post-command-hook list in your production sessions? > Should we poll users to give their data? I use very many Emacs features, but my post-command-hook is just (repeat-post-hook my-change-cursor) From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 28 03:32:37 2025 Received: (at 77224) by debbugs.gnu.org; 28 Mar 2025 07:32:38 +0000 Received: from localhost ([127.0.0.1]:52620 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ty4Cj-0002KN-Ge for submit@debbugs.gnu.org; Fri, 28 Mar 2025 03:32:37 -0400 Received: from relay4-d.mail.gandi.net ([2001:4b98:dc4:8::224]:50815) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ty4Ch-0002Js-OT for 77224@debbugs.gnu.org; Fri, 28 Mar 2025 03:32:36 -0400 Received: by mail.gandi.net (Postfix) with ESMTPSA id DECF2433EC; Fri, 28 Mar 2025 07:32:25 +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: <87a595tyzt.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> <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> <87a596a29y.fsf@daniel-mendler.de> <86tt7ebfnc.fsf@gnu.org> <44319BF5-31B5-4ECD-95AB-591A216D0072@dancol.org> <87a595tyzt.fsf@gmail.com> Date: Fri, 28 Mar 2025 09:30:03 +0200 Message-ID: <87msd5r4z8.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: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddujedtieelucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufgjohhffffkfgggtgesthdtredttdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucggtffrrghtthgvrhhnpeffgeetfeevlefhleejfeeuheeiudeitdffhfdutdekfeffgffhveehteegueekheenucfkphepledurdduvdelrddutdehrdduudejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepledurdduvdelrddutdehrdduudejpdhhvghlohepmhgrihhlrdhgrghnughirdhnvghtpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhgspghrtghpthhtohephedprhgtphhtthhopehmrghilhesuggrnhhivghlqdhmvghnughlvghrrdguvgdprhgtphhtthhopegvlhhiiiesghhnuhdrohhrghdprhgtphhtthhopeejjedvvdegseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtohepuggrnhgtohhlsegurghntgholhdrohhrghdprhgtphhtthhopegvgheigedvieduieesghhmrghilhdrtghomh X-GND-Sasl: juri@linkov.net X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 77224 Cc: 77224@debbugs.gnu.org, eliz@gnu.org, Daniel Colascione , mail@daniel-mendler.de 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 (-) > I've updated the patch which should use the mode hook instead using > post-command-hook or idle timers (and allows (implicitly) to user use > post-command-hook (but that is user responsibility add it or not)). > > Also this should refresh the cursor while switching windows. > > However I've deleted the function/lambdas support as conditions because > i found it problematic. > > I've test it only for overwrite-mode, I ask if anyone wants to give it a > try. Please note that this is insufficient for 'repeat-mode'. Currently it requires adding an advice to update the cursor on the repeat timer events: (add-function :after repeat-echo-function #'cursor-indicators--update-indications) since need to update the cursor when the timer is fired: (run-with-idle-timer timeout nil #'repeat-exit) (defun repeat-exit () (setq repeat-in-progress nil) (funcall repeat-echo-function nil)) This problem can be solved by adding a hook: (defun repeat-exit () (setq repeat-in-progress nil) (funcall repeat-echo-function nil) (run-hooks 'repeat-exit-hook)) Then 'cursor-indicators-mode' needs to add this hook: (define-minor-mode cursor-indicators-mode ... (add-hook 'repeat-exit-hook #'cursor-indicators--update-indications) Then maybe it's possible to add more hooks for other features as well. The drawback of this approach is that specific hooks make the cursor updating less reliable than with using post-command-hook. From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 28 03:38:05 2025 Received: (at 77224) by debbugs.gnu.org; 28 Mar 2025 07:38:05 +0000 Received: from localhost ([127.0.0.1]:52652 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ty4I1-0002bc-BX for submit@debbugs.gnu.org; Fri, 28 Mar 2025 03:38:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49888) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ty4Hz-0002b3-9V for 77224@debbugs.gnu.org; Fri, 28 Mar 2025 03:38:03 -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 1ty4Ht-0003Yt-Vn; Fri, 28 Mar 2025 03:37:57 -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=O/T81Zuzv36V222FUhesTwuNGbxgNEF1lHg/ijU4CeE=; b=BCKlNKJNB13E SI/5IK9bmOHrcnaWZKDBEqjRp2iuj4nDfb+YU6f0Z51kn5BIxOfSek1+iid6Wkjg9i+LeHOLaUrYW Twkf3VhY/Eq9abVqnMSmavXrFphnUU+4EcGoan41mlrSkTC3Pn+MidNlEHoFP37hLIzAOwLFT86E0 8TrI4n6/jMR2Kylqt1D+SZZ4dm+NdVH8A+2R25QG2odeEl2D0pKBX3+agYEo+JsmoVq4pzYHvJ7m3 EqMB1TG/n8QcAhwT9vWljSeRZL5dyKQywrI2J8UlZf/WHIk8kR89jfU1aDRyEhgL4JiWPdFFjQLij 16z0ArF7aBXnHKF2F9X+Ew==; Date: Fri, 28 Mar 2025 10:37:48 +0300 Message-Id: <861puhbo6r.fsf@gnu.org> From: Eli Zaretskii To: Michael Heerdegen In-Reply-To: <87ldsq7zbc.fsf@web.de> (message from Michael Heerdegen on Fri, 28 Mar 2025 01:51:03 +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> <87ldsq7zbc.fsf@web.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: Michael Heerdegen > Cc: Juri Linkov , 77224@debbugs.gnu.org, eg642616@gmail.com > Date: Fri, 28 Mar 2025 01:51:03 +0100 > > If we can't use other hooks, are there other alternatives? Variable > watchers have been mentioned - would using those be possible? Yes, if some change should be triggered by a variable, we can use variable watchers. IMO, it would be better than either the idle timer or post-command-hook. From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 28 10:28:34 2025 Received: (at 77224) by debbugs.gnu.org; 28 Mar 2025 14:28:34 +0000 Received: from localhost ([127.0.0.1]:55041 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tyAhF-0005wj-Fx for submit@debbugs.gnu.org; Fri, 28 Mar 2025 10:28:33 -0400 Received: from dancol.org ([2600:3c01:e000:3d8::1]:50398) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tyAhC-0005wQ-9G for 77224@debbugs.gnu.org; Fri, 28 Mar 2025 10:28:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dancol.org; s=x; h=Content-Type:MIME-Version:Message-ID:Date:References:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: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=KwdSHQmpOc/DEkqOEf9xCg1wzRTjrPA0R2SLf+wLzmY=; b=U2tCPpv+jLDTSNyr+TKYO9BHRQ ULb/6V8fHPelBLBCq06kUvbmU0/ITrDLnpmdwLt6vd481Vpp0VN1SWxv5UuLy5xdNYg44ch1uicwC kVM9dFW9uOH12p5Na1vrSy99VsoSkMm6oZ5jeGQYsUbQWoScdZOFRt8mv/InsQ/t2X0sqlyq561ew ehcQ+1MvumDuAgxq5f+p3QhNnahl5lRfKvyZp+WqGuNjjCiTGQYxwFhJq3KLPFbbrSAYU4i0+tQhV d2OYF1WimM6pcf5fg9+zyr2MadL+w08bQTV7OnicHnx2lfBbu0UyWuwyRnwGvQtjM1Qd9RfVcJgbz 2eVSWGYg==; Received: from dancol by dancol.org with local (Exim 4.96) (envelope-from ) id 1tyAgf-004KBU-39; Fri, 28 Mar 2025 10:27:57 -0400 From: Daniel Colascione To: Eli Zaretskii Subject: Re: bug#77224: [PATCH] New minor mode 'cursor-indicators-mode' In-Reply-To: <868qopbp40.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> <875xjvcn4o.fsf@gmail.com> <877c4b81nk.fsf@daniel-mendler.de> <86ecyidg2d.fsf@gnu.org> <87h63ekdxe.fsf@daniel-mendler.de> <86cye2d8t6.fsf@gnu.org> <87a596a29y.fsf@daniel-mendler.de> <86tt7ebfnc.fsf@gnu.org> <44319BF5-31B5-4ECD-95AB-591A216D0072@dancol.org> <868qopbp40.fsf@gnu.org> User-Agent: mu4e 1.12.8; emacs 31.0.50 Date: Fri, 28 Mar 2025 10:28:21 -0400 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 77224 Cc: mail@daniel-mendler.de, eg642616@gmail.com, juri@linkov.net, 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.0 (-) Eli Zaretskii writes: >> Date: Thu, 27 Mar 2025 16:41:39 -0400 >> From: Daniel Colascione >> CC: 77224@debbugs.gnu.org, eg642616@gmail.com, juri@linkov.net >> >> >> Regarding Emacs sluggishness, the `cursor-indicators-mode' is an >> >> optional mode. If it increases sluggishness unnacceptably (which it >> >> won't), users can turn it off. >> > >> >Experience shows that many users turn on a lot of features which rely >> >on post-command-hook, and then complain that Emacs is slow to respond. >> >Telling them to turn off features they like doesn't really work. >> >> Nor does telling external package authors not to use post-command-hook. > > Well, I could at least try ;-) Who knows, some of them might even > listen... > >> I think there are two worthwhile approaches: 1) time the entries in >> post-command-hook and alert users about slow ones, and 2) provide a >> "do something when X, Y, or Z changes" API that authors could use >> when they would otherwise put something on PCH and check X, Y, and Z >> internally. Internally, we could DTRT and omit running those hooks >> when the relevant conditions haven't changed. > > I'd be okay with developing 1), I think it's a good feature, given the > proliferation of features that use this hook. Yeah. SHTDI though, and I'm not going to be able to get to it soon. > As for 2), I think we already have that: add-variable-watcher. We > already use this for a small number of features. Does that fit the > bill? No, because variable watchers are synchronous --- also, they're hacky: they let you run arbitrary code at nearly arbitrary points. Like advice, they're a last resort and a debugging aid, and ISTM if we're using them to implement features, something is wrong. I think we're conditioned to understand that named functions can be advised, but most people aren't thinking of arbitrary variable assignments as extension points. The feature I'm proposing is higher-level than that. For example, for my personal use, I have something that sits in pre-redisplay-function and scans all the windows for applying highlights based on current buffer and window selection. I should have written this thing using the appropriate window configuration change hooks, but didn't, because I'm lazy and my approach is fast enough for me. ;; Don't do this. (defun window-highlight--pre-redisplay (_window) (window-highlight--rescan-windows)) (add-function :after pre-redisplay-function #'window-highlight--pre-redisplay)) What I'd have wanted instead is something like this: (run-when-changed (list (selected-window) (selected-frame) (frame-focus-state)) #'window-highlight--rescan-windows) Here, we'd run window-highlight--rescan-windows only when one of its dependent conditions (e.g. selected frame) changed. After any number of window and frame changes, we'd run window-highlight--rescan-windows *once*, immediately before its effects would become user-visible (e.g. just before redisplay, or after commands), and we wouldn't re-run it until one of its preconditions changed. It's certainly possible to do the same coalescing and change detection manually, but it's inconvenient. It's easier to just throw something in pre-redisplay or post-command-hook, so that's what people do. Level-triggered control is easier to reason about than edge-triggered control. From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 28 11:40:41 2025 Received: (at 77224) by debbugs.gnu.org; 28 Mar 2025 15:40:41 +0000 Received: from localhost ([127.0.0.1]:55243 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tyBp2-00015M-Lz for submit@debbugs.gnu.org; Fri, 28 Mar 2025 11:40:41 -0400 Received: from server.qxqx.de ([2a01:4f8:c012:9177::1]:44849 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 1tyBoz-000154-Co for 77224@debbugs.gnu.org; Fri, 28 Mar 2025 11:40:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=daniel-mendler.de; s=key; h=Content-Type:MIME-Version:Message-ID:Date: References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding: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=ZmIkepyiU2y96Ah/oqA2K/FyCmK11CqqYrgm7VlbmB8=; b=BiQHt8mT3YFRKlhuRmDat1GNtL FojHwQlOrzmw0X27MZQlnFMLPuVrWqPq+nAViddVwYLVRA7vRQkAIdGjFKa9HY/uAdbi3Dt3pqIol NPjnQpn5fXashfzPdVvHPA4Gu1wua/lWA1rDBCDCY2vnIyTkf3XIAJwZpFghQcbYxNRw=; From: Daniel Mendler To: Eli Zaretskii Subject: Re: bug#77224: [PATCH] New minor mode 'cursor-indicators-mode' In-Reply-To: <86bjtlbqge.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 28 Mar 2025 09:48:49 +0300") 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> <87a596a29y.fsf@daniel-mendler.de> <86tt7ebfnc.fsf@gnu.org> <877c4aa0m8.fsf@daniel-mendler.de> <86pli2befe.fsf@gnu.org> <878qoq5iui.fsf@daniel-mendler.de> <86bjtlbqge.fsf@gnu.org> Date: Fri, 28 Mar 2025 16:40:29 +0100 Message-ID: <87msd5rwnm.fsf@daniel-mendler.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain 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: eg642616@gmail.com, 77224@debbugs.gnu.org, juri@linkov.net >> Date: Thu, 27 Mar 2025 21:17:25 +0100 >> >> Here we discuss changing only the color of the cursor, a much much less >> complex operation. > > My point is that when the list on post-command-hook is long, it takes > Emacs time to process all the functions on the list, and the longer > the list, the less responsive Emacs will be. These small > insignificant delays add up. I see your point. But not only the length of the list but also the weight of the specific hook functions matters. A handful of insignificant delays add up, but will still stay insignificant. There are not that many hooks installed in the PCH list (see my list below). In the reports where users complain about slow Emacs, it seems more likely that one bad hook outweighs all the others. > How long is the post-command-hook list in your production sessions? > Should we poll users to give their data? Just yesterday someone > complained on Reddit that Emacs is too slow, and I have no doubt that > features that use post-command-hook are at least part of the reason if > not _the_ reason. Indeed. PCHs are a common reason for slow down. Even worse are functions which run during redisplay. Heavy custom mode lines seem to be the main problem here. My `post-command-hook' list looks like this: Buffer-local: (jit-lock--antiblink-post-command eldoc-schedule-timer corfu--auto-post-command jinx--reschedule whitespace-post-command-hook hl-line-highlight t) Global: (ibuffer-auto-update-changed repeat-post-hook) I don't have any problems with these hooks, since they are either cheap or only schedule some timers for more expensive operations. At least I don't notice any sluggishness and the PCHs don't appear in profiles. Daniel From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 28 12:02:35 2025 Received: (at 77224) by debbugs.gnu.org; 28 Mar 2025 16:02:35 +0000 Received: from localhost ([127.0.0.1]:55279 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tyCAE-00021U-Pm for submit@debbugs.gnu.org; Fri, 28 Mar 2025 12:02:35 -0400 Received: from mail-qk1-x735.google.com ([2607:f8b0:4864:20::735]:57771) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tyCA9-000211-68 for 77224@debbugs.gnu.org; Fri, 28 Mar 2025 12:02:32 -0400 Received: by mail-qk1-x735.google.com with SMTP id af79cd13be357-7c55b53a459so239309185a.3 for <77224@debbugs.gnu.org>; Fri, 28 Mar 2025 09:02:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743177743; x=1743782543; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=LiKQ6OhYd6nShG+nQ9B5Xxjr4M0Mf6i9mYrCm8H5lE8=; b=CxfbTdSg7J9KG4oLE/3O+rubj/VAEWb0pwbdSYrXCXSnkIWvaIcOnV7u+bQgXbmdbH 8apmYwLGzw0/f2QbZ8iUxs0OUfOyV/QFZiHtcN9LI7G6E6zAKE+YvbiaFl5YLX/1kwq7 jCw1khvJ48TIJs78z4H+2sZH8oArvlzly8vCjw4HRlpnjtN38O2tUTr+8i3pE4V5aSje 3epqLfLceFD5ZM0uEr5Rh+D8ERodHQUFZ8fdYeOuRL32dDb6FBOpH/BdmJcamn/5MHgU /Yr5ccCsKUR+2OOL9LBZEQ22AsHBtWh6OIHX9fDVeSXtoiUzpYF0JyQaDH3PJi/oFTUk DJkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743177743; x=1743782543; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=LiKQ6OhYd6nShG+nQ9B5Xxjr4M0Mf6i9mYrCm8H5lE8=; b=kV2o1W9yd5z0MRHU9SdSgFmrwCddOVkTNEgC1PBo2IP+R9AG6PPuhpYJQdKQn1oWvy AfoxyPWYsNHCOpQVyMv/czoy44EphhbAKF0I9Gxerl5BQDVHfx0Ta5jrB4mSQMx0jMJR i29oDs7Rw01LR5zZEf3yNLG6DUCYgB2Wlm1jpcdNvERksXnQLTz96w/CdbpYcj+ZxyPc fdoIyR6k35G1R4TIDyYIyAg5clCQvk7otfFnnOWot4i766fvUoY1mOzDXhkUX7/b0czx wMBh3f+JsuN9e664MHD4yAXCJJ/O5VFj0mBshlfcTR7DONhNeEx7tevqIGxjgt7/ELgS KHxA== X-Forwarded-Encrypted: i=1; AJvYcCV1FRY1uBjf5r9QNUhMnJWzns6zRLNaWew185+YwdoaUXxnj70Nu7vQer5jpfxBuI6rBzbwXg==@debbugs.gnu.org X-Gm-Message-State: AOJu0YzDT30CM5GPFcyo64St/Q9+plD0OY6p+ZCy6qoUTJpywheYXWnY 4S8JCUPsJ+AzFFxiM8kWXVXwJ20BfdRlYJ8Qu4y8oOySg0DWAPMsFDZS8fCEyzXacCwaYqCQGoH s1EHsv/qaDb7HacP9rENF5fCB/kg= X-Gm-Gg: ASbGncs7kCYv1ybxqRpuWA+x5CgCfNPpQT5932XJxSjGdwz20bcGxmdIpril3h+sl4N QG5oAsE9BkNojM/iopHs7jZbGmJQ/9nRyt/wTIoXWnR9kgzfSInxAGjZS0xClRwisqogtxYzhtV VoO5aE+pBoosjkLqcDOxMsBFmx2g== X-Google-Smtp-Source: AGHT+IGqrYXd022XFC8m3cgoZn0csDywKmD9H+DS1A3KZ27c+l1HXkmj7sM4xc6Yyy1g2+noQZizbVM1huI7pjLzKSU= X-Received: by 2002:a05:620a:44c1:b0:7c5:4d2e:4d26 with SMTP id af79cd13be357-7c5eda8cd34mr1252071385a.51.1743177742615; Fri, 28 Mar 2025 09:02:22 -0700 (PDT) MIME-Version: 1.0 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> <87a596a29y.fsf@daniel-mendler.de> <86tt7ebfnc.fsf@gnu.org> <877c4aa0m8.fsf@daniel-mendler.de> <86pli2befe.fsf@gnu.org> <878qoq5iui.fsf@daniel-mendler.de> <86bjtlbqge.fsf@gnu.org> <87msd5rwnm.fsf@daniel-mendler.de> In-Reply-To: <87msd5rwnm.fsf@daniel-mendler.de> From: Ship Mints Date: Fri, 28 Mar 2025 12:02:11 -0400 X-Gm-Features: AQ5f1JqmxXvo0IXzuZtm0_gXrITq-4Qud7nu134VYX_gvWopNiY5Dw0qLbber-o Message-ID: Subject: Re: bug#77224: [PATCH] New minor mode 'cursor-indicators-mode' To: Daniel Mendler Content-Type: multipart/alternative; boundary="000000000000210a280631693292" X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 77224 Cc: 77224@debbugs.gnu.org, Eli Zaretskii , 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.0 (-) --000000000000210a280631693292 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Mar 28, 2025 at 11:41=E2=80=AFAM Daniel Mendler via Bug reports for= GNU Emacs, the Swiss army knife of text editors wrote: > Eli Zaretskii writes: > > >> From: Daniel Mendler > >> Cc: eg642616@gmail.com, 77224@debbugs.gnu.org, juri@linkov.net > >> Date: Thu, 27 Mar 2025 21:17:25 +0100 > >> > >> Here we discuss changing only the color of the cursor, a much much les= s > >> complex operation. > > > > My point is that when the list on post-command-hook is long, it takes > > Emacs time to process all the functions on the list, and the longer > > the list, the less responsive Emacs will be. These small > > insignificant delays add up. > > I see your point. But not only the length of the list but also the > weight of the specific hook functions matters. A handful of > insignificant delays add up, but will still stay insignificant. There > are not that many hooks installed in the PCH list (see my list below). > In the reports where users complain about slow Emacs, it seems more > likely that one bad hook outweighs all the others. > > > How long is the post-command-hook list in your production sessions? > > Should we poll users to give their data? Just yesterday someone > > complained on Reddit that Emacs is too slow, and I have no doubt that > > features that use post-command-hook are at least part of the reason if > > not _the_ reason. > > Indeed. PCHs are a common reason for slow down. Even worse are functions > which run during redisplay. Heavy custom mode lines seem to be the main > problem here. > > My `post-command-hook' list looks like this: > > Buffer-local: > (jit-lock--antiblink-post-command eldoc-schedule-timer > corfu--auto-post-command jinx--reschedule > whitespace-post-command-hook hl-line-highlight t) > > Global: > (ibuffer-auto-update-changed repeat-post-hook) > > I don't have any problems with these hooks, since they are either cheap > or only schedule some timers for more expensive operations. At least I > don't notice any sluggishness and the PCHs don't appear in profiles. > I have experienced issues in the past with PCH entries and cleaned it all up ages ago and try to keep an eye on it. One culprit was the pyvenv tracker which I rewrote a private copy of to use a different method that achieves the same effect with less overhead. Out of both curiosity and to butt in on this discussion, I posted this casual survey on reddit https://www.reddit.com/r/emacs/comments/1jlyek0/show_your_postcommandhook_c= ontents_to_help_emacs/ Perhaps we'll see that the bulk of people's PCH is the usual well-performing suspects. I posted mine. -Stephane --000000000000210a280631693292 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
= On Fri, Mar 28, 2025 at 11:41=E2=80=AFAM Daniel Mendler via Bug reports for= GNU Emacs, the Swiss army knife of text editors <bug-gnu-emacs@gnu.org> wrote:
<= div class=3D"gmail_quote gmail_quote_container">
Eli Zaretskii <eliz@gnu.org> writes:

>> From: Daniel Mendler <mail@daniel-mendler.de>
>> Cc: eg6426= 16@gmail.com,=C2=A0 77224@debbugs.gnu.org,=C2=A0 juri@linkov.net
>> Date: Thu, 27 Mar 2025 21:17:25 +0100
>>
>> Here we discuss changing only the color of the cursor, a much much= less
>> complex operation.
>
> My point is that when the list on post-command-hook is long, it takes<= br> > Emacs time to process all the functions on the list, and the longer > the list, the less responsive Emacs will be.=C2=A0 These small
> insignificant delays add up.

I see your point. But not only the length of the list but also the
weight of the specific hook functions matters. A handful of
insignificant delays add up, but will still stay insignificant. There
are not that many hooks installed in the PCH list (see my list below).
In the reports where users complain about slow Emacs, it seems more
likely that one bad hook outweighs all the others.

> How long is the post-command-hook list in your production sessions? > Should we poll users to give their data?=C2=A0 Just yesterday someone<= br> > complained on Reddit that Emacs is too slow, and I have no doubt that<= br> > features that use post-command-hook are at least part of the reason if=
> not _the_ reason.

Indeed. PCHs are a common reason for slow down. Even worse are functions which run during redisplay. Heavy custom mode lines seem to be the main
problem here.

My `post-command-hook' list looks like this:

Buffer-local:
(jit-lock--antiblink-post-command eldoc-schedule-timer
=C2=A0corfu--auto-post-command jinx--reschedule
=C2=A0whitespace-post-command-hook hl-line-highlight t)

Global:
(ibuffer-auto-update-changed repeat-post-hook)

I don't have any problems with these hooks, since they are either cheap=
or only schedule some timers for more expensive operations. At least I
don't notice any sluggishness and the PCHs don't appear in profiles= .

I have experienced issues in the past with PCH entries a= nd cleaned it all up ages ago and try to keep an eye on it.=C2=A0 One culpr= it was the pyvenv tracker which I rewrote a private copy of to use a differ= ent method that achieves the same effect with less overhead.

Out of both curiosity and t= o butt in on this discussion, I posted this casual survey on reddit=C2=A0https://www.reddit.com/r/emacs/comments/1j= lyek0/show_your_postcommandhook_contents_to_help_emacs/

Perhaps we'll see that t= he bulk of people's PCH is the usual well-performing suspects.=C2=A0 I = posted mine.

= -Stephane
--000000000000210a280631693292-- From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 28 12:32:48 2025 Received: (at 77224) by debbugs.gnu.org; 28 Mar 2025 16:32:48 +0000 Received: from localhost ([127.0.0.1]:55333 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tyCdT-0003N0-Mn for submit@debbugs.gnu.org; Fri, 28 Mar 2025 12:32:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55338) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tyCdR-0003Mk-H5 for 77224@debbugs.gnu.org; Fri, 28 Mar 2025 12:32:46 -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 1tyCdJ-0007j0-UU; Fri, 28 Mar 2025 12:32:37 -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=CjL2ybXZG+QdowPfIYO9CCBP50aVxlxYh/4flI6wfIc=; b=P2LhZiolUlIB An7l1JjOicE7K9FcwnSb91g/vRJgTCGGj/PB5hDKdsJmPd5IR4Fsqic1hMUQQBVhcxd7n/YP5L/ND o94hI/BLIC86Tkz444VWgkXDY+Z+Lill5nupoVUoY5uLQ5EYRoNJZzhyO0S0mAj/wRqX/w9UEqcGy lN5AFSR9d15f6Qm476I7JyJ3AMLC14udDYfUlCf4/LmO5XgCrdDHbwaqS9ueRAJhq8ar8E9iQlL7J 1HugZPy0xUp2Db7weIVEdKG9Y0DMssPuwdB9bijtNa8Ua5RftStkBvYT2zNn1GtW4EeLG4F1J/v4R zJR5Yq5163laWfq2Ink+dw==; Date: Fri, 28 Mar 2025 19:32:35 +0300 Message-Id: <86frix9kv0.fsf@gnu.org> From: Eli Zaretskii To: Daniel Mendler In-Reply-To: <87msd5rwnm.fsf@daniel-mendler.de> (message from Daniel Mendler on Fri, 28 Mar 2025 16:40:29 +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> <86cye2d8t6.fsf@gnu.org> <87a596a29y.fsf@daniel-mendler.de> <86tt7ebfnc.fsf@gnu.org> <877c4aa0m8.fsf@daniel-mendler.de> <86pli2befe.fsf@gnu.org> <878qoq5iui.fsf@daniel-mendler.de> <86bjtlbqge.fsf@gnu.org> <87msd5rwnm.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: Fri, 28 Mar 2025 16:40:29 +0100 > > Eli Zaretskii writes: > > My `post-command-hook' list looks like this: > > Buffer-local: > (jit-lock--antiblink-post-command eldoc-schedule-timer > corfu--auto-post-command jinx--reschedule > whitespace-post-command-hook hl-line-highlight t) And in Org buffers? From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 28 12:49:54 2025 Received: (at 77224) by debbugs.gnu.org; 28 Mar 2025 16:49:54 +0000 Received: from localhost ([127.0.0.1]:55357 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tyCu2-000467-Gn for submit@debbugs.gnu.org; Fri, 28 Mar 2025 12:49:54 -0400 Received: from server.qxqx.de ([2a01:4f8:c012:9177::1]:60087 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 1tyCtz-00045s-GA for 77224@debbugs.gnu.org; Fri, 28 Mar 2025 12:49:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=daniel-mendler.de; s=key; h=Content-Type:MIME-Version:Message-ID:Date: References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding: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=QfCGtxS40BoaHNjg/bAr7VuG0/emh7rGgoS4VgUASkY=; b=unipgFxhI3A11glY+hJed1TmE0 MgU7mc2J7cxUBiFSysgZnXIFfcROrq6OdW6tQWVM6QUSPnJLjNFDg+ZrHl7QtEaJRokSs3sj7n6JL gSv4UXoxf0iSr1aJYKaEG7WQ2P90a+CvZ+kcuWhSNGEn3ERqAsKmDUsO+4ZBpqcDxFgY=; From: Daniel Mendler To: Eli Zaretskii Subject: Re: bug#77224: [PATCH] New minor mode 'cursor-indicators-mode' In-Reply-To: <86frix9kv0.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 28 Mar 2025 19:32:35 +0300") 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> <87a596a29y.fsf@daniel-mendler.de> <86tt7ebfnc.fsf@gnu.org> <877c4aa0m8.fsf@daniel-mendler.de> <86pli2befe.fsf@gnu.org> <878qoq5iui.fsf@daniel-mendler.de> <86bjtlbqge.fsf@gnu.org> <87msd5rwnm.fsf@daniel-mendler.de> <86frix9kv0.fsf@gnu.org> Date: Fri, 28 Mar 2025 17:49:44 +0100 Message-ID: <87frixaymv.fsf@daniel-mendler.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain 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: eg642616@gmail.com, 77224@debbugs.gnu.org, juri@linkov.net >> Date: Fri, 28 Mar 2025 16:40:29 +0100 >> >> Eli Zaretskii writes: >> >> My `post-command-hook' list looks like this: >> >> Buffer-local: >> (jit-lock--antiblink-post-command eldoc-schedule-timer >> corfu--auto-post-command jinx--reschedule >> whitespace-post-command-hook hl-line-highlight t) > > And in Org buffers? The first list was from the *scratch* buffer. This one is from an Org buffer: (eldoc-schedule-timer corfu--auto-post-command jinx--reschedule whitespace-post-command-hook hl-line-highlight t) Daniel From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 28 12:58:51 2025 Received: (at 77224) by debbugs.gnu.org; 28 Mar 2025 16:58:51 +0000 Received: from localhost ([127.0.0.1]:55372 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tyD2g-0004VU-Tj for submit@debbugs.gnu.org; Fri, 28 Mar 2025 12:58:51 -0400 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]:41988) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tyD2e-0004VC-9h for 77224@debbugs.gnu.org; Fri, 28 Mar 2025 12:58:49 -0400 Received: by mail-pj1-x1035.google.com with SMTP id 98e67ed59e1d1-30185d00446so3373111a91.0 for <77224@debbugs.gnu.org>; Fri, 28 Mar 2025 09:58:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743181122; x=1743785922; darn=debbugs.gnu.org; h=mime-version:message-id:date:references:in-reply-to:subject:to:from :from:to:cc:subject:date:message-id:reply-to; bh=suLdeU+Qre03xN2jVaFzghuvZHM9i3XFgYAQdUMEYY8=; b=cQeQVns5geixko5P0jSI8kaqzP/lRgPClwLRTsw8tGqs4Uf6ZuCk7uvS5pe1aNN07Q CZxhUOYIuQKkjXB6YG/D+oe6niXNPjPheJKWquFpo3jmPbcc9oBelKPNM1pTVxOwWZAs X78ftHFeuRgHmO9kt4QB/zD+mmH4tI/+hWX6vBG9jk65dTwu+q5+IoSo1btYtGkLLq8Y 7N5N7OUXxa+b/h2DTL9appCxnQLgsclS1rPJx0AYG46JYPykfARLGp5dF3i3U4iEj5V6 usblxgfeGawLB+sFHHAXtqRqiXxaqlrKY/rT8s/xV4WEqkku4Oe7u4QYl5YH9SWHq65W UIzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743181122; x=1743785922; h=mime-version:message-id:date:references:in-reply-to:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=suLdeU+Qre03xN2jVaFzghuvZHM9i3XFgYAQdUMEYY8=; b=VvZC6S+lffPAmg+uk8wTXWkS07ySrMPUMfxCXeo9DW2CfDbPb/nHZiMVrmTaQ3MZ9Z xmBcPbSo27KlLFRVjOXN21mRAVwCfPQTzdECAdLI0KqnKtf0tekBoLmsEshDL9YIwdqi XldC8JTSICXhTBVGdJYBwMuY9qVfbd6PieKR3uylVoAjfBAUndcecdpjeCDcNoXx2qtI RVWMiYGfFTvJIdDxSBrqGL6YYqnoKRTv0TozFHq4JT2yH9mR0T4Tmj57CfBSafTcxiUq 7wI6W5x1QSAKTHeJhAXT3bo4orzyXI5wGqtZgRlMKoBPn84RRX9Z4qMvE3zt37zvnHEQ kVrQ== X-Forwarded-Encrypted: i=1; AJvYcCVM1efhNh/dk28HmXO1bwAlMsdMng0l+1W+I80Gs+NF3Sll7Uuf3EHJfjj4/liDS1wCnEnDGA==@debbugs.gnu.org X-Gm-Message-State: AOJu0YxB5I1E3jAD3mTGj0No3KbtO2RXqsOaIMr7tWWWzeUVKPy5PbsJ umdnfT6I/e3NqBMN3shBfvK58EDQkdmkLCqksWavIylZZvHUQPEH X-Gm-Gg: ASbGncvdR7Lpthjq4Z9aUxYvEtRz8QxmMM3FcSgixvGkoQSKhxnxI5N/tpIRpsTp3tL r42Ev+r7Hp6T5XWU9Vf6pypNNoLV0AS69Ib3buEsyZsuDPtumSb5lAK/3Wrda/m5Y4MbGmvFNuy vszu+mck6N/JgmHbqGt4pehh1ItF+LFx0/5pMvIq+IsqGve9YMe19MHkroRYvoJAjbigABT4/tW JTUNaWv39Nl7+5n2zOqel9oJARB6PVN9DUWIEjcaBEVzROpCdrdGHd1xVPIjzx/wQ2RMM67nqA4 YQS9X7EILARSMKEWnRNxCI5A2SiiC2FZDy4DhGa236DyvHnscMSQVA== X-Google-Smtp-Source: AGHT+IGsS4HxiZ0Kr9dnoSdzDXG4fI1/W2fsEAw/MKz3nLODJX/BLShdzHfJa+b7BCVXO6GbU6Delw== X-Received: by 2002:a17:90b:2dcc:b0:2ff:53d6:2b82 with SMTP id 98e67ed59e1d1-3051c9519damr5908488a91.11.1743181121896; Fri, 28 Mar 2025 09:58:41 -0700 (PDT) Received: from localhost ([169.231.47.234]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-30516d56344sm2133497a91.17.2025.03.28.09.58.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Mar 2025 09:58:41 -0700 (PDT) From: Karthik Chikmagalur To: Eli Zaretskii , Daniel Mendler , 77224@debbugs.gnu.org, eg642616@gmail.com, juri@linkov.net Subject: Re: bug#77224: [PATCH] New minor mode 'cursor-indicators-mode' In-Reply-To: <86bjtlbqge.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 28 Mar 2025 09:48:49 +0300") 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> <87a596a29y.fsf@daniel-mendler.de> <86tt7ebfnc.fsf@gnu.org> <877c4aa0m8.fsf@daniel-mendler.de> <86pli2befe.fsf@gnu.org> <878qoq5iui.fsf@daniel-mendler.de> <86bjtlbqge.fsf@gnu.org> Date: Fri, 28 Mar 2025 09:58:39 -0700 Message-ID: <87pli1hz28.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 77224 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 (-) > How long is the post-command-hook list in your production sessions? > Should we poll users to give their data? Just yesterday someone > complained on Reddit that Emacs is too slow, and I have no doubt that > features that use post-command-hook are at least part of the reason if > not _the_ reason. Here is my post-command-hook in an Org mode buffer in Emacs 29: (yas--post-command-handler org-latex-preview-auto--handle-post-cursor visible-mark-move-overlays dot-mode-loop corfu--auto-post-command t) That's the buffer-local value. In addition, the global value is: (global-font-lock-mode-check-buffers global-eldoc-mode-check-buffers global-prettify-symbols-mode-check-buffers magit-auto-revert-mode-check-buffers c-post-command repeat-post-hook mode-local-post-major-mode-change) ----- And here are the minor modes I'm using that are installing these hooks. Modes from packages I've installed explicitly: - org-latex-preview-auto-mode: Detects and previews LaTeX fragments in Org buffers as they are typed. (I authored this mode, it is designed to be as nonintrusive as possible.) - yas-minor-mode: for Yasnippets (template expansion) - visible-mark-mode: Highlights the position of the usually invisible mark. - dot-mode: Vim-style repeat operator for text insertion. - corfu-mode: Autocompletion as you type. The following modes are from built-in Emacs packages: - font-lock-mode - global-eldoc-mode - global-prettify-symbols-mode - repeat-mode Of the remaining, I use Magit with its default settings, under which it installs `magit-auto-revert-mode-check-buffers'. I don't know why `c-post-command' is in the global post-command-hook. I haven't even edited any C files in this Emacs session. I don't know why `mode-local-post-major-mode-change' is installed either. ------ Although my Emacs isn't so slow that I can't type comfortably, I can definitely perceive some difference between Emacs' responsiveness with the above settings and `emacs -q'. I would very much like some of these to be moved into different hooks that trigger only when required. Daniel's idea for something like this: (call-on-change (:buffer :window :focus) #'my-thing) would be very useful. > So I maintain that we should try to avoid post-command-hook for > operations that should happen very rarely (this case is one such case: > we only want to run this code when something is turned on or off). > Even if the reaction to the change is a bit slower, it is worth our > while to pay that price: users will be a tad happier with Emacs > response times. And if there are alternative methods of doing the > same, like the respective mode hooks in this case, we should use them > without thinking twice. Ideally, post-command-hook should only be > used for stuff that really must be done after almost every command; > for any other cases we should look for other Emacs features to do the > job. For this reason I try quite hard to avoid using post-command-hook in my packages. Karthik From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 28 17:13:21 2025 Received: (at 77224) by debbugs.gnu.org; 28 Mar 2025 21:13:21 +0000 Received: from localhost ([127.0.0.1]:55734 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tyH0y-000851-Ll for submit@debbugs.gnu.org; Fri, 28 Mar 2025 17:13:21 -0400 Received: from mail-qk1-x72f.google.com ([2607:f8b0:4864:20::72f]:54453) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tyH0v-00084i-9M for 77224@debbugs.gnu.org; Fri, 28 Mar 2025 17:13:18 -0400 Received: by mail-qk1-x72f.google.com with SMTP id af79cd13be357-7c5ba363f1aso373513685a.0 for <77224@debbugs.gnu.org>; Fri, 28 Mar 2025 14:13:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743196391; x=1743801191; darn=debbugs.gnu.org; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=Bnd5VtHEHNl9ALhd5Hwq4F9CR0ohe3QzwBu/mk302lU=; b=BSCKQ9TvHtlrxCqZmcVe5A5OA1sMmtUC/b3xFmGeCRR/jr/2VxYL9ONgolgjvvGCNI xTz1nFUN4Yk3TB59IxATCe1nZ+uEEerzCqwEwsmVl9xggstxmiCMiVva6tSTs6YVj/UQ gmtTLBD+Ae75vTTyOu7GNVujSFGxN2X93vs9JSViix+pdM8SVYtK7bJ+B4Dt3XQ0tfyV 9KjJM1tRpIri38hCIWGfNALfGVa79RzAAlBLeXCPNL37k2oojHulSRM+u7swTm48HD3q 9x75b0Vs6dMzdmEJdVYYJEtXbtvzrKr8MJM6eqbubrmuKAZDyCCKyFDgnxlNRJ4Q4MtS upGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743196391; x=1743801191; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Bnd5VtHEHNl9ALhd5Hwq4F9CR0ohe3QzwBu/mk302lU=; b=K+vps+0tfZlyFmnuUUxkoZ59T1w1eip6Y3foZyY2/l2XQJ4H43pzOBKQMps/j+zH5V ePoVk8Y6aqjTf565qTmE9xiy7BApWjb4zGcUTaY+Nq1USpyXByda8KAuhCB8RdhVq8y0 CUMN0H6tpPtLs5liSefgh/pnMjx/bQeY/0d/yVwZWdKcPCHgOktS91i99rOr3utcvnAw MbFsVPE0nrKMT6CTtQ8QWDA+iu1zRjpMrwN9bUuQ92j3HtnAERpcEZ2gssV/y1VPZSTK PI27SfgJuUikMbZSoRxj22UnfaWhLPYNPWKMabCl6zlxsue5TzSqlbBAJOFuzl+Nw4On 9zeQ== X-Forwarded-Encrypted: i=1; AJvYcCUl4NEIwMHuZ5XthTYmD5zWJYCuUlVQ1Qr8NF/B3Yo0DrhfAxTpyhM621ti2GuONuhqHDYI8A==@debbugs.gnu.org X-Gm-Message-State: AOJu0Yyuq/efQ8f1glJ+HK9Zq9Kx+cEdHTv+x3vd9mkfOSqlXt8zpcMj bJ3T8fjsAcXDrs5y0eZ+eh1pjsZkFMrcMfMsHPNzoq6Yjy1Ydtzb X-Gm-Gg: ASbGncvRT8+i0q3a6CDEK8srZwE6feDpG9p5SDk2Q6k1KGIbY+8Gw4viokIVzJEBm53 jNB6y4LxLTtIRpXw1hqBIf+75CEBWJL4QHBlcbEzgePcJd4MrnwPpueApEH+M2ryXYAU1Qk1ymE 0bUtHJnLtKtjQbL4OoDJu/Tu+FdXCXH7L0pJVeJF+Iy0DJdM0SjLVEbzK1c/+DyPcEdwq6Nnqle LJcmzPDM2V6qTR6V2d/89yT4MoPiHedfhzZ8uNzVRCQDv3JR3zzctMip/+v5cF600ffpxEFKyRG zTYJoqYq5VQ3QOMSSs6enOMiW0NgmVAVLxeTM92Vatkfq5da8WMEdjA/WprjUhcbywTJxCW1YBc TgfkH X-Google-Smtp-Source: AGHT+IF1FyiQWArFvwoWLBSRI9xP+bqBRunrKo1/SWhIfn9vzxroH4yySL47JLVfpf5z8lHt+nbIbw== X-Received: by 2002:a05:620a:280d:b0:7c3:bdce:d1f7 with SMTP id af79cd13be357-7c690891588mr90037085a.58.1743196391240; Fri, 28 Mar 2025 14:13:11 -0700 (PDT) Received: from smtpclient.apple (bwi-cc2.slicewireless.net. [76.76.25.7]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7c5f7764e8dsm164701385a.88.2025.03.28.14.13.09 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Mar 2025 14:13:10 -0700 (PDT) From: JD Smith Message-Id: Content-Type: multipart/alternative; boundary="Apple-Mail=_5AD74124-9F29-40F5-9C93-E462796AB6EF" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.400.131.1.6\)) Subject: Re: bug#77224: [PATCH] New minor mode 'cursor-indicators-mode' Date: Fri, 28 Mar 2025 17:12:59 -0400 In-Reply-To: <87msd5r4z8.fsf@mail.linkov.net> To: Juri Linkov 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> <87a596a29y.fsf@daniel-mendler.de> <86tt7ebfnc.fsf@gnu.org> <44319BF5-31B5-4ECD-95AB-591A216D0072@dancol.org> <87a595tyzt.fsf@gmail.com> <87msd5r4z8.fsf@mail.linkov.net> X-Mailer: Apple Mail (2.3826.400.131.1.6) X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 77224 Cc: 77224@debbugs.gnu.org, =?utf-8?Q?Elijah_Gabe_P=C3=A9rez?= , Daniel Colascione , Eli Zaretskii , mail@daniel-mendler.de 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 (-) --Apple-Mail=_5AD74124-9F29-40F5-9C93-E462796AB6EF Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Mar 28, 2025, at 3:30=E2=80=AFAM, Juri Linkov = wrote: >=20 > Please note that this is insufficient for 'repeat-mode'. > Currently it requires adding an advice to update the cursor > on the repeat timer events: I solved this problem by wrapping the `repeat-echo-function' and = `after-focus-change-function'. https://gist.github.com/jdtsmith/a169362879388bc1bdf2bbb977782d4f=EF=BF=BC= Emacs: change cursor color during active repeat-mode commands gist.github.com= --Apple-Mail=_5AD74124-9F29-40F5-9C93-E462796AB6EF Content-Type: multipart/related; type="text/html"; boundary="Apple-Mail=_95FE29A4-2B04-4591-9268-BE4AE14C8FA0" --Apple-Mail=_95FE29A4-2B04-4591-9268-BE4AE14C8FA0 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

On Mar 28, 2025, at 3:30=E2=80=AFAM, Juri Linkov = <juri@linkov.net> wrote:

Please = note that this is insufficient for 'repeat-mode'.
Currently it requires adding an advice to = update the cursor
on the = repeat timer events:

I = solved this problem by wrapping the `repeat-echo-function' and = `after-focus-change-function'.