From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Escaping a string for substitute-command-keys Date: Thu, 03 Oct 2019 19:31:38 +0300 Message-ID: <83pnjd7pud.fsf@gnu.org> References: <14423aa7-36c3-9ab7-6483-d43624f99e17@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="40258"; mail-complaints-to="usenet@blaine.gmane.org" Cc: emacs-devel@gnu.org To: =?utf-8?Q?Cl=C3=A9ment?= Pit-Claudel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Oct 03 18:32:43 2019 Return-path: Envelope-to: ged-emacs-devel@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 1iG41y-000AKD-T0 for ged-emacs-devel@m.gmane.org; Thu, 03 Oct 2019 18:32:43 +0200 Original-Received: from localhost ([::1]:38482 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iG41w-0001wl-3O for ged-emacs-devel@m.gmane.org; Thu, 03 Oct 2019 12:32:40 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54815) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iG41B-0001we-U9 for emacs-devel@gnu.org; Thu, 03 Oct 2019 12:31:54 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:48356) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iG41B-00026d-QP; Thu, 03 Oct 2019 12:31:53 -0400 Original-Received: from [176.228.60.248] (port=3918 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iG41A-00066o-Id; Thu, 03 Oct 2019 12:31:53 -0400 In-reply-to: <14423aa7-36c3-9ab7-6483-d43624f99e17@gmail.com> (message from =?utf-8?Q?Cl=C3=A9ment?= Pit-Claudel on Thu, 3 Oct 2019 09:52:31 -0400) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:240520 Archived-At: > From: Clément Pit-Claudel > Date: Thu, 3 Oct 2019 09:52:31 -0400 > > I think I've seen a thread about this in the past, but I can't find it. What's the expected way to escape a string before its fed to substitute-command-keys, so that substitute-command-keys reconstructs the original string? > > The reason for this question is that since 2015 Emacs has been calling substitute-command-keys on help-echo messages, which breaks flycheck and flymake (a simple way to reproduce the issue is to enable flymake in a Python buffer containing just xxx and to hover over the xxx with the mouse: Emacs shows a tooltip containing "Undefined name ’xxx’"). > > So, what's the right way to escape a string to be fed to substitute-command-keys? Alternatively, is there be a way to disable the transformation for a particular help-echo string, rather than forcing an unnecessary rountrip? Maybe we could add a text property, so that if a string is tagged with a 'text-quoting-style property that style is used instead of the default one? If I understand what you are looking for, the answer is in the manual: quote any character with \= (in a Lisp string, that's "\\=", of course). See the node "Keys in Documentation" in the ELisp manual. If this is not what you want, please tell more.