From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Robert Pluim 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 11:44:50 +0200 Message-ID: References: <7a45908a-cc9a-277b-53ea-933756e0e067@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="249208"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 37785@debbugs.gnu.org To: =?UTF-8?Q?Cl=C3=A9ment?= Pit-Claudel Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Oct 17 11:45:18 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 1iL2LL-0012al-W9 for geb-bug-gnu-emacs@m.gmane.org; Thu, 17 Oct 2019 11:45:16 +0200 Original-Received: from localhost ([::1]:40858 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iL2LK-0002ur-9e for geb-bug-gnu-emacs@m.gmane.org; Thu, 17 Oct 2019 05:45:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53839) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iL2LE-0002uX-53 for bug-gnu-emacs@gnu.org; Thu, 17 Oct 2019 05:45:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iL2L9-0000sj-2x for bug-gnu-emacs@gnu.org; Thu, 17 Oct 2019 05:45:08 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38333) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iL2L8-0000rV-R5 for bug-gnu-emacs@gnu.org; Thu, 17 Oct 2019 05:45:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iL2L8-00050s-L2 for bug-gnu-emacs@gnu.org; Thu, 17 Oct 2019 05:45:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Robert Pluim Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 17 Oct 2019 09:45: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.157130550019248 (code B ref 37785); Thu, 17 Oct 2019 09:45:02 +0000 Original-Received: (at 37785) by debbugs.gnu.org; 17 Oct 2019 09:45:00 +0000 Original-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 Original-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 Original-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) Original-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) Mail-Copies-To: never Gmane-Reply-To-List: yes In-Reply-To: <7a45908a-cc9a-277b-53ea-933756e0e067@gmail.com> ("=?UTF-8?Q?Cl=C3=A9ment?= Pit-Claudel"'s message of "Wed, 16 Oct 2019 21:41:27 -0400") 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:169550 Archived-At: >>>>> 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