Subject: bug#37785: [PATCH] Add a way to disable substitution of command keys in help strings

From: Robert Pluim <[email-masked]>
Date: Thu, 17 Oct 2019 11:44:50 +0200

>>>>> On Wed, 16 Oct 2019 21:41:27 -0400, Clément Pit-Claudel <[email-masked]> said:

    Clément> Hi all,
    Clément> 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ément> […]
    >> 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ément> Here is a first cut at a patch implementing this feature.  I hope this
    Clément> tracker is the right place to post it.  I'm also not quite sure I got
    Clément> the Changelog format right.

    Clément> Cheers,
    Clément> Clément.

    Clément> From 8092b19d819182c91e6066d24f243dc7d7d8641e Mon Sep 17 00:00:00 2001
    Clément> From: =?UTF-8?q?Cl=C3=A9ment=20Pit-Claudel?= <[email-masked]>
    Clément> Date: Wed, 16 Oct 2019 21:28:47 -0400
    Clément> Subject: [PATCH] Add a way to disable substitution of command keys in help
    Clément>  strings

    Clément> * src/keyboard.c (show_help_substitute_command_keys): New function
    Clément> (show_help_echo, parse_menu_item): Use it
    Clément> (syms_of_keyboard): Define Qshow_help_inhibit_substitution

    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.

    Clément> ++++
    Clément> +** Adding a non-nil 'show-help-inhibit-substitution' text property on
    Clément> +the first character of a help string disables conversion via
    Clément> +'substitute-command-keys'.
    Clément> +

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ément> +/* Substitute key descriptions and quotes in HELP, unless its first
    Clément> +   character has a non-nil show-help-inhibit-substitution property. */

Two spaces after full stop.

    Clément> +
    Clément> +static Lisp_Object
    Clément> +show_help_substitute_command_keys (Lisp_Object help)
    Clément> +{
    Clément> +  if (STRINGP (help) &&
    Clément> +      SCHARS (help) > 0 &&
    Clément> +      !NILP (Fget_text_property (make_fixnum(0),
    Clément> +                                 Qshow_help_inhibit_substitution,
    Clément> +                                 help)))

Break before operators, not after.

Robert