From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Cl=c3=a9ment_Pit-Claudel?= Newsgroups: gmane.emacs.devel Subject: Re: Escaping a string for substitute-command-keys Date: Fri, 4 Oct 2019 09:56:56 -0400 Message-ID: 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="11988"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Oct 04 15:57:08 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 1iGO4y-00030E-Fn for ged-emacs-devel@m.gmane.org; Fri, 04 Oct 2019 15:57:08 +0200 Original-Received: from localhost ([::1]:49136 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iGO4w-0004pF-Tu for ged-emacs-devel@m.gmane.org; Fri, 04 Oct 2019 09:57:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51041) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iGO4q-0004p7-QR for emacs-devel@gnu.org; Fri, 04 Oct 2019 09:57:02 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iGO4p-0001Dk-JI for emacs-devel@gnu.org; Fri, 04 Oct 2019 09:57:00 -0400 Original-Received: from mail-qk1-x741.google.com ([2607:f8b0:4864:20::741]:32940) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iGO4p-0001DP-Dk; Fri, 04 Oct 2019 09:56:59 -0400 Original-Received: by mail-qk1-x741.google.com with SMTP id x134so5885823qkb.0; Fri, 04 Oct 2019 06:56:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=L41ml6rYmDughU1CunOG9ekuHJGBhZqKzGwyWrEz2RA=; b=eLSG9WT2YbeBbtlrKvXNLkLAUrypGWfTj2x09RqactmTm1hG8oRNV+E2kHumK52O4d RoG6ig/aV7k4AJ+/OMEI4hCe1BxQ6fxTyV0zE10Uajn9V4jGizb/etyB8UdeYh9w8QWv 9bGNfacMGAQW1YJ2dvNOsuJgdLkH4k4RAQNw/UrwtVbH4KBNRGucye82fXzd3HcstBS7 H++bKXbNV99KC6Du3h8xGuDm/EWgmbCC7WkvVn6rSSoiuxg/u5I3DRtmmdHC5cBeXdEg gvOI/0xmpIZ6dTQqDI4yT5UfHPWsCnCRyKFz6HpOrMN8Vn8Mv+B8S6AtuVtF7O1LIrAm NenA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=L41ml6rYmDughU1CunOG9ekuHJGBhZqKzGwyWrEz2RA=; b=cT0HZFdV50nzEGdpkyOYEcPyVd/z2DTlWAch4xKTgkJiU15XOCuDI5FfajR8ycWaqF /gvypVYFPuMuZJyOWrLGkZsuqFFUEdWvTvmasZqBjmH3VWwUcLmz1r9gupi0/kHkW27S qMDlFoowWuSegJYptPmXUNiXIUinOQQVRsgjtYx3IzKpnNhZTCo7jZN27djSOFJqOXQc FJKomyELssrMuWQkhmctHFilBAj1AIiBjPzQLSslMXrJYUzRbIL6Ed+/bc538SJo+J6q gfzdq9+5T5zdL6NDDqqokXQ9SlZGEWCRl/6Ei1vdYuTHFk3KmSDGpLbkIkKRNuPfsOqC iFaQ== X-Gm-Message-State: APjAAAWUoQPzeJW7gFwGNdr72IQDU33dfm9oWx3RSFt+IO0OeG7OidpO e+ks4bW0L6Fh+EB038BnQnNOYmp2 X-Google-Smtp-Source: APXvYqye63OBPyZpRSYyGHImJU8E8LOgylQ/AzTyfNAfPCa9/ZGc2oi7ro1tHjXwQJnHlrt59vDlEg== X-Received: by 2002:a37:2c44:: with SMTP id s65mr9497762qkh.303.1570197418145; Fri, 04 Oct 2019 06:56:58 -0700 (PDT) Original-Received: from [128.30.9.205] (30-9-205.wireless.csail.mit.edu. [128.30.9.205]) by smtp.googlemail.com with ESMTPSA id n17sm3574114qke.103.2019.10.04.06.56.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Oct 2019 06:56:57 -0700 (PDT) In-Reply-To: <837e5l7j8n.fsf@gnu.org> Content-Language: en-GB X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::741 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:240571 Archived-At: On 2019-10-03 14:54, Eli Zaretskii wrote: >> Cc: emacs-devel@gnu.org >> From: Clément Pit-Claudel >> Date: Thu, 3 Oct 2019 14:28:43 -0400 >> >>> Is the problem only with quotes? Or also with other characters? >> >> Any characters: for example, \\[ should not trigger a replacement. The use case (displaying warnings and errors as overlays on code) does not require any string transformation, just to display what a tool (such as gcc or python) produced. > > 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? 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)." 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. >> 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. My text is already formatted exactly how it should look. My problem is that once I apply it using a help-echo property, it's displayed differently in the echo area and when I hover with the mouse: the pop-up from the mouse runs the contents of help-echo through substitute-command-keys, but help-at-point doesn't. >> Should all uses of help-echo be fixed to call substitute-command-keys, and should all code that sets help-echo and doesn't want substitutions changed to escape quotes and backlashes? > > 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. Tooltips have substitution applied, and help-at-point doesn't perform substitutions. And at least two clients of that API seem to be using it wrong (both Flycheck and Flymake). > Then don't use help-echo, use child frames instead. Are you saying that flymake should grow its own implementation of tooltips, just to work around the fact that help-echo strings are passed through substitute-command-keys? Thanks for your help, Clément.