[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Escaping a string for substitute-command-keys
From: |
Clément Pit-Claudel |
Subject: |
Re: Escaping a string for substitute-command-keys |
Date: |
Thu, 3 Oct 2019 12:46:50 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 |
On 2019-10-03 12:31, Eli Zaretskii wrote:
>> From: Clément Pit-Claudel <address@hidden>
>> 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.
I saw that part in the manual, but I was looking for a function that would do
that. Is there an easy way to tell what needs escaping, or should I just
escape all `, ', and \? (and if so, should we add a function that does that to
subr-x.el or somewhere similar?)
Clément.
- Escaping a string for substitute-command-keys, Clément Pit-Claudel, 2019/10/03
- Re: Escaping a string for substitute-command-keys, Eli Zaretskii, 2019/10/03
- Re: Escaping a string for substitute-command-keys,
Clément Pit-Claudel <=
- Re: Escaping a string for substitute-command-keys, Eli Zaretskii, 2019/10/03
- Re: Escaping a string for substitute-command-keys, Clément Pit-Claudel, 2019/10/03
- Re: Escaping a string for substitute-command-keys, Eli Zaretskii, 2019/10/03
- Re: Escaping a string for substitute-command-keys, Clément Pit-Claudel, 2019/10/04
- Re: Escaping a string for substitute-command-keys, Eli Zaretskii, 2019/10/04
- Re: Escaping a string for substitute-command-keys, Clément Pit-Claudel, 2019/10/05
- Re: Escaping a string for substitute-command-keys, Eli Zaretskii, 2019/10/05
- Re: Escaping a string for substitute-command-keys, Stefan Monnier, 2019/10/05
- Re: Escaping a string for substitute-command-keys, Eli Zaretskii, 2019/10/05
- Re: Escaping a string for substitute-command-keys, Clément Pit-Claudel, 2019/10/05