From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Cl=C3=A9ment?= Pit-Claudel Newsgroups: gmane.emacs.bugs Subject: bug#37785: [PATCH] Add a way to disable substitution of command keys in help strings Date: Thu, 17 Oct 2019 08:01:58 -0400 Message-ID: <936c65e4-d49b-33da-ad5a-ba854c0df1ff@gmail.com> References: <7a45908a-cc9a-277b-53ea-933756e0e067@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------F8501AA0DE8363020A6DC139" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="35667"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 Cc: 37785@debbugs.gnu.org To: Robert Pluim Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Oct 17 14:03:14 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iL4Ur-00098r-Tq for geb-bug-gnu-emacs@m.gmane.org; Thu, 17 Oct 2019 14:03:14 +0200 Original-Received: from localhost ([::1]:45408 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iL4Uq-0003sE-Hn for geb-bug-gnu-emacs@m.gmane.org; Thu, 17 Oct 2019 08:03:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51417) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iL4Uj-0003rw-1y for bug-gnu-emacs@gnu.org; Thu, 17 Oct 2019 08:03:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iL4Uh-0008DU-28 for bug-gnu-emacs@gnu.org; Thu, 17 Oct 2019 08:03:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38464) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iL4Ug-0008DF-Fu for bug-gnu-emacs@gnu.org; Thu, 17 Oct 2019 08:03:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iL4Ug-0002Go-Bf for bug-gnu-emacs@gnu.org; Thu, 17 Oct 2019 08:03:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Cl=C3=A9ment?= Pit-Claudel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 17 Oct 2019 12:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37785 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 37785-submit@debbugs.gnu.org id=B37785.15713137358674 (code B ref 37785); Thu, 17 Oct 2019 12:03:02 +0000 Original-Received: (at 37785) by debbugs.gnu.org; 17 Oct 2019 12:02:15 +0000 Original-Received: from localhost ([127.0.0.1]:47285 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iL4Tu-0002Fq-M4 for submit@debbugs.gnu.org; Thu, 17 Oct 2019 08:02:15 -0400 Original-Received: from mail-qk1-f178.google.com ([209.85.222.178]:44623) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iL4Tq-0002Fa-KA for 37785@debbugs.gnu.org; Thu, 17 Oct 2019 08:02:13 -0400 Original-Received: by mail-qk1-f178.google.com with SMTP id u22so1547525qkk.11 for <37785@debbugs.gnu.org>; Thu, 17 Oct 2019 05:02:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language; bh=lDhl/scvI6swmlo9eEgkWprK6UOmKPEoi1T2WbcvYTs=; b=lVQI8saL3u5yyutLXOWrWdRjhYUGAMT9wZKlCpw/RzFLqMf4MFBKJKu5ct3pG5c0FW IsRHuLRvHUnYDEtmjIyciUkGjwqEosx62K4trEIfq9vI+mloIprwWDS0qsOIicJq8wF3 82qXXWjd/bNgatfnKTtdG7MjkhQpwu6s4peNsk8GM20WYr4/WrmLETKQWbsBxeNQ7fQL E/ilUZxZp2n4lXExLTjLXSLNU2SfMnMlqeBF4VMR9g9SuY13foqZQEvYuKtH+B+7EpOy yGVa+sJpLYl1cD06Rwo+C0KE8yfOvncbLXKDyLG8Vtby+OimJ7wD6Pg0FxvTXSkGtEUe Ndvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=lDhl/scvI6swmlo9eEgkWprK6UOmKPEoi1T2WbcvYTs=; b=GC6kRiOc59A1dZSZwDIYmLLFmwPNCo62kJE1y8qrOVt+KEv+JYarz+8AheerugkzlX xqf66CkkAjV4EG0sz+VrG4atiadR07xeLSSHz+ADgcLZ6DYcp4yUUZYAo4qURlTcBXLi JFpkt6YVYzPiGz3rFo7Gsq1u9hfq1Y3tB3DYQ8PUvqHffGXAtsFd8bLVzKNo3VYGRzz/ wYK/5Q9bO/Bc6eVPHUxeCsvfJVtN40Z0wcN/J+wzO/SwR+RjoNzWJGZZ18riXsj6jMg4 X+YoqcL8RypLFZpr6/DqYjFJ258pBm1tL+hKyLI2AGrO1Gczy63Y8FFkCR+fDw6H6e8A fIxg== X-Gm-Message-State: APjAAAUMms1P07BODRmL7Rkc8jEw8mVbkqyr/ayuXupBz0Rmboy+p/VY 9dJW7OiUHBiLg72gIBrRByuBZgEc X-Google-Smtp-Source: APXvYqyJO2fLAoo9iaRS25WpAXNisK+Q5hQU0/RX6gm3u7WlXRogA+7U50rBl/8Z5PGCsyuojmHQeQ== X-Received: by 2002:a05:620a:89b:: with SMTP id b27mr2908401qka.378.1571313720016; Thu, 17 Oct 2019 05:02:00 -0700 (PDT) Original-Received: from ?IPv6:2601:184:4180:66e7:29f4:b2db:5f83:f6d2? ([2601:184:4180:66e7:29f4:b2db:5f83:f6d2]) by smtp.googlemail.com with ESMTPSA id z72sm1439189qka.115.2019.10.17.05.01.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Oct 2019 05:01:59 -0700 (PDT) In-Reply-To: Content-Language: en-GB X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:169561 Archived-At: This is a multi-part message in MIME format. --------------F8501AA0DE8363020A6DC139 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit On 2019-10-17 05:44, Robert Pluim wrote: > Clément> * doc/lispref/text.texi (Special Properties), etc/NEWS: Document > Clément> the effect of 'show-help-inhibit-substitution' > > Full stops at the end of sentences. Also, I think I prefer Eli's name, > mainly because yours combines 'show' with 'inhibit', which I find > jarring, and because Eli's contains 'help-echo', which mirrors the > name of the affected property. The property affects more than help-echo strings: it affects anything that is fed to show-help-function. That's why I changed the name; WDYT? I've applied all the other comments; thanks a lot! Clément. --------------F8501AA0DE8363020A6DC139 Content-Type: text/x-patch; name="0001-Add-a-way-to-disable-substitution-of-command-keys-in.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-Add-a-way-to-disable-substitution-of-command-keys-in.pa"; filename*1="tch" >From 665447d7c240c30976f41cf54225b7ea052d1a23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Pit-Claudel?= Date: Wed, 16 Oct 2019 21:28:47 -0400 Subject: [PATCH] Add a way to disable substitution of command keys in help strings * src/keyboard.c (show_help_substitute_command_keys): New function (show_help_echo, parse_menu_item): Use it. (syms_of_keyboard): Define Qshow_help_inhibit_substitution. * doc/lispref/text.texi (Special Properties), etc/NEWS: Document the effect of 'show-help-inhibit-substitution'. --- doc/lispref/text.texi | 8 +++++--- etc/NEWS | 5 +++++ src/keyboard.c | 23 ++++++++++++++++++++--- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index d7b04d2934..4f7e480443 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi @@ -3736,9 +3736,11 @@ Special Properties @pxref{Extended Menu Items}), or tool bar help strings (@pxref{Tool Bar}). The specified function is called with one argument, the help string to display, which is passed through -@code{substitute-command-keys} before being given to the function; see -@ref{Keys in Documentation}. Tooltip mode (@pxref{Tooltips,,, emacs, -The GNU Emacs Manual}) provides an example. +@code{substitute-command-keys} before being given to the function, +unless the help string has a non-nil +@code{show-help-inhibit-substitution} property on its first character; +see @ref{Keys in Documentation}. Tooltip mode (@pxref{Tooltips,,, +emacs, The GNU Emacs Manual}) provides an example. @end defvar @defvar face-filters-always-match diff --git a/etc/NEWS b/etc/NEWS index 4b693aaaa1..1002667468 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2752,6 +2752,11 @@ in other packages are now obsolete aliases of 'xor'. +++ ** 'define-globalized-minor-mode' now takes BODY forms. ++++ +** New text property 'show-help-inhibit-substitution'. +Setting this on the first character of a help string disables +conversion via 'substitute-command-keys'. + * Changes in Emacs 27.1 on Non-Free Operating Systems diff --git a/src/keyboard.c b/src/keyboard.c index a16d13cc7b..39d608d52f 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -2019,6 +2019,22 @@ make_ctrl_char (int c) return c; } +/* Substitute key descriptions and quotes in HELP, unless its first + character has a non-nil show-help-inhibit-substitution property. */ + +static Lisp_Object +show_help_substitute_command_keys (Lisp_Object help) +{ + if (STRINGP (help) + && SCHARS (help) > 0 + && !NILP (Fget_text_property (make_fixnum(0), + Qshow_help_inhibit_substitution, + help))) + return help; + + return Fsubstitute_command_keys(help); +} + /* Display the help-echo property of the character after the mouse pointer. Either show it in the echo area, or call show-help-function to display it by other means (maybe in a tooltip). @@ -2078,7 +2094,7 @@ show_help_echo (Lisp_Object help, Lisp_Object window, Lisp_Object object, if (STRINGP (help) || NILP (help)) { if (!NILP (Vshow_help_function)) - call1 (Vshow_help_function, Fsubstitute_command_keys (help)); + call1 (Vshow_help_function, show_help_substitute_command_keys (help)); help_echo_showing_p = STRINGP (help); } } @@ -7652,7 +7668,7 @@ parse_menu_item (Lisp_Object item, int inmenubar) if (CONSP (item) && STRINGP (XCAR (item))) { ASET (item_properties, ITEM_PROPERTY_HELP, - Fsubstitute_command_keys (XCAR (item))); + show_help_substitute_command_keys (XCAR (item))); start = item; item = XCDR (item); } @@ -7716,7 +7732,7 @@ parse_menu_item (Lisp_Object item, int inmenubar) { Lisp_Object help = XCAR (item); if (STRINGP (help)) - help = Fsubstitute_command_keys (help); + help = show_help_substitute_command_keys (help); ASET (item_properties, ITEM_PROPERTY_HELP, help); } else if (EQ (tem, QCfilter)) @@ -11052,6 +11068,7 @@ syms_of_keyboard (void) /* Tool-bars. */ DEFSYM (QCimage, ":image"); DEFSYM (Qhelp_echo, "help-echo"); + DEFSYM (Qshow_help_inhibit_substitution, "show-help-inhibit-substitution"); DEFSYM (QCrtl, ":rtl"); staticpro (&item_properties); -- 2.17.1 --------------F8501AA0DE8363020A6DC139--