From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stephen Berman via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#73986: 31.0.50; Allow suppressing message passed to set-transient-map Date: Thu, 24 Oct 2024 16:06:22 +0200 Message-ID: <874j51r3xd.fsf@gmx.net> Reply-To: Stephen Berman Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16431"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: 73986@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Oct 24 16:07:49 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1t3yVA-00044C-PV for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 24 Oct 2024 16:07:49 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t3yUw-0006PI-O8; Thu, 24 Oct 2024 10:07:34 -0400 Original-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 1t3yUu-0006Lq-31 for bug-gnu-emacs@gnu.org; Thu, 24 Oct 2024 10:07:32 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t3yUt-0004Qj-Pq for bug-gnu-emacs@gnu.org; Thu, 24 Oct 2024 10:07:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:Subject; bh=xiG2gmmGPSD5S9hE7mVbW76nI3xsj9BZ/2C9J5hdJi4=; b=MiPJ/qYe4uIgkVihGtkVisQpEYArYLy0BIVR6fCqY+b2aEu+uKLaPaO39sO5VIbUm9DrSAah6ol9deQfQCijzohhMvSA9Go7wX7Y5t0hQk9YWsot5bSYXPAvh5N6tEnV1jaN3Yg+l7c106np64crYJFU4cNPHp+4ixKc2quaMyn47qAueM1iFX8uXFnKjy/5M2feap053KTYFkaYgYArXuwD3MXcH3aWQ5ZTvessXJj4jgE9rODuLViC3COC8AdFVP/Xhw9w+RinsPIoDF1YWhGLqsB/P3v9QG/4lTn9+VDGu53k1/LYEEr2c2IRA0WSQ3PRP7RxrqleZYFYhcs9xQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t3yVO-0005tn-78 for bug-gnu-emacs@gnu.org; Thu, 24 Oct 2024 10:08:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stephen Berman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 24 Oct 2024 14:08:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 73986 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.172977882522589 (code B ref -1); Thu, 24 Oct 2024 14:08:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 24 Oct 2024 14:07:05 +0000 Original-Received: from localhost ([127.0.0.1]:35773 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t3yUS-0005sG-Qh for submit@debbugs.gnu.org; Thu, 24 Oct 2024 10:07:05 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:45716) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t3yUO-0005rp-I7 for submit@debbugs.gnu.org; Thu, 24 Oct 2024 10:07:03 -0400 Original-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 1t3yTt-0005uQ-24 for bug-gnu-emacs@gnu.org; Thu, 24 Oct 2024 10:06:29 -0400 Original-Received: from mout.gmx.net ([212.227.15.19]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t3yTp-0004Lj-5W for bug-gnu-emacs@gnu.org; Thu, 24 Oct 2024 10:06:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1729778783; x=1730383583; i=stephen.berman@gmx.net; bh=xiG2gmmGPSD5S9hE7mVbW76nI3xsj9BZ/2C9J5hdJi4=; h=X-UI-Sender-Class:From:To:Subject:Date:Message-ID:MIME-Version: Content-Type:cc:content-transfer-encoding:content-type:date:from: message-id:mime-version:reply-to:subject:to; b=Eg1kC41X4mz/XlrTHwEFUs8yAA5cYlM6YxWgMhXHI44iFzvn43lNEPqTHyrC9e+6 aDJXPR+b4jy7f9COtnwSRbX8KKM+Y1wz90SPivuKLLaZ3JrLNOi4NUblWNK5B9Ezy ynydzY3ko/QCDKpDHcK4K9c+S+7tPEDmGi+IXEMd5Rij7072nWUPgoMLhW8tvqCZh gZzZ3lydTwgVdfXrfquFpaGWucmhjbTYnLosMXn+di3+tkWAeSg/PMmCsR9Ljjh7g WNzJl7H58Lplfd1R1ykSDCiBuQugTTsdbiMHJa9bEO3Uq4LtBmj6T4N+naQvI56uJ cmxg0DjpFNuI8cMk9w== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from strobelfssd ([88.130.48.171]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MplXz-1tguKg0yuz-00iN4B for ; Thu, 24 Oct 2024 16:06:23 +0200 X-Provags-ID: V03:K1:TYSdcT1zs0f6sLhZRiAavXUGhDwFM5VmmHSweXRY1qml/ivHZNa /gQGkfntkl7fHhsUpfooHKYOeEox3fofz2PWqJVBDvZSkHf2ZSnxFT7Z9V4F+FzNB7a2LUy rMugf3UC8dfWbux+RmrlXcG6S15IdK7mwP03sfpqB9KW3U4vc9LOBRF0J0HU60Pskr10yRB x+pV6LDGq6t1goJqrCOhw== UI-OutboundReport: notjunk:1;M01:P0:CS/S1r/bW7I=;YQb9lBup1etMIboUqt/2f7syTY6 HWmufnC05qH57o5ocD7/0FmE+fD1A7Fqdyrclil5MTEkJCKdnFcvhHlAYDaWp7dTkrm3Do8GR yEfFg+QCW+rQjwHvJH7OwoKWVoQEW8qKZrEg4FYLpjHXDyECLwZJffgkFAf+w2aR8bV+/ihSG +/7CNpE9NYcpEAU1qs4mXBI2wy97Uoz+KaiAhksxelx9jMc35NkssyCZlhsPlI6BY1R/XfCln srsXU4BKPz23UgDZoAOJAMapUdA8CVjii3ichv1GRsfxNU+TruXiaivb5nhKdBwCZecmXxypz FS03+E3C9oRR/+7kOYAn0n85TYDDEWrRyrkNTTgYIkgknFyO1vYQmr4pRIsaKPd9a4U245k54 xI9P/NaZbW3gGEpJi2jCb5/3mvEujN3kGwJZEvrfmKD9Gji9OlscRixJwxGs+vYmEAlTTM5T2 2g2NCgwcyoOHzrCGH1Gjpdn/uua4LWwl7HYKo53TcjjG/Qtr54rSjLSpYH2UVIrRrNcREnwR4 xdv2xjXaEsR0NMQrUaPSYrSa7aaAOLkWf9RQvOdVlZkix8/NH5jcojgOIYObrXdowNmlxl8bB P3d0XNkg6FQDOZ2l8ELLBQw/pJXiKgzOswjpgrasXzuh/jKSRwQKJ1RB2y6so2PQXSvrGLX2h B0nRNlsxP01x8jGhu0Dl5WLheqcbdf80LqFcUXOJjiPgki+cVfL4O7gKKPNF1gMg6Kp/BwNsn CCeYdM1L4k/tJhjmy//QRjL2wzci9MNeFH7V7uAFoPhFy6Tt03okDqvw5oywUbztp3vY0p+o Received-SPF: pass client-ip=212.227.15.19; envelope-from=stephen.berman@gmx.net; helo=mout.gmx.net X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 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_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-1.697, 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:294190 Archived-At: --=-=-= Content-Type: text/plain If a caller of set-transient-map passes a suitable format string, this is displayed as a message on activating the transient map. An example is text-scale-adjust, which displays the message "Use +, =, -, 0, C-+, C-=, C--, C-0 for further adjustment". So if after typing `C-x C-+' you immediately type `+ + + - - -', the text size increases three times and then decreases three times. But on each key press the message is redisplayed, which is slighty annoying (it actually looks like it stays in the echo area but there is a brief flicker on each key press); the message is helpful the first time, if you're unfamiliar with the command, but on repeated uses, it becomes visual noise. So I propose a user option to suppress the message, as in the attached patch. One thing I'm not sure about is whether the call to `message' in the local function `clearfun' of set-transient-map, which is added to pre-command-hook, should also be conditioned on the proposed user option; I tested both with and without such conditioning and saw no difference, so the patch omits it. But I admit I don't see what the purpose of clearfun is, so maybe it should be so conditioned. If the patch (or a corrected version of it) is accepted, I will also update the elisp manual and NEWS accordingly. (An alternative to the above proposal is suppressing the message after displaying it once (or perhaps n times, though that seems extravagant). Or allowing both alternatives (or all three) as values of the user option. I prefer the simpler display-or-suppress proposal, but can implement an alternative if desired.) In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.43, cairo version 1.18.2) of 2024-10-21 built on strobelfssd Repository revision: b3af195213518514f78ac6f66f9598e45befd1ec Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12101013 System Description: Linux From Scratch r12.2-17-systemd Configured using: 'configure -C 'CFLAGS=-Og -g3' PKG_CONFIG_PATH=/opt/qt6/lib/pkgconfig' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG LCMS2 LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB --=-=-= Content-Type: text/x-patch Content-Disposition: attachment Content-Description: set-transient-map patch Content-Transfer-Encoding: quoted-printable diff --git a/lisp/subr.el b/lisp/subr.el index 4771ac1fba2..6716c975318 100644 =2D-- a/lisp/subr.el +++ b/lisp/subr.el @@ -6549,6 +6549,13 @@ set-transient-map-timeout (defvar set-transient-map-timer nil "Timer for `set-transient-map-timeout'.") +(defcustom set-transient-map-suppress-message nil + "Whether to suppress a message on activating the transient map. +If non-nil, do not display a message passed to `set-transient-map'." + :group 'convenience + :type 'boolean + :version "31.1") + (defun set-transient-map (map &optional keep-pred on-exit message timeout= ) "Set MAP as a temporary keymap taking precedence over other keymaps. Normally, MAP is used only once, to look up the very next key. @@ -6561,10 +6568,11 @@ set-transient-map called, with no arguments, after MAP is deactivated. Optional arg MESSAGE, if non-nil, requests display of an informative -message after activating the transient map. If MESSAGE is a string, -it specifies the format string for the message to display, and the %k -specifier in the string is replaced with the list of keys from the -transient map. Any other non-nil value of MESSAGE means to use the +message after activating the transient map, unless the user option +`set-transient-map-suppress-message' is also non-nil. If MESSAGE is a +string, it specifies the format string for the message to display, and +the %k specifier in the string is replaced with the list of keys from +the transient map. Any other non-nil value of MESSAGE means to use the message format string \"Repeat with %k\". Upon deactivating the map, the displayed message will be cleared out. @@ -6638,7 +6646,8 @@ set-transient-map (when timeout (when set-transient-map-timer (cancel-timer set-transient-map-timer= )) (setq set-transient-map-timer (run-with-idle-timer timeout nil exit= fun))) - (when message (message "%s" message)) + (unless set-transient-map-suppress-message + (when message (message "%s" message))) exitfun)) ;;;; Progress reporters. --=-=-=--