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: Thu, 3 Oct 2019 12:46:50 -0400 Message-ID: References: <14423aa7-36c3-9ab7-6483-d43624f99e17@gmail.com> <83pnjd7pud.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="111840"; 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 Thu Oct 03 18:47:34 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 1iG4GL-000SxY-LB for ged-emacs-devel@m.gmane.org; Thu, 03 Oct 2019 18:47:33 +0200 Original-Received: from localhost ([::1]:38544 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iG4GJ-00074t-Ok for ged-emacs-devel@m.gmane.org; Thu, 03 Oct 2019 12:47:31 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56894) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iG4Fm-00072j-Cf for emacs-devel@gnu.org; Thu, 03 Oct 2019 12:46:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iG4Fk-00010s-AJ for emacs-devel@gnu.org; Thu, 03 Oct 2019 12:46:58 -0400 Original-Received: from mail-qt1-x836.google.com ([2607:f8b0:4864:20::836]:44158) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iG4Fk-0000xN-6J; Thu, 03 Oct 2019 12:46:56 -0400 Original-Received: by mail-qt1-x836.google.com with SMTP id u40so4481912qth.11; Thu, 03 Oct 2019 09:46:52 -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=ObWb1xrOQOAQ8t7cekIoo0L0ouCmgwioymSrSney6Zw=; b=N74eHCIHY4osJO0R+TkK2dMb0Ct62ybyByywdaDI1HrlBGIz45T4q4MUCeoIv2EyOi 8c+vnubkhKgCkaBLR3ZVnrNL2yTPwfzGKw7DYkrjqz8+8kQ6+sOA5YZ26+lIO78HSKot 4oHPeUsG1N8pFbJ530PZDqwk3BtvbtebFTTDEjRLvpCKUWo4/fQXVChjlLeM/P4ckE5W KuGomXzem0jrT6VLa/BPGQLVt4Ji4scHC7cGEPCpJwHNDHaUm7wAcs2PcHhxn6cqkPnG hY5VY4elRQXdpyXTzNjc29V6jmuXHTLbszGHNVAw4tDHwUKSVXgzLbsLalwglQTQIwwx RhHw== 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=ObWb1xrOQOAQ8t7cekIoo0L0ouCmgwioymSrSney6Zw=; b=rswl0yrPbiuO22lQvZ0VoWWUT2oU0+pI2/BKIYlW8xqtjNMaisp1Gc2kYNtyv1KbWc DF9k30XNpy39mql/GrjRwmjpn8GeW9X8yke7nZKnAGORFE//HgyOHeUaMO4xwsPaLvip iJwXCEE1Sj5KjOKp6/aoUZCzKWYkmmUohNMhhy+sp+b+xDkPMy3Xy1W3dRjZMay1JLm7 OimhJzHsPnucP5wMJFVjx0mAqJglNUhiby5jke/10nuufRTijc3tb+AGRWQZRjrOqKYK Pbwodu+vlf+uW4fmNV57bi9sAXBdk+4yyWiPCaK9HZcMsA6U3FMgzTieW3EsagPw1HXl kPlg== X-Gm-Message-State: APjAAAWLH4/Pt6XwR11pFJ+s3ATDuabw0gB7jAaX58fsdCr0JXbLBR2W 9VS+LatFE8PuEYfDvlopv+dPZD0N X-Google-Smtp-Source: APXvYqyI/8C4zAXZurrTiwfDQ/2sjtHyIrMD0hWkHE6XJuptCqoJ8HkQ6GEzHV+6WgpqJK0FLHyu3A== X-Received: by 2002:a0c:e04d:: with SMTP id y13mr9288974qvk.14.1570121211721; Thu, 03 Oct 2019 09:46:51 -0700 (PDT) Original-Received: from ?IPv6:2601:184:4180:66e7:656c:d996:de5:9bda? ([2601:184:4180:66e7:656c:d996:de5:9bda]) by smtp.googlemail.com with ESMTPSA id x12sm2228581qtb.32.2019.10.03.09.46.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Oct 2019 09:46:51 -0700 (PDT) In-Reply-To: <83pnjd7pud.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::836 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:240522 Archived-At: On 2019-10-03 12:31, Eli Zaretskii wrote: >> 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. 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.