From unknown Tue Sep 09 22:00:15 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#37785 <37785@debbugs.gnu.org> To: bug#37785 <37785@debbugs.gnu.org> Subject: Status: [PATCH] Add a way to disable substitution of command keys in help strings Reply-To: bug#37785 <37785@debbugs.gnu.org> Date: Wed, 10 Sep 2025 05:00:15 +0000 retitle 37785 [PATCH] Add a way to disable substitution of command keys in = help strings reassign 37785 emacs submitter 37785 Cl=C3=A9ment Pit-Claudel severity 37785 wishlist tag 37785 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Oct 16 21:41:38 2019 Received: (at submit) by debbugs.gnu.org; 17 Oct 2019 01:41:38 +0000 Received: from localhost ([127.0.0.1]:46787 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iKunJ-0001b9-Hw for submit@debbugs.gnu.org; Wed, 16 Oct 2019 21:41:37 -0400 Received: from lists.gnu.org ([209.51.188.17]:47817) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iKunH-0001b1-9Q for submit@debbugs.gnu.org; Wed, 16 Oct 2019 21:41:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40218) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iKunF-0002TY-Rp for bug-gnu-emacs@gnu.org; Wed, 16 Oct 2019 21:41:35 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iKunE-0002EX-AQ for bug-gnu-emacs@gnu.org; Wed, 16 Oct 2019 21:41:33 -0400 Received: from mail-qk1-x741.google.com ([2607:f8b0:4864:20::741]:39697) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iKunE-0002EB-4s for bug-gnu-emacs@gnu.org; Wed, 16 Oct 2019 21:41:32 -0400 Received: by mail-qk1-x741.google.com with SMTP id 4so411994qki.6 for ; Wed, 16 Oct 2019 18:41:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-language; bh=tPHbhWSVZjKzdqDBS6zAb3TEbsFZzg9rHyriF8LQRHo=; b=OUVssRd5+RqsLPS+DSzmCFLj34at010Zzj7FpU2SGs/sumL7Ok/CRLIJSq6NBw3b5E p+AN2SANnpeXAvEFbnCYs1Wq50e+O9ZR2VUHknv5bMQbOeuZRWqH6T9OE2FGQ6MPu3tN m/4TWmORF714rUgbG6rmnQAw0GYFXNile5ISpTLZNU19Ga8mQiCZEkUMxYrsNSkFM3MN x7Ck7wh6109yIECAMzThUq9Ug7rum7blUpkhyewL7Hj77IgQElL4KLFMQyMefjTnGkxY rlNvcWOP7brEugvgr19hF4whKEy3RfK+51IT+siyrfVwH6ZzCeSBqWo3p9Phg1W/xz8m ATSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-language; bh=tPHbhWSVZjKzdqDBS6zAb3TEbsFZzg9rHyriF8LQRHo=; b=TRkhWu68Ee8oNgswYZCJprUI1JrBH44w3gW6nSIz3qZJJJ7UvcRl3wfZ91vfYhwHnR lvmzeSjwHt4tI7BwIxwgZBq32/Q/3MtA+DDvczvakZp2hH46eVRQXl8mVhVG4lnuX6Zk k0EKs9GoTOAgPd+6v9SUHjASadHGvJZOuOhITJwIChdhNZ1/OAj83s7AsK2tdxRzynXR v/rI7onU+R2cvkyEIbVbj5dsKhvZNa2fNJi8Ga8mTRTaiK9x8bzUu6a6lF3augYkpFKm j5PKQxTeoQzXhMYkWoa9J+5xcc9tNepDjLzn5n9VZ4T57URnSI876bChwYe2/3vjzDsv 3AHQ== X-Gm-Message-State: APjAAAWcBdRzq5GzkHhZHy5OJCTbi9WIPYkFTvnh5GGnPkyjdOA57oE5 gUqYeWQB1YYn5/GS3FZrM/W5ydoR X-Google-Smtp-Source: APXvYqzRasxIW5dovbmshDswFkMMv/uElWIbB2gwKQq4USZ0UwIaqWE0vhyWee2QZ1m5tlHmqQdimg== X-Received: by 2002:a37:2fc1:: with SMTP id v184mr1056546qkh.22.1571276490023; Wed, 16 Oct 2019 18:41:30 -0700 (PDT) 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 q8sm461449qtj.76.2019.10.16.18.41.29 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Oct 2019 18:41:29 -0700 (PDT) To: bug-gnu-emacs From: =?UTF-8?Q?Cl=c3=a9ment_Pit-Claudel?= Subject: [PATCH] Add a way to disable substitution of command keys in help strings Message-ID: <7a45908a-cc9a-277b-53ea-933756e0e067@gmail.com> Date: Wed, 16 Oct 2019 21:41:27 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------A0CD0C311D390226C7ABBF9A" Content-Language: en-GB X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::741 X-Spam-Score: 0.7 (/) 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: -2.3 (--) This is a multi-part message in MIME format. --------------A0CD0C311D390226C7ABBF9A Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi all, On 2019-10-05 04:13, Eli Zaretskii wrote (on emacs-devel): > I guess we need to add some feature to control whether help-echo gets > run through substitute-command-keys, or add an alternative to > help-echo that works exactly like it, but without substitutions. > Patches welcome. […] > I'd prefer a property like help-echo-inhibit-substitution that is > non-nil, to inhibit the call to substitute-command-keys. A value of > nil is easy to confuse with no property at all. Here is a first cut at a patch implementing this feature. I hope this tracker is the right place to post it. I'm also not quite sure I got the Changelog format right. Cheers, Clément. --------------A0CD0C311D390226C7ABBF9A 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 8092b19d819182c91e6066d24f243dc7d7d8641e 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..6089515daf 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -439,6 +439,11 @@ RGB triplets with a single hexadecimal digit per component. --- ** The toolbar now shows the equivalent key binding in its tooltips. ++++ +** Adding a non-nil 'show-help-inhibit-substitution' text property on +the first character of a help string disables conversion via +'substitute-command-keys'. + * Editing Changes in Emacs 27.1 diff --git a/src/keyboard.c b/src/keyboard.c index a16d13cc7b..864c9789c5 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 --------------A0CD0C311D390226C7ABBF9A-- From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 17 05:45:00 2019 Received: (at 37785) by debbugs.gnu.org; 17 Oct 2019 09:45:00 +0000 Received: from localhost ([127.0.0.1]:47154 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iL2L6-00050M-B6 for submit@debbugs.gnu.org; Thu, 17 Oct 2019 05:45:00 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:43730) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iL2L4-000506-U1 for 37785@debbugs.gnu.org; Thu, 17 Oct 2019 05:44:59 -0400 Received: by mail-wr1-f68.google.com with SMTP id j18so1533836wrq.10 for <37785@debbugs.gnu.org>; Thu, 17 Oct 2019 02:44:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:mail-copies-to:gmane-reply-to-list :date:in-reply-to:message-id:mime-version:content-transfer-encoding; bh=T6BccW339KrXG1CC9fFP1NAu5+ROqfSbzT/US7ACUUE=; b=ABO5lmx1mHhhAawn4p+Ir6YBgvUFAjIY3mXgkl0PS7jE3QW55DsREDdt8fQSqpV0CV EdAN2PovUgFu+NmOi2W0aDerYXiF34fAUvMPJYDvRkk4cVec+56tSH0BN8bpal++ouZu ZuTWqHUxJIfsLjWOUxJZCL9bc49bBXiQ5Z9Hug1wpcD+fY3GKfgDas6h6CstSgYFMRj+ iceZHZfxuZ15TX643ioTrdvcKTlHIN5lGCvzLMNdsR6VPGmVOV4rHQcwld1cK2eHUEGI q6Mm7cZuOoFUWn3xCX2CYsB44QVtrfA+sDweKQDQShq1+wFQYEofq2GqOZoscwDaPNDW upnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:mail-copies-to :gmane-reply-to-list:date:in-reply-to:message-id:mime-version :content-transfer-encoding; bh=T6BccW339KrXG1CC9fFP1NAu5+ROqfSbzT/US7ACUUE=; b=pdaCYR5CawEEaRXdaVXJHA7mb45M38bpCke+8wfnLb1fkbmlCFz/0tfeeyCU0ISFEZ onlCanylH8rvJK78yDu8QB69cwZZu7r/LLkECFICCIES3KxQzzitWPU601/FsvOFDzUO grOULuuXjsj1/Di75PtMKz4CBwMi8rxZEmE8pUpk/JIjV4oSAnd9pHfN6KE52fwkG/lG 5AOv2nH2WY6iiZmqAJnN8TZu+jnnf1aYF1lPCyIX+GRV9m28gUrX/FJKU1BYT8wpQ87m QwQrIMEgaBlBKXP26cTwQbe32MHevnBqgwGfld2P4O5zUiIj6dlOSG8gGUICm+9h0G6i J/fw== X-Gm-Message-State: APjAAAXAhKiqiy538mUB4ppCdBOKCQ//f5agoibNq4/Wb639Mm6D7eJi EMeR0pvTezRCdBf7pyY7rjz0h0Cz X-Google-Smtp-Source: APXvYqxWd8PkBC5JJllgXm90NoaAAQnxSdzXSclwzN0U1qNryoLGIoxgOpzM4Nium+lcEtGwUBqXFQ== X-Received: by 2002:adf:f447:: with SMTP id f7mr2102536wrp.210.1571305492199; Thu, 17 Oct 2019 02:44:52 -0700 (PDT) Received: from rpluim-mac ([149.5.228.1]) by smtp.gmail.com with ESMTPSA id t83sm2752992wmt.18.2019.10.17.02.44.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2019 02:44:51 -0700 (PDT) From: Robert Pluim To: =?utf-8?Q?Cl=C3=A9ment?= Pit-Claudel Subject: Re: bug#37785: [PATCH] Add a way to disable substitution of command keys in help strings References: <7a45908a-cc9a-277b-53ea-933756e0e067@gmail.com> X-Debbugs-No-Ack: yes Mail-Copies-To: never Gmane-Reply-To-List: yes Date: Thu, 17 Oct 2019 11:44:50 +0200 In-Reply-To: <7a45908a-cc9a-277b-53ea-933756e0e067@gmail.com> (=?utf-8?Q?=22Cl=C3=A9ment?= Pit-Claudel"'s message of "Wed, 16 Oct 2019 21:41:27 -0400") Message-ID: 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: 37785 Cc: 37785@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 (-) >>>>> On Wed, 16 Oct 2019 21:41:27 -0400, Cl=C3=A9ment Pit-Claudel said: Cl=C3=A9ment> Hi all, Cl=C3=A9ment> On 2019-10-05 04:13, Eli Zaretskii wrote (on emacs-devel): >> I guess we need to add some feature to control whether help-echo gets >> run through substitute-command-keys, or add an alternative to >> help-echo that works exactly like it, but without substitutions. >> Patches welcome. Cl=C3=A9ment> [=E2=80=A6] >> I'd prefer a property like help-echo-inhibit-substitution that is >> non-nil, to inhibit the call to substitute-command-keys. A value of >> nil is easy to confuse with no property at all. Cl=C3=A9ment> Here is a first cut at a patch implementing this feature.= I hope this Cl=C3=A9ment> tracker is the right place to post it. I'm also not quit= e sure I got Cl=C3=A9ment> the Changelog format right. Cl=C3=A9ment> Cheers, Cl=C3=A9ment> Cl=C3=A9ment. Cl=C3=A9ment> From 8092b19d819182c91e6066d24f243dc7d7d8641e Mon Sep 17 = 00:00:00 2001 Cl=C3=A9ment> From: =3D?UTF-8?q?Cl=3DC3=3DA9ment=3D20Pit-Claudel?=3D Cl=C3=A9ment> Date: Wed, 16 Oct 2019 21:28:47 -0400 Cl=C3=A9ment> Subject: [PATCH] Add a way to disable substitution of com= mand keys in help Cl=C3=A9ment> strings Cl=C3=A9ment> * src/keyboard.c (show_help_substitute_command_keys): New= function Cl=C3=A9ment> (show_help_echo, parse_menu_item): Use it Cl=C3=A9ment> (syms_of_keyboard): Define Qshow_help_inhibit_substitution Cl=C3=A9ment> * doc/lispref/text.texi (Special Properties), etc/NEWS: D= ocument Cl=C3=A9ment> 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. Cl=C3=A9ment> ++++ Cl=C3=A9ment> +** Adding a non-nil 'show-help-inhibit-substitution' tex= t property on Cl=C3=A9ment> +the first character of a help string disables conversion= via Cl=C3=A9ment> +'substitute-command-keys'. Cl=C3=A9ment> + Should this be in the 'Lisp Changes' section of NEWS? Also, first line should be a complete sentence, so: ** New text property 'show-help-inhibit-substitution'. Setting this on the first character of a help string disables conversion via 'substitute-command-keys'. Cl=C3=A9ment> +/* Substitute key descriptions and quotes in HELP, unles= s its first Cl=C3=A9ment> + character has a non-nil show-help-inhibit-substitutio= n property. */ Two spaces after full stop. Cl=C3=A9ment> + Cl=C3=A9ment> +static Lisp_Object Cl=C3=A9ment> +show_help_substitute_command_keys (Lisp_Object help) Cl=C3=A9ment> +{ Cl=C3=A9ment> + if (STRINGP (help) && Cl=C3=A9ment> + SCHARS (help) > 0 && Cl=C3=A9ment> + !NILP (Fget_text_property (make_fixnum(0), Cl=C3=A9ment> + Qshow_help_inhibit_subs= titution, Cl=C3=A9ment> + help))) Break before operators, not after. Robert From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 17 08:02:15 2019 Received: (at 37785) by debbugs.gnu.org; 17 Oct 2019 12:02:15 +0000 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 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 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) 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) Subject: Re: bug#37785: [PATCH] Add a way to disable substitution of command keys in help strings To: Robert Pluim References: <7a45908a-cc9a-277b-53ea-933756e0e067@gmail.com> From: =?UTF-8?Q?Cl=c3=a9ment_Pit-Claudel?= Message-ID: <936c65e4-d49b-33da-ad5a-ba854c0df1ff@gmail.com> Date: Thu, 17 Oct 2019 08:01:58 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------F8501AA0DE8363020A6DC139" Content-Language: en-GB X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 37785 Cc: 37785@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 (-) 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-- From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 17 09:14:22 2019 Received: (at 37785) by debbugs.gnu.org; 17 Oct 2019 13:14:22 +0000 Received: from localhost ([127.0.0.1]:47389 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iL5bh-0004Df-Lp for submit@debbugs.gnu.org; Thu, 17 Oct 2019 09:14:21 -0400 Received: from eggs.gnu.org ([209.51.188.92]:52525) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iL5bg-0004DU-Ri for 37785@debbugs.gnu.org; Thu, 17 Oct 2019 09:14:21 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:37036) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iL5ba-00041P-Sw; Thu, 17 Oct 2019 09:14:15 -0400 Received: from [176.228.60.248] (port=4052 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iL5bY-00071a-No; Thu, 17 Oct 2019 09:14:14 -0400 Date: Thu, 17 Oct 2019 16:13:58 +0300 Message-Id: <83h847bjl5.fsf@gnu.org> From: Eli Zaretskii To: =?utf-8?Q?Cl=C3=A9ment?= Pit-Claudel In-reply-to: <936c65e4-d49b-33da-ad5a-ba854c0df1ff@gmail.com> (message from =?utf-8?Q?Cl=C3=A9ment?= Pit-Claudel on Thu, 17 Oct 2019 08:01:58 -0400) Subject: Re: bug#37785: [PATCH] Add a way to disable substitution of command keys in help strings References: <7a45908a-cc9a-277b-53ea-933756e0e067@gmail.com> <936c65e4-d49b-33da-ad5a-ba854c0df1ff@gmail.com> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 37785 Cc: rpluim@gmail.com, 37785@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: Clément Pit-Claudel > Date: Thu, 17 Oct 2019 08:01:58 -0400 > Cc: 37785@debbugs.gnu.org > > > 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? But show-help-function is for showing help-echo, is it not? From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 17 09:48:01 2019 Received: (at 37785) by debbugs.gnu.org; 17 Oct 2019 13:48:01 +0000 Received: from localhost ([127.0.0.1]:47429 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iL68H-00057e-6i for submit@debbugs.gnu.org; Thu, 17 Oct 2019 09:48:01 -0400 Received: from mail-qk1-f170.google.com ([209.85.222.170]:44323) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iL68G-00057Q-2y for 37785@debbugs.gnu.org; Thu, 17 Oct 2019 09:48:00 -0400 Received: by mail-qk1-f170.google.com with SMTP id u22so1866714qkk.11 for <37785@debbugs.gnu.org>; Thu, 17 Oct 2019 06:48:00 -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:content-transfer-encoding; bh=cSj/CGc225amukyqLKIzxlw1o02rNT9uD2SZZBo58X0=; b=A4pPmrM46ZGrKzXzQJ2AizGX5/lPi/WyMGJ5mX6LvBa3jo1weRe5+a5Qnt3KmFezEM f/q/osC6CxJxkPAiaaplRjAcjAvXLBOydVQKaX/hQdlI2cTTeFD0tp8YZ82ITN95Ppd9 8HCiR0XF627I3xaijbAjtzSzK9GmigG43Fg7U6UV1qsOgLCzP1471C2h+KxSmYhDyhvM NOvo0xLyveTk3kBdw+JnuCz5ChrzsoKpq2Zimtrn42WoWchfL2kg69xqGKXNqtgHpZhV mbiFcmK2fL0mY5sbVvZiC8x2sATeIxgZuyQfOA5j0EuEPBNnlUho1AKWQ2qCjQV8Ojqb Z4Xw== 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 :content-transfer-encoding; bh=cSj/CGc225amukyqLKIzxlw1o02rNT9uD2SZZBo58X0=; b=HjDdzQMXMgaESbCdsNmN5BKO1ajw9QxywjSjjuVEkUvnn1i4Xjr65JKH/rRcl1mjAt y4UFbdiqSnZy+JyGyvMbchMb5PusAvKXZQTWApj7S+P1rfg+GG3SLmg8TayiBjYIES+W V00AGKeicWlWVa68k3Iyy0Dq7wl0TGrVzeRedxp0bM2ai9Ry3iV1VCpAqYo0Yx5eUbJ+ FK2M87uauWbr8i8yvg3tmMEnl4DsiYVAStyUmUAoGvAneZiwWjXXQ3SdfKc7NtczkDk7 D9OwnIezci48jR+sg13YV1r2owIf+JvrzqyY6n44rzz2DKRxuqjurspqRmmYlt7PFZIp 28Bg== X-Gm-Message-State: APjAAAXdiIRsCt2jsK53CwFMBdXt8Sdmzq6VIuQo9IUaJzi2/Zvytl1l Vb90B910cT45LI4h7I4pY/gB+AZY X-Google-Smtp-Source: APXvYqyD8INsbBPKlpErKRxBV0edbabXyjTT9+ouFQQlqp5fy9k2UpzqO5jHSQO+prFRBR0Cl5RGJA== X-Received: by 2002:a05:620a:88f:: with SMTP id b15mr3405473qka.307.1571320074381; Thu, 17 Oct 2019 06:47:54 -0700 (PDT) Received: from [128.30.9.205] (30-9-205.wireless.csail.mit.edu. [128.30.9.205]) by smtp.googlemail.com with ESMTPSA id n4sm1135729qkc.61.2019.10.17.06.47.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Oct 2019 06:47:53 -0700 (PDT) Subject: Re: bug#37785: [PATCH] Add a way to disable substitution of command keys in help strings To: Eli Zaretskii References: <7a45908a-cc9a-277b-53ea-933756e0e067@gmail.com> <936c65e4-d49b-33da-ad5a-ba854c0df1ff@gmail.com> <83h847bjl5.fsf@gnu.org> From: =?UTF-8?Q?Cl=c3=a9ment_Pit-Claudel?= Message-ID: <1eecb79e-3087-8c49-5c80-d8a7f619a157@gmail.com> Date: Thu, 17 Oct 2019 09:47:52 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <83h847bjl5.fsf@gnu.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 37785 Cc: rpluim@gmail.com, 37785@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 (-) On 2019-10-17 09:13, Eli Zaretskii wrote: >> From: Clément Pit-Claudel >> Date: Thu, 17 Oct 2019 08:01:58 -0400 >> Cc: 37785@debbugs.gnu.org >> >>> 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? > > But show-help-function is for showing help-echo, is it not? That's true, and my explanation wasn't very good. I'm working off of this commit: commit 5f5fe275ec54194a9293690ffee3d425026ac14b Author: Paul Eggert Date: Sun Aug 2 14:55:15 2015 -0700 Treat help strings like other doc strings * doc/lispref/text.texi (Special Properties), etc/NEWS: Document this. * lisp/epa.el (epa--select-keys): Remove no-longer-needed calls to substitute-command-keys. * src/keyboard.c (show_help_echo, parse_menu_item): Call substitute-command-keys on the help string before displaying it. It adds Fsubstitute_command_keys in two places: show_help_echo and parse_menu_item. The patch I sent makes both of these calls conditional, so calling the variable help-echo-inhibit-substitutions isn't right. That commit added this NEWS entry: +** show-help-function's arg is converted via substitute-command-keys +before being passed to the function. Help strings, help-echo +properties, etc. can therefore contain command key escapes and +quotation marks. But in fact show-help-function's arg being converted only affect help-echo properties; it's the change to parse_menu_item that does the rest. I can either: * Change the name to something like help-string-inhibit-substitutions. * Restrict the patch to the argument of show-help-function, and rename the variable to help-echo-inhibit-substitutions. Let me know, Clément. From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 17 10:07:13 2019 Received: (at 37785) by debbugs.gnu.org; 17 Oct 2019 14:07:13 +0000 Received: from localhost ([127.0.0.1]:48589 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iL6Qr-0005sK-Bi for submit@debbugs.gnu.org; Thu, 17 Oct 2019 10:07:13 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33816) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iL6Qp-0005s8-H3 for 37785@debbugs.gnu.org; Thu, 17 Oct 2019 10:07:12 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:37840) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iL6Qk-0006o4-Aw; Thu, 17 Oct 2019 10:07:06 -0400 Received: from [176.228.60.248] (port=3306 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iL6Qj-0006Xa-NX; Thu, 17 Oct 2019 10:07:06 -0400 Date: Thu, 17 Oct 2019 17:06:49 +0300 Message-Id: <837e53bh52.fsf@gnu.org> From: Eli Zaretskii To: =?utf-8?Q?Cl=C3=A9ment?= Pit-Claudel In-reply-to: <1eecb79e-3087-8c49-5c80-d8a7f619a157@gmail.com> (message from =?utf-8?Q?Cl=C3=A9ment?= Pit-Claudel on Thu, 17 Oct 2019 09:47:52 -0400) Subject: Re: bug#37785: [PATCH] Add a way to disable substitution of command keys in help strings References: <7a45908a-cc9a-277b-53ea-933756e0e067@gmail.com> <936c65e4-d49b-33da-ad5a-ba854c0df1ff@gmail.com> <83h847bjl5.fsf@gnu.org> <1eecb79e-3087-8c49-5c80-d8a7f619a157@gmail.com> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 37785 Cc: rpluim@gmail.com, 37785@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 (---) > Cc: rpluim@gmail.com, 37785@debbugs.gnu.org > From: Clément Pit-Claudel > Date: Thu, 17 Oct 2019 09:47:52 -0400 > > > But show-help-function is for showing help-echo, is it not? > > That's true, and my explanation wasn't very good. I'm working off of this commit: > > commit 5f5fe275ec54194a9293690ffee3d425026ac14b > Author: Paul Eggert > Date: Sun Aug 2 14:55:15 2015 -0700 > > Treat help strings like other doc strings > > * doc/lispref/text.texi (Special Properties), etc/NEWS: Document this. > * lisp/epa.el (epa--select-keys): Remove no-longer-needed calls to > substitute-command-keys. > * src/keyboard.c (show_help_echo, parse_menu_item): Call > substitute-command-keys on the help string before displaying it. > > It adds Fsubstitute_command_keys in two places: show_help_echo and parse_menu_item. The patch I sent makes both of these calls conditional, so calling the variable help-echo-inhibit-substitutions isn't right. Why isn't it right for parse_menu_item? That function uses the :help text, which is help-echo for menu items. > I can either: > * Change the name to something like help-string-inhibit-substitutions. > * Restrict the patch to the argument of show-help-function, and rename the variable to help-echo-inhibit-substitutions. Let's first agree whether or not parse_menu_item triggers help-echo. If you think it doesn't please elaborate as to why you think so. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 17 11:06:40 2019 Received: (at 37785) by debbugs.gnu.org; 17 Oct 2019 15:06:40 +0000 Received: from localhost ([127.0.0.1]:48708 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iL7MN-0007Pa-Tz for submit@debbugs.gnu.org; Thu, 17 Oct 2019 11:06:40 -0400 Received: from mail-wr1-f47.google.com ([209.85.221.47]:44373) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iL7MK-0007P9-AR for 37785@debbugs.gnu.org; Thu, 17 Oct 2019 11:06:36 -0400 Received: by mail-wr1-f47.google.com with SMTP id z9so2750401wrl.11 for <37785@debbugs.gnu.org>; Thu, 17 Oct 2019 08:06:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:mail-copies-to:gmane-reply-to-list :date:in-reply-to:message-id:mime-version:content-transfer-encoding; bh=kmO87/hyU0/CYYhbDdmLPg18QDTLyuYDbklKlH2g6SA=; b=HcOFR8r5W9BZByfiv8NtpnlHIoWCWmgPLfxo/07NjwG7uS+SVYdub8df/7w4YqUR7Z lyS3wUXjMUeJQNGwyMfahq7dCch0yyWs2I4pETuWYDYUnU46R4CKbJDmfSfv3wbPcldk sqnBE1/dhKtNbKvhwwY+9GoJSBHVR48NOBpQ5kQfWyij+DDtuzFNrBuwypF2nLGgEzLf 3fLGDMXX1PKgcKxMopLpIOdn8szRzpjWIDKcTgpod62CRD3CZdEy64x2T8ddtknm2V7i mxA6L/69MoJJ2+Vv/CzEX/3N85zXhZkJBX0yzJ4Q6PhiPVmSZRqDtpJDf4qKFknqhsku mZlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:mail-copies-to :gmane-reply-to-list:date:in-reply-to:message-id:mime-version :content-transfer-encoding; bh=kmO87/hyU0/CYYhbDdmLPg18QDTLyuYDbklKlH2g6SA=; b=rpCO18sIVy5rsQOf0lLpaXtkaT91ZeraYes3psOuW6wAeaBxV5UXgyRd6gfTyOKWV7 e3pfVXclvIs08TlJNn+XInaw+D1jMyQ5/YnGCfeGe9ajtzngpKkf8wbhN0akKl5f+dUT lgtdWHhdVhzEf1YVZvXvT3pb9fpLMZxe1newi/X6gCG2sAUIZwoCo+IJZgN3RsxBfNCn ASZ2Mc3QpW8nTwcVk7SE32g/stAps0LB81MgiDhBJEgLEXXrPuLVKibqWnETyXfrWUc1 CeGN4Ved8h1zeitLPr0EeCXJ69n72loCvfLWT16UZWP1cz9IfGbyFZBE66OWMxZbvMzo Zxfw== X-Gm-Message-State: APjAAAWrMwKuJhQ/eYraPJRf2HbioOqFX7DaF4qAzpjkY03hJFtgorce Eh0fdOHrfWMwJaGzBcQ18HhTpYedATA= X-Google-Smtp-Source: APXvYqxmKqe1HNqKI7MNu6xQqKneF7inTNriAJ+WhZxrdXzK5fawPe2NE9wT6DBDA299jv1K7wf7Ag== X-Received: by 2002:adf:e40c:: with SMTP id g12mr3673387wrm.216.1571324790317; Thu, 17 Oct 2019 08:06:30 -0700 (PDT) Received: from rpluim-mac ([149.5.228.1]) by smtp.gmail.com with ESMTPSA id s12sm2483533wra.82.2019.10.17.08.06.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2019 08:06:29 -0700 (PDT) From: Robert Pluim To: =?utf-8?Q?Cl=C3=A9ment?= Pit-Claudel Subject: Re: bug#37785: [PATCH] Add a way to disable substitution of command keys in help strings References: <7a45908a-cc9a-277b-53ea-933756e0e067@gmail.com> <936c65e4-d49b-33da-ad5a-ba854c0df1ff@gmail.com> <83h847bjl5.fsf@gnu.org> <1eecb79e-3087-8c49-5c80-d8a7f619a157@gmail.com> X-Debbugs-No-Ack: yes Mail-Copies-To: never Gmane-Reply-To-List: yes Date: Thu, 17 Oct 2019 17:06:28 +0200 In-Reply-To: <1eecb79e-3087-8c49-5c80-d8a7f619a157@gmail.com> (=?utf-8?Q?=22Cl=C3=A9ment?= Pit-Claudel"'s message of "Thu, 17 Oct 2019 09:47:52 -0400") Message-ID: 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: 37785 Cc: Eli Zaretskii , 37785@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 (-) >>>>> On Thu, 17 Oct 2019 09:47:52 -0400, Cl=C3=A9ment Pit-Claudel said: Cl=C3=A9ment> * Change the name to something like help-string-inhibit-s= ubstitutions. Cl=C3=A9ment> * Restrict the patch to the argument of show-help-functio= n, and rename the variable to help-echo-inhibit-substitutions. I think I=CA=BCd prefer the former, for the sake of consistency. Robert From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 17 11:53:54 2019 Received: (at 37785) by debbugs.gnu.org; 17 Oct 2019 15:53:54 +0000 Received: from localhost ([127.0.0.1]:48775 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iL866-0000LD-3G for submit@debbugs.gnu.org; Thu, 17 Oct 2019 11:53:54 -0400 Received: from mail-qt1-f180.google.com ([209.85.160.180]:33843) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iL864-0000Kr-Qk for 37785@debbugs.gnu.org; Thu, 17 Oct 2019 11:53:53 -0400 Received: by mail-qt1-f180.google.com with SMTP id 3so4333748qta.1 for <37785@debbugs.gnu.org>; Thu, 17 Oct 2019 08:53:52 -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=I6xI5ICY6niR2BOxXVUQ9/f6GSzVBPkgxmLzVQKOm0M=; b=u2ib+hiqwPDQYT7TCAzn2zzb2dlWNJXSRYZ50KlHGWlNERi80ogzrQYBN1FAmJUMfL iw7q7Y/9QpUBkq518GVupTchYXBFOCL3uUDZcBfcpToLlzMLs3ZnrownpnqEYg3Dfbhl NkrcN7lWSocqP3snqQN1WEKhaPM76mkjUfqAeEZZNDOErPBSbdjR+Fww1vzUIcqk98wy 1lL7lGIiofzl46or6bFyyYoXRmcfgUi+fw/hD3lfllH8sDAVWMQzbcmoBq3vCQqBSn2j ISy+bevv5lFoA+q8jRD6FEg8LJsz1W5ZTpZEVtWVz5rWYTHUgusNAggqxR2fI7zerMAs yd+Q== 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=I6xI5ICY6niR2BOxXVUQ9/f6GSzVBPkgxmLzVQKOm0M=; b=E+FVK35xTQ6KAn7rEiSibDMZUqnsQ+AIA0FSplZjeWr3sOG9hckZqoKGDQFSFQQlNj SBF+mJK33fJTmkkq8EqvX3kGSj0jSZbjU2Fff4tdiVcY7eVkBTCeItBZYGTroG9M4dCf WFfvhiCqys1g6Si7R15ye0RKTmQ2/iqZgzwlT0mixUFSb6ruoVWpezhycwsniUxW6tVi eyrhpMqGPzgt8D7a0GLvHZPsWvucxLXp6H818wZVxHplnkegx6dCGonnszKCup92J3b9 3z0scPDllQcjoRRxdR+8Nae7QN6uVi8Idpg9vZlKLh2QvL4nuwz5E8Gtk8zZE7d9nBNY Pscw== X-Gm-Message-State: APjAAAWD48Y5J8r+s9AnuOeiXV1TiqViioegByLx472BnjJCBoXXDvby G8grJ6crU08zjZjbUKZepsrN51js X-Google-Smtp-Source: APXvYqyAxDOCtCJ8Bmo4+89UZdrlSxX3ADLTV8WvkF7KJ+xfhOl1ruqGEKcJkUab2fD7n6fka23OUw== X-Received: by 2002:ac8:887:: with SMTP id v7mr4614332qth.196.1571327627107; Thu, 17 Oct 2019 08:53:47 -0700 (PDT) Received: from [128.30.9.205] (30-9-205.wireless.csail.mit.edu. [128.30.9.205]) by smtp.googlemail.com with ESMTPSA id s75sm989792qke.14.2019.10.17.08.53.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Oct 2019 08:53:46 -0700 (PDT) Subject: Re: bug#37785: [PATCH] Add a way to disable substitution of command keys in help strings To: Eli Zaretskii References: <7a45908a-cc9a-277b-53ea-933756e0e067@gmail.com> <936c65e4-d49b-33da-ad5a-ba854c0df1ff@gmail.com> <83h847bjl5.fsf@gnu.org> <1eecb79e-3087-8c49-5c80-d8a7f619a157@gmail.com> <837e53bh52.fsf@gnu.org> From: =?UTF-8?Q?Cl=c3=a9ment_Pit-Claudel?= Message-ID: <1b644b5c-7838-eba7-9aef-39e9e8e6f22c@gmail.com> Date: Thu, 17 Oct 2019 11:53:45 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <837e53bh52.fsf@gnu.org> Content-Type: multipart/mixed; boundary="------------7AC32A36B31908E5149069FF" Content-Language: en-GB X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 37785 Cc: rpluim@gmail.com, 37785@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 (-) This is a multi-part message in MIME format. --------------7AC32A36B31908E5149069FF Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit On 2019-10-17 10:06, Eli Zaretskii wrote: >> Cc: rpluim@gmail.com, 37785@debbugs.gnu.org >> From: Clément Pit-Claudel >> Date: Thu, 17 Oct 2019 09:47:52 -0400 >> >>> But show-help-function is for showing help-echo, is it not? >> >> That's true, and my explanation wasn't very good. I'm working off of this commit: >> >> commit 5f5fe275ec54194a9293690ffee3d425026ac14b >> Author: Paul Eggert >> Date: Sun Aug 2 14:55:15 2015 -0700 >> >> Treat help strings like other doc strings >> >> * doc/lispref/text.texi (Special Properties), etc/NEWS: Document this. >> * lisp/epa.el (epa--select-keys): Remove no-longer-needed calls to >> substitute-command-keys. >> * src/keyboard.c (show_help_echo, parse_menu_item): Call >> substitute-command-keys on the help string before displaying it. >> >> It adds Fsubstitute_command_keys in two places: show_help_echo and parse_menu_item. The patch I sent makes both of these calls conditional, so calling the variable help-echo-inhibit-substitutions isn't right. > > Why isn't it right for parse_menu_item? That function uses the :help > text, which is help-echo for menu items. Ah, OK, then I just misunderstood :) I've attached an updated patch. --------------7AC32A36B31908E5149069FF 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 e7263d6c6a6ee3d509e1da692a1767e23ff0e8eb 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 (help_echo_substitute_command_keys): New function (help_echo_echo, parse_menu_item): Use it. (syms_of_keyboard): Define Qhelp_echo_inhibit_substitution. * doc/lispref/text.texi (Special Properties), etc/NEWS: Document the effect of 'help-echo-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..22a007592b 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{help-echo-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..f8897b7c7b 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 'help-echo-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..0c0fdc3ce0 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 help-echo-inhibit-substitution property. */ + +static Lisp_Object +help_echo_substitute_command_keys (Lisp_Object help) +{ + if (STRINGP (help) + && SCHARS (help) > 0 + && !NILP (Fget_text_property (make_fixnum(0), + Qhelp_echo_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, help_echo_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))); + help_echo_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 = help_echo_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 (Qhelp_echo_inhibit_substitution, "help-echo-inhibit-substitution"); DEFSYM (QCrtl, ":rtl"); staticpro (&item_properties); -- 2.17.1 --------------7AC32A36B31908E5149069FF-- From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 17 13:19:25 2019 Received: (at 37785) by debbugs.gnu.org; 17 Oct 2019 17:19:25 +0000 Received: from localhost ([127.0.0.1]:48882 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iL9Qq-0002gE-UY for submit@debbugs.gnu.org; Thu, 17 Oct 2019 13:19:25 -0400 Received: from eggs.gnu.org ([209.51.188.92]:40321) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iL9Qp-0002fz-9G for 37785@debbugs.gnu.org; Thu, 17 Oct 2019 13:19:23 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:42322) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iL9Qi-0002hp-0W; Thu, 17 Oct 2019 13:19:16 -0400 Received: from [176.228.60.248] (port=3433 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iL9Qg-0001hR-U7; Thu, 17 Oct 2019 13:19:15 -0400 Date: Thu, 17 Oct 2019 20:18:58 +0300 Message-Id: <83lftj9tod.fsf@gnu.org> From: Eli Zaretskii To: =?utf-8?Q?Cl=C3=A9ment?= Pit-Claudel In-reply-to: <1b644b5c-7838-eba7-9aef-39e9e8e6f22c@gmail.com> (message from =?utf-8?Q?Cl=C3=A9ment?= Pit-Claudel on Thu, 17 Oct 2019 11:53:45 -0400) Subject: Re: bug#37785: [PATCH] Add a way to disable substitution of command keys in help strings References: <7a45908a-cc9a-277b-53ea-933756e0e067@gmail.com> <936c65e4-d49b-33da-ad5a-ba854c0df1ff@gmail.com> <83h847bjl5.fsf@gnu.org> <1eecb79e-3087-8c49-5c80-d8a7f619a157@gmail.com> <837e53bh52.fsf@gnu.org> <1b644b5c-7838-eba7-9aef-39e9e8e6f22c@gmail.com> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 37785 Cc: rpluim@gmail.com, 37785@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 (---) > Cc: rpluim@gmail.com, 37785@debbugs.gnu.org > From: Clément Pit-Claudel > Date: Thu, 17 Oct 2019 11:53:45 -0400 > > I've attached an updated patch. Thanks, I have a few minor comments. > * src/keyboard.c (help_echo_substitute_command_keys): New function Missing period at end of sentence. > diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi > index d7b04d2934..22a007592b 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 ^^^^^^ In the Info manuals, we give "nil" the @code markup: non-@code{nil}. Please also add here an index entry, so that readers could find this information quickly. Suggestion: @cindex help-echo text, avoid command-key substitution Also, please add the description of this face to the list in "Special Properties". > +** New text property 'help-echo-inhibit-substitution'. > +Setting this on the first character of a help string disables > +conversion via 'substitute-command-keys'. ^^^^^^^^^^ I'd use "conversions" here, in plural. > + return Fsubstitute_command_keys(help); ^ Our convention is to leave one blank between a function's name and the opening parenthesis. From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 19 16:35:40 2019 Received: (at 37785) by debbugs.gnu.org; 19 Oct 2019 20:35:40 +0000 Received: from localhost ([127.0.0.1]:53598 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iLvRr-0002ae-OF for submit@debbugs.gnu.org; Sat, 19 Oct 2019 16:35:40 -0400 Received: from mail-qk1-f181.google.com ([209.85.222.181]:45266) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iLvRq-0002aQ-4I for 37785@debbugs.gnu.org; Sat, 19 Oct 2019 16:35:38 -0400 Received: by mail-qk1-f181.google.com with SMTP id q70so1055596qke.12 for <37785@debbugs.gnu.org>; Sat, 19 Oct 2019 13:35:38 -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=Bvh4bPfSjT4673y1L21+3eX5n1oQP3Rnhu8TRT1TMQg=; b=C1KQh2F+X1Jpj36u8eEjEiuxQtg135R5grVWrbFC4BQic07Ser5YeV3c+Ck2eo3r5k y6WkYXTepI9Kb4mV78SpQ1o5gqbOFHBKVKL1H+AhV4EEOq0EkT/TTDSOYDnjerg4ZqpF VB0R0Lnc1jln/nWV15yfGV5pLmkeSs6tvKBozjzk8sH5DOFxIUh7/B2eqUvOMBhcI0E3 CSomFYP4/2LJApXdFU61Ze9LMLQroZPgXEWmWFmd/1xKKltBRFvTIAHtHmlc8pSLyEYq hhVFOw+i0Ibatucygwlx9DCJdmuVf4W72OaBrc5xb5Tau2X2gOkQELba1a8PvFS5xsaP JFqw== 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=Bvh4bPfSjT4673y1L21+3eX5n1oQP3Rnhu8TRT1TMQg=; b=TcbJKp+wRcv8Ny/oD0TN8BYR2O4HbiSrsZrAubsM9gBRoGc3Upj62TTaT9+SOIylP+ W110J82ehWayOHPLhyzo++6pxPHY/PRu7VimA6+F4U1SqzLhGH+rY2xvyO7xZWEk/dEi oAwinriaYOZzwAXYKvobGhH0/NTZdRgI50RyEmcV+uvny3N8HrlGMgdy5bv4KALCp/S8 d4aQ8tKcr6B7Teqha/G41NkE/kbm2YeMIELlt21D67dYNtsPJ95P02cMabNeQjXesv5z ztVG+8boalA/4Wo8D+rGGPV+cPpWodt/n7FPSWX/Q2E9ol42tM9MAUhqvAScfPc4BmDv aVDQ== X-Gm-Message-State: APjAAAUz9v4N3QHu26IqtbnnJjrOufxF02anvcrzf4nWVgGdbhb7J3aW m+/wUL/Lmd/syOzGFckkS8fFSYXK X-Google-Smtp-Source: APXvYqyC/ZQtl/nM+eUBvULAVjL3hp7IxRJMK2zhfEa5BCOj3Zy8NxktMWz2tB/cC2cCH+8xqCyuiw== X-Received: by 2002:ae9:f111:: with SMTP id k17mr12011166qkg.186.1571517332449; Sat, 19 Oct 2019 13:35:32 -0700 (PDT) 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 j7sm7742077qtc.73.2019.10.19.13.35.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 19 Oct 2019 13:35:31 -0700 (PDT) Subject: Re: bug#37785: [PATCH] Add a way to disable substitution of command keys in help strings To: Eli Zaretskii References: <7a45908a-cc9a-277b-53ea-933756e0e067@gmail.com> <936c65e4-d49b-33da-ad5a-ba854c0df1ff@gmail.com> <83h847bjl5.fsf@gnu.org> <1eecb79e-3087-8c49-5c80-d8a7f619a157@gmail.com> <837e53bh52.fsf@gnu.org> <1b644b5c-7838-eba7-9aef-39e9e8e6f22c@gmail.com> <83lftj9tod.fsf@gnu.org> From: =?UTF-8?Q?Cl=c3=a9ment_Pit-Claudel?= Message-ID: <648552f4-84d9-e7a3-2706-fa2b510c2668@gmail.com> Date: Sat, 19 Oct 2019 16:35:30 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <83lftj9tod.fsf@gnu.org> Content-Type: multipart/mixed; boundary="------------8385D040923C99D2D16BAEB8" Content-Language: en-GB X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 37785 Cc: rpluim@gmail.com, 37785@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 (-) This is a multi-part message in MIME format. --------------8385D040923C99D2D16BAEB8 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit On 2019-10-17 13:18, Eli Zaretskii wrote: >> Cc: rpluim@gmail.com, 37785@debbugs.gnu.org >> From: Clément Pit-Claudel >> Date: Thu, 17 Oct 2019 11:53:45 -0400 >> >> I've attached an updated patch. > > Thanks, I have a few minor comments. Wonderful, thanks a lot! Here's an updated patch. --------------8385D040923C99D2D16BAEB8 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 31382178b38460a526503666ccf6f389ef0768bb 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 (help_echo_substitute_command_keys): New function. (help_echo_echo, parse_menu_item): Use it. (syms_of_keyboard): Define Qhelp_echo_inhibit_substitution. * doc/lispref/text.texi (Special Properties), etc/NEWS: Document the effect of 'help-echo-inhibit-substitution'. --- doc/lispref/text.texi | 19 +++++++++++++++---- etc/NEWS | 5 +++++ src/keyboard.c | 23 ++++++++++++++++++++--- 3 files changed, 40 insertions(+), 7 deletions(-) diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index d7b04d2934..f2eaca1b71 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi @@ -3399,7 +3399,8 @@ Special Properties @anchor{Text help-echo} If text has a string as its @code{help-echo} property, then when you move the mouse onto that text, Emacs displays that string in the echo -area, or in the tooltip window (@pxref{Tooltips}). +area, or in the tooltip window (@pxref{Tooltips}), after passing it +through @code{substitute-command-keys}. If the value of the @code{help-echo} property is a function, that function is called with three arguments, @var{window}, @var{object} and @@ -3429,6 +3430,14 @@ Special Properties This feature is used in the mode line and for other active text. +@item help-echo-inhibit-substitution +@cindex help-echo text, avoid command-key substitution +@kindex help-echo-inhibit-substitution @r{(text property)} +If the first character of a @code{help-echo} string has a +non-@code{nil} @code{help-echo-inhibit-substitution} property, then it +is displayed as-is by @code{show-help-function}, without being passed +through @code{substitute-command-keys}. + @item keymap @cindex keymap of character @kindex keymap @r{(text property)} @@ -3736,9 +3745,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-@code{nil} +@code{help-echo-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..f008bf27fb 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 'help-echo-inhibit-substitution'. +Setting this on the first character of a help string disables +conversions 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..8a149d1a3c 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 help-echo-inhibit-substitution property. */ + +static Lisp_Object +help_echo_substitute_command_keys (Lisp_Object help) +{ + if (STRINGP (help) + && SCHARS (help) > 0 + && !NILP (Fget_text_property (make_fixnum(0), + Qhelp_echo_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, help_echo_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))); + help_echo_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 = help_echo_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 (Qhelp_echo_inhibit_substitution, "help-echo-inhibit-substitution"); DEFSYM (QCrtl, ":rtl"); staticpro (&item_properties); -- 2.17.1 --------------8385D040923C99D2D16BAEB8-- From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 20 08:08:26 2019 Received: (at 37785) by debbugs.gnu.org; 20 Oct 2019 12:08:26 +0000 Received: from localhost ([127.0.0.1]:53968 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iMA0Y-0000Rf-6L for submit@debbugs.gnu.org; Sun, 20 Oct 2019 08:08:26 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59017) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iMA0W-0000RP-7u for 37785@debbugs.gnu.org; Sun, 20 Oct 2019 08:08:24 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:47507) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iMA0R-0000xm-5Q; Sun, 20 Oct 2019 08:08:19 -0400 Received: from [176.228.60.248] (port=2544 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iMA0P-0000Yw-Lg; Sun, 20 Oct 2019 08:08:18 -0400 Date: Sun, 20 Oct 2019 15:08:09 +0300 Message-Id: <83blub62mu.fsf@gnu.org> From: Eli Zaretskii To: =?utf-8?Q?Cl=C3=A9ment?= Pit-Claudel In-reply-to: <648552f4-84d9-e7a3-2706-fa2b510c2668@gmail.com> (message from =?utf-8?Q?Cl=C3=A9ment?= Pit-Claudel on Sat, 19 Oct 2019 16:35:30 -0400) Subject: Re: bug#37785: [PATCH] Add a way to disable substitution of command keys in help strings References: <7a45908a-cc9a-277b-53ea-933756e0e067@gmail.com> <936c65e4-d49b-33da-ad5a-ba854c0df1ff@gmail.com> <83h847bjl5.fsf@gnu.org> <1eecb79e-3087-8c49-5c80-d8a7f619a157@gmail.com> <837e53bh52.fsf@gnu.org> <1b644b5c-7838-eba7-9aef-39e9e8e6f22c@gmail.com> <83lftj9tod.fsf@gnu.org> <648552f4-84d9-e7a3-2706-fa2b510c2668@gmail.com> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 37785 Cc: rpluim@gmail.com, 37785@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 (---) > Cc: rpluim@gmail.com, 37785@debbugs.gnu.org > From: Clément Pit-Claudel > Date: Sat, 19 Oct 2019 16:35:30 -0400 > > Wonderful, thanks a lot! Here's an updated patch. LGTM. Please feel free to install, after fixing this one nit: > + && !NILP (Fget_text_property (make_fixnum(0), ^ Blank missing before the opening parenthesis. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 20 21:54:00 2019 Received: (at 37785-done) by debbugs.gnu.org; 21 Oct 2019 01:54:00 +0000 Received: from localhost ([127.0.0.1]:55533 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iMMtU-0003bN-Ak for submit@debbugs.gnu.org; Sun, 20 Oct 2019 21:54:00 -0400 Received: from mail-qk1-f182.google.com ([209.85.222.182]:44789) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iMMtS-0003bA-Vy for 37785-done@debbugs.gnu.org; Sun, 20 Oct 2019 21:53:59 -0400 Received: by mail-qk1-f182.google.com with SMTP id u22so10996631qkk.11 for <37785-done@debbugs.gnu.org>; Sun, 20 Oct 2019 18:53:58 -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:content-transfer-encoding; bh=RsEDTJY9ZPcpI5uOi0eE3ZQEErJEhKkcSIWtdfkaZi8=; b=c54rm3xN19itQ2ZRzf1PP3mceeHbcnvh1CENNRYhZPQ6W7RFbYP/1eFAhYCdRxkXuM EZ2xkHcPnlUZDIPjSLoahpWJII6C1sGgIio8/znafV9HBFYFZMqF6PguNtJJek1VRcVT 7EVS7h1cZm9THaqxWTeONv2dMuoRE7n66XVqyeQC3fqa5mdgy31UyH8QmxfWR4MymUNn 2OEkk0NoK9dOJ+dw4Vrj02TdBLSav39Kcarkqk9xXVpoHP6OPY+CtAONmjRDNl5uRrtH VkE3+pz4W46aO5CBbhIo3x1fsFc2WhbGBkcq8+Y4HA2vf/Yg42+iq0AxpRmVIwVQzib3 qbBQ== 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 :content-transfer-encoding; bh=RsEDTJY9ZPcpI5uOi0eE3ZQEErJEhKkcSIWtdfkaZi8=; b=JAWLdis5rJ0KPqpLuDck+TLlhUR80bqR1gLEQpFS1j1qvkl5Lx/U3Xu80g7/pVyhnP aX1qdmRYHbs8ePV/xIMpE9HnHEDo6iU9CmE020Cmfwa51Mwc3ZRqcvgStIsLxBWJccTE lJismQfYUCZxUTrJ5YmJoqDtA9Ffj0PoIiQ2vGhFP5dQ69TG7QL/5fdL/dinjJHZ2ip4 ZtSYJjTDCOu2CPnwN3MUeaZna81iOKN/pBhJb9jia3W/+iGWAcK42k5FhWIjMkuVL+GW G3/yNEJzrtXGOvjXZcEhIs33/R1DWVGtuMDUA61VCLWKp0HJNtTLrR2ubZea73RJKcfY 0vZQ== X-Gm-Message-State: APjAAAV9l3EyTwW/AZ7L6yFpzJuBWQ0B6gt55B6oEaS3gZVFA/34+pxD rsfS2f1y40ZkfiW0Rzqw8wi0LpwW X-Google-Smtp-Source: APXvYqzmXJHosFRuWvIGz6yS+BYHLMB8WKje/tKi6cNBxOpqrFtOE+FikcGoYRpsbKWHdz0G/Ucslw== X-Received: by 2002:ae9:e30c:: with SMTP id v12mr13949674qkf.436.1571622833337; Sun, 20 Oct 2019 18:53:53 -0700 (PDT) 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 q16sm4334263qke.22.2019.10.20.18.53.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 20 Oct 2019 18:53:51 -0700 (PDT) Subject: Re: bug#37785: [PATCH] Add a way to disable substitution of command keys in help strings To: Eli Zaretskii References: <7a45908a-cc9a-277b-53ea-933756e0e067@gmail.com> <936c65e4-d49b-33da-ad5a-ba854c0df1ff@gmail.com> <83h847bjl5.fsf@gnu.org> <1eecb79e-3087-8c49-5c80-d8a7f619a157@gmail.com> <837e53bh52.fsf@gnu.org> <1b644b5c-7838-eba7-9aef-39e9e8e6f22c@gmail.com> <83lftj9tod.fsf@gnu.org> <648552f4-84d9-e7a3-2706-fa2b510c2668@gmail.com> <83blub62mu.fsf@gnu.org> From: =?UTF-8?Q?Cl=c3=a9ment_Pit-Claudel?= Message-ID: <9dbb5fe8-a6f4-f934-d56f-1cc051f6d5c5@gmail.com> Date: Sun, 20 Oct 2019 21:53:49 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <83blub62mu.fsf@gnu.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 37785-done Cc: 37785-done@debbugs.gnu.org, rpluim@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 (-) On 2019-10-20 08:08, Eli Zaretskii wrote: > LGTM. Please feel free to install, after fixing this one nit: Done! Thanks again for your help :) From unknown Tue Sep 09 22:00:15 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 18 Nov 2019 12:24:10 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator