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: Fri, 04 Oct 2019 17:17:39 +0300 Message-ID: <83imp461do.fsf@gnu.org> References: <14423aa7-36c3-9ab7-6483-d43624f99e17@gmail.com> <83pnjd7pud.fsf@gnu.org> <83h84p7nih.fsf@gnu.org> <837e5l7j8n.fsf@gnu.org> 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="108958"; 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 Fri Oct 04 16:18:59 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 1iGOQ4-000S9v-Rp for ged-emacs-devel@m.gmane.org; Fri, 04 Oct 2019 16:18:56 +0200 Original-Received: from localhost ([::1]:49274 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iGOQ2-000347-Td for ged-emacs-devel@m.gmane.org; Fri, 04 Oct 2019 10:18:55 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54594) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iGOPR-00033f-Ca for emacs-devel@gnu.org; Fri, 04 Oct 2019 10:18:18 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:48613) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iGOPR-0004ES-8R; Fri, 04 Oct 2019 10:18:17 -0400 Original-Received: from [176.228.60.248] (port=4483 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iGOPO-0004eV-HP; Fri, 04 Oct 2019 10:18:17 -0400 In-reply-to: (message from =?utf-8?Q?Cl=C3=A9ment?= Pit-Claudel on Fri, 4 Oct 2019 09:56:56 -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:240573 Archived-At: > Cc: emacs-devel@gnu.org > From: Clément Pit-Claudel > Date: Fri, 4 Oct 2019 09:56:56 -0400 > > > Then why do you use APIs that are meant for keys and quoted strings? > > Why not format the message yourself? > > Sorry, I do not understand what you mean. I want to display information when the mouse hovers on a portion of the buffer. Isn't the proper way to do that to set a help-echo property on the corresponding text? help-echo is for displaying documentation, not for displaying general-purpose text strings. > The manual says nothing about command-key substitutions, it just says "If text has a string as its 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 (see Tooltips)." And a little ways down from that text you have a cross-reference to "Help display", which leads to the description of show-help-function, and that one does say the output is passed through substitute-command-keys. > Really, all that I'm complaining about is this bit of code in keyboard.c: > > if (STRINGP (help) || NILP (help)) > { > if (!NILP (Vshow_help_function)) > call1 (Vshow_help_function, Fsubstitute_command_keys (help)); > help_echo_showing_p = STRINGP (help); > } > > My question is why Vshow_help_function is called with its arguments passed through Fsubstitute_command_keys. See above. > >> Ideally, it would be best to be able to turn off that translation entirely, I think. I see why it is convenient, but it seems wasteful to mangle a string with escapes only for these escapes to be promptly removed right after. > > > > Format it yourself, and you have that, no? Or what am I missing? > > I think I've been miscommunication :/ Sorry for wasting your time. No reason to apologize or think you were wasting my time. > > I think you are using the wrong APIs for the job you need to do. > > These APIs perform the substitutions for a reason: they were all > > written for displaying documentation, not arbitrary strings. > > I'm saying that these APIs are inconsistent: sometimes they do substitution, sometimes they don't. Please tell more about these inconsistencies. Specifically, which APIs behave inconsistently? > > Then don't use help-echo, use child frames instead. > > Are you saying that flymake should grow its own implementation of tooltips Tooltips by themselves don't substitute, you get in the tooltip the exact text you've provided. Here's an example I just trried: M-: (tooltip-show "foo `bar' \\[kill-buffer]") RET The tooltip that popped up didn't do any substitutions, I see the same text I typed. The substitution happens specifically in generating the help-echo, and it happens before we pop up the tooltip. It is possible that we need to provide some additional facilities to make this stuff more flexible in specific situations, but I think we should first be on the same page regarding the existing facilities and what they are intended for.