GNU bug report logs - #60454
30.0.50; `format-message' does not allow displaying "`" and "'" verbatim

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: wishlist; Reported by: Ihor Radchenko <yantar92@HIDDEN>; dated Sat, 31 Dec 2022 15:05:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Severity set to 'wishlist' from 'normal' Request was from Stefan Kangas <stefankangas@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 60454 <at> debbugs.gnu.org:


Received: (at 60454) by debbugs.gnu.org; 31 Dec 2022 20:17:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Dec 31 15:17:19 2022
Received: from localhost ([127.0.0.1]:39880 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pBiIA-00071g-VQ
	for submit <at> debbugs.gnu.org; Sat, 31 Dec 2022 15:17:19 -0500
Received: from heytings.org ([95.142.160.155]:53490)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gregory@HIDDEN>) id 1pBiI8-00071W-GB
 for 60454 <at> debbugs.gnu.org; Sat, 31 Dec 2022 15:17:17 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org;
 s=20220101; t=1672517835;
 bh=C/38RbMMCgWuupxFnzEbAni3GMWSCIycjrWeajNNgZg=;
 h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From;
 b=1GEtxP0Y/MweBSojYiCXgwb7fhhG+QMvgKWT6eUv9T+Jp/+ZY+wt3a6n0yHSKwiBI
 5F0gAeyNlOCY6aM9RiLjtqzVVWSTbVsne8r1uNzlHIq7beeD2RZrqGhlbTYQGper0Z
 AeDEIeoK8IKGahppvn4LXgB39p7lwaDPrxeqbPnEAsx63H4kBP2xk9DIDURY1E4zDN
 42ntWDCVy/AIzth9KEkF5aNuYd/dMZZuxpp6hsVCYGecnuyxBerUvY70pcaG6jIlvx
 xGj5hwTgFqqeM54Bg/0MXjuM0zidf/zW7CWs3NwJGBaVHyI+OsCWqXxBDkWVLdMrcE
 Wh3sYlgUL0kjA==
Date: Sat, 31 Dec 2022 20:17:14 +0000
From: Gregory Heytings <gregory@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>
Subject: Re: bug#60454: 30.0.50; `format-message' does not allow displaying
 "`" and "'" verbatim
In-Reply-To: <0a62cbaeff6a36ea26cd@HIDDEN>
Message-ID: <0a62cbaeff9eb343b6a7@HIDDEN>
References: <87tu1b8vi3.fsf@localhost> <0a62cbaeff9cde095dd2@HIDDEN>
 <87o7rj8pur.fsf@localhost> <0a62cbaeff6a36ea26cd@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 60454
Cc: 60454 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


And of course, if all you need is copy-pasteable code, you can use (quote 
...) instead of a literal quote: (use-package (quote foo)).





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#60454; Package emacs. Full text available.

Message received at 60454 <at> debbugs.gnu.org:


Received: (at 60454) by debbugs.gnu.org; 31 Dec 2022 19:29:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Dec 31 14:29:53 2022
Received: from localhost ([127.0.0.1]:39873 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pBhYG-0005jZ-OY
	for submit <at> debbugs.gnu.org; Sat, 31 Dec 2022 14:29:53 -0500
Received: from heytings.org ([95.142.160.155]:53448)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gregory@HIDDEN>) id 1pBhYE-0005jO-Fs
 for 60454 <at> debbugs.gnu.org; Sat, 31 Dec 2022 14:29:50 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org;
 s=20220101; t=1672514989;
 bh=TIe5QzqTHpgDjuNwS/HU7DrQt7RdorL2HC0DwC9gaoE=;
 h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From;
 b=nyFIVsvNNjh7+TPY6CownuVcoVVI1x4TtCfo/CbkcV10nXuhYov0C5s6gUXmVzAMa
 FPW4H8mPDOUYznpVaxo5DEz4oe8dF53rb4YN4REJQHFlBneG41rA1KPVv/6hvwRHk1
 oYKoCwejSjEQ9RY3hNX1DwDhZW55hWgCsj3TKuxN/JXwDeWBmjTr/GUNAJwfttR667
 vSuuf0fJG3Fbrjsn8VLWBnRv4+m8qhTL7IH3d0qeVlCPnuVE3CPVaxYoFN6Cx7CjWH
 c5Y42dxYFdyQXgM+PN95o131GUvILK/AUbZh/uUKvJa7KxRAChbQPra8bIWwRdB++5
 bbZty7ZB66mVA==
Date: Sat, 31 Dec 2022 19:29:48 +0000
From: Gregory Heytings <gregory@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>
Subject: Re: bug#60454: 30.0.50; `format-message' does not allow displaying
 "`" and "'" verbatim
In-Reply-To: <87o7rj8pur.fsf@localhost>
Message-ID: <0a62cbaeff6a36ea26cd@HIDDEN>
References: <87tu1b8vi3.fsf@localhost> <0a62cbaeff9cde095dd2@HIDDEN>
 <87o7rj8pur.fsf@localhost>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="pZLa78qoJR"
Content-ID: <0a62cbaeff393040efe5@HIDDEN>
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 60454
Cc: 60454 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


--pZLa78qoJR
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: quoted-printable
Content-ID: <0a62cbaeff8b733d5257@HIDDEN>


>> Just let-bind text-quoting-style:
>>
>> (let ((text-quoting-style 'grave))
>>    (format-message "foo `bar' baz"))
>
> This won't work when I sometimes actually want the replacement to=20
> happen:
>
> (format-message "This is variable `foo', and the code 'bar")
>

Indeed.  If you want both literal ` ' and interpreted ` ', until Stefan's=
=20
suggestion is implemented, you can either use what Andreas suggested, or=20
use a variant of format-message such as:

(defun format-message-alt (format &rest objects)
   "Format a string out of a format-string and arguments.

This acts like `format-message', which see, except that the grave
accent (\\=3D`) and apostrophe (\\=3D') can be escaped with `\\\\=E2=80=8B=
=3D',
in which case they are not replaced by the left and right quote
replacement characters specified by `text-quoting-style'."
   (let* ((fq
 =09  (replace-regexp-in-string
 =09   "\\\\=3D`" "\uE001"
 =09   (replace-regexp-in-string
 =09    "\\\\=3D'" "\uE000" format)))
 =09 (fm (format-message fq objects))
 =09 (fu
 =09  (replace-regexp-in-string
 =09   "\uE001" "`"
 =09   (replace-regexp-in-string
 =09    "\uE000" "'" fm))))
     fu))

--pZLa78qoJR--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#60454; Package emacs. Full text available.

Message received at 60454 <at> debbugs.gnu.org:


Received: (at 60454) by debbugs.gnu.org; 31 Dec 2022 17:06:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Dec 31 12:06:22 2022
Received: from localhost ([127.0.0.1]:39745 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pBfJO-0008BZ-J4
	for submit <at> debbugs.gnu.org; Sat, 31 Dec 2022 12:06:22 -0500
Received: from mout02.posteo.de ([185.67.36.66]:53861)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@HIDDEN>) id 1pBfJM-0008BI-SF
 for 60454 <at> debbugs.gnu.org; Sat, 31 Dec 2022 12:06:21 -0500
Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id D942724025D
 for <60454 <at> debbugs.gnu.org>; Sat, 31 Dec 2022 18:06:12 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1672506374; bh=V5XJsUMo7uoia2SvgkHo2ScI8ubLjHNpUPGngNj/o1s=;
 h=From:To:Cc:Subject:Date:From;
 b=QZrzRN4h0pcg6ANclcgedMdCHuAM3q7eFDmnDtW0rgB+QOoOyz+p9TSN3DMF4L6jH
 3ajfdKwqbC4Lf6T07qKwqKXgaSDrxC4P5nyrhfQusJgLetB5RaleU4oEK5hcAjHzPP
 ZilcNz/6ysIFWobvZQTfLnfs/ONwXuMe9bNLDHMrsYO1tLCbswMnrrj9G6fPqBe60R
 I+KI76YPmySUJySN9C5A1gjn9MxQJzznMHas5y5394uC+rFJfY3qPC+67v8nE3c/tJ
 2qCfdpj0WWpzWLLRzpfAuO0Ud8dZcrNPM+M3aDqEPNyrO8YKXqsM3oJ963Vd5W5yzM
 3wBFDhlSXcFjw==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4NkpS05LGgz9rxG;
 Sat, 31 Dec 2022 18:06:08 +0100 (CET)
From: Ihor Radchenko <yantar92@HIDDEN>
To: Gregory Heytings <gregory@HIDDEN>
Subject: Re: bug#60454: 30.0.50; `format-message' does not allow displaying
 "`" and "'" verbatim
In-Reply-To: <0a62cbaeff9cde095dd2@HIDDEN>
References: <87tu1b8vi3.fsf@localhost> <0a62cbaeff9cde095dd2@HIDDEN>
Date: Sat, 31 Dec 2022 17:06:36 +0000
Message-ID: <87o7rj8pur.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 60454
Cc: 60454 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Gregory Heytings <gregory@HIDDEN> writes:

>> Would it be possible to introduce some kind of escape mechanism in 
>> `format-message' to produce literal "'" and "`" when needed?
>>
>
> Just let-bind text-quoting-style:
>
> (let ((text-quoting-style 'grave))
>    (format-message "foo `bar' baz"))

This won't work when I sometimes actually want the replacement to
happen:

(format-message "This is variable `foo', and the code 'bar")

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#60454; Package emacs. Full text available.

Message received at 60454 <at> debbugs.gnu.org:


Received: (at 60454) by debbugs.gnu.org; 31 Dec 2022 16:39:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Dec 31 11:39:46 2022
Received: from localhost ([127.0.0.1]:39707 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pBete-0007Rv-2Z
	for submit <at> debbugs.gnu.org; Sat, 31 Dec 2022 11:39:46 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:10847)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1pBetb-0007Rf-Lq
 for 60454 <at> debbugs.gnu.org; Sat, 31 Dec 2022 11:39:44 -0500
Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 9EECA100310;
 Sat, 31 Dec 2022 11:39:37 -0500 (EST)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 48947100178;
 Sat, 31 Dec 2022 11:39:36 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1672504776;
 bh=9z17J4InxaMHF2o+q8Foe7mlu3u16XBrgnDqB8Boe68=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=aouvyuEHIralJsjT+OJ0giyabYuTmXRsTyivfd4TwYAYaqy/8nH4WXE441Spbkh4B
 G3QMxKc4Zw1ivfF8KiliHExvICqY/YS2sDNARJKA3QQtOE95h5UggmNEwRQ/eQ92cL
 coYQXERBUaNpr5PdjTgCnQdPHkilhFj5rXtLAUTvz4f9CKQhTh3ZmtHm95bMc21N7g
 4nUWLWCpkks7zxSLfrxmu7c7UiHrFoSl0/eGIw2ChalIqihicQPh4TOK2FDGd3hL9+
 /Tz7Kg/V0+LWR1Qejq3CVQxrE/xsPA+f6E2aEp2F25+WWeCw/XaFW6wQSM52CU/bTh
 3JJyfsY6fttEA==
Received: from pastel (unknown [45.72.200.228])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 19E52120931;
 Sat, 31 Dec 2022 11:39:36 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: Andreas Schwab <schwab@HIDDEN>
Subject: Re: bug#60454: 30.0.50; `format-message' does not allow displaying
 "`" and "'" verbatim
In-Reply-To: <87wn67d1ii.fsf@HIDDEN> (Andreas Schwab's message of "Sat, 31
 Dec 2022 16:41:09 +0100")
Message-ID: <jwv7cy7o7ma.fsf-monnier+emacs@HIDDEN>
References: <87tu1b8vi3.fsf@localhost> <87wn67d1ii.fsf@HIDDEN>
Date: Sat, 31 Dec 2022 11:39:35 -0500
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.417 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 60454
Cc: Ihor Radchenko <yantar92@HIDDEN>, 60454 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

>> However, sometimes, it is desired to keep these chars literal.
>> For example, `org-assert-version' displays a warning that suggests Elisp
>> code:
>>
>> (warn "...
>>    It is recommended to put
>>     (straight-use-package 'org)
>> ...")
>
> The mangling only happens in the format string.  Pass the text as
> argument and substitute it with %s.
>
> (warn "...
>    It is recommended to put
>     %s
> ..." "(straight-use-package 'org)")

That's rather cumbersome.
I think it would make a lot of sense to offer escapes like %' and %`


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#60454; Package emacs. Full text available.

Message received at 60454 <at> debbugs.gnu.org:


Received: (at 60454) by debbugs.gnu.org; 31 Dec 2022 15:42:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Dec 31 10:42:47 2022
Received: from localhost ([127.0.0.1]:39650 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pBe0V-00060V-08
	for submit <at> debbugs.gnu.org; Sat, 31 Dec 2022 10:42:47 -0500
Received: from heytings.org ([95.142.160.155]:53232)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gregory@HIDDEN>) id 1pBe0T-00060M-3P
 for 60454 <at> debbugs.gnu.org; Sat, 31 Dec 2022 10:42:45 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org;
 s=20220101; t=1672501364;
 bh=dytPr/LTdJ4KSpDEGL3HP1tKacATKiHFoI5PQudPrjM=;
 h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From;
 b=GZGMJq07kHoC2FQmnCYMPcFDy1kitx5vd+2UQrTJQPYC875JLRzg4icZXNsF42du1
 qe+AMskJUr0hpJfuYZywJtMz/S8318Len9+VjvhFC9rTlB0ARxFTZben+a+aQnru0G
 ckfPMuCGyJrrxRNVVSnGgp27Oo2aAAnWhb3XAkvWghKjjSDMMoAwPS6zUrabQha8lg
 LbIYyR+A5mWu1z+5vExariSb3VPaEDA9afDuXb+qwfrwcA3PbiwQJoHbiReXXcXSQn
 1snbtBTjfwDkrcIahGzaTq3kzJvfTCPHIYMidIw/HP+4j5wLgZCyVUvccd0RMac6vd
 KtcTO5cP/VgYQ==
Date: Sat, 31 Dec 2022 15:42:44 +0000
From: Gregory Heytings <gregory@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>
Subject: Re: bug#60454: 30.0.50; `format-message' does not allow displaying
 "`" and "'" verbatim
In-Reply-To: <87tu1b8vi3.fsf@localhost>
Message-ID: <0a62cbaeff9cde095dd2@HIDDEN>
References: <87tu1b8vi3.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain; format=flowed; charset=us-ascii
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 60454
Cc: 60454 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


>
> Would it be possible to introduce some kind of escape mechanism in 
> `format-message' to produce literal "'" and "`" when needed?
>

Just let-bind text-quoting-style:

(let ((text-quoting-style 'grave))
   (format-message "foo `bar' baz"))





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#60454; Package emacs. Full text available.

Message received at 60454 <at> debbugs.gnu.org:


Received: (at 60454) by debbugs.gnu.org; 31 Dec 2022 15:41:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Dec 31 10:41:14 2022
Received: from localhost ([127.0.0.1]:39646 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pBdz0-0005yG-Jr
	for submit <at> debbugs.gnu.org; Sat, 31 Dec 2022 10:41:14 -0500
Received: from mail-out.m-online.net ([212.18.0.9]:36934)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <whitebox@HIDDEN>) id 1pBdyy-0005y8-WD
 for 60454 <at> debbugs.gnu.org; Sat, 31 Dec 2022 10:41:13 -0500
Received: from frontend03.mail.m-online.net (unknown [192.168.6.182])
 by mail-out.m-online.net (Postfix) with ESMTP id 4NkmYz17R2z1r0mw;
 Sat, 31 Dec 2022 16:41:10 +0100 (CET)
Received: from localhost (dynscan3.mnet-online.de [192.168.6.84])
 by mail.m-online.net (Postfix) with ESMTP id 4NkmYy6C39z1qqlS;
 Sat, 31 Dec 2022 16:41:10 +0100 (CET)
X-Virus-Scanned: amavisd-new at mnet-online.de
Received: from mail.mnet-online.de ([192.168.8.182])
 by localhost (dynscan3.mail.m-online.net [192.168.6.84]) (amavisd-new,
 port 10024)
 with ESMTP id GWIc5u4H8TWv; Sat, 31 Dec 2022 16:41:10 +0100 (CET)
X-Auth-Info: YemYTwR4rSeXfEW3XItV0BuPiBQsBhbLxGMoeXc6wyJ9ytUdaZp55aehHfIlBHax
Received: from igel.home (aftr-62-216-205-97.dynamic.mnet-online.de
 [62.216.205.97])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by mail.mnet-online.de (Postfix) with ESMTPSA;
 Sat, 31 Dec 2022 16:41:10 +0100 (CET)
Received: by igel.home (Postfix, from userid 1000)
 id E9E732C141E; Sat, 31 Dec 2022 16:41:09 +0100 (CET)
From: Andreas Schwab <schwab@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>
Subject: Re: bug#60454: 30.0.50; `format-message' does not allow displaying
 "`" and "'" verbatim
References: <87tu1b8vi3.fsf@localhost>
X-Yow: I have a TINY BOWL in my HEAD
Date: Sat, 31 Dec 2022 16:41:09 +0100
In-Reply-To: <87tu1b8vi3.fsf@localhost> (Ihor Radchenko's message of "Sat, 31
 Dec 2022 15:04:36 +0000")
Message-ID: <87wn67d1ii.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.4 (/)
X-Debbugs-Envelope-To: 60454
Cc: 60454 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.4 (-)

On Dez 31 2022, Ihor Radchenko wrote:

> However, sometimes, it is desired to keep these chars literal.
> For example, `org-assert-version' displays a warning that suggests Elisp
> code:
>
> (warn "...
>    It is recommended to put
>     (straight-use-package 'org)
> ...")

The mangling only happens in the format string.  Pass the text as
argument and substitute it with %s.

(warn "...
   It is recommended to put
    %s
..." "(straight-use-package 'org)")

-- 
Andreas Schwab, schwab@HIDDEN
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#60454; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 31 Dec 2022 15:04:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Dec 31 10:04:33 2022
Received: from localhost ([127.0.0.1]:39624 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pBdPU-000547-Kf
	for submit <at> debbugs.gnu.org; Sat, 31 Dec 2022 10:04:33 -0500
Received: from lists.gnu.org ([209.51.188.17]:41204)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@HIDDEN>) id 1pBdPT-000540-8x
 for submit <at> debbugs.gnu.org; Sat, 31 Dec 2022 10:04:31 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <yantar92@HIDDEN>)
 id 1pBdPT-0001UR-33
 for bug-gnu-emacs@HIDDEN; Sat, 31 Dec 2022 10:04:31 -0500
Received: from mout02.posteo.de ([185.67.36.66])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <yantar92@HIDDEN>)
 id 1pBdPQ-0000EL-KQ
 for bug-gnu-emacs@HIDDEN; Sat, 31 Dec 2022 10:04:30 -0500
Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 0692B240258
 for <bug-gnu-emacs@HIDDEN>; Sat, 31 Dec 2022 16:04:13 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1672499054; bh=OMQphf6VaXe7pvurjAbHpj8ROizN1YauCCQ0QRpaE1Q=;
 h=From:To:Subject:Date:From;
 b=mwg73Hiiq5BEhjqCAGUzZc2Oo6rnpvjsdBeUH+jVip0Qi4eQ/TZmo+Hf0968R/miU
 S4L/IxJJ51bmYrOH18RNR0SjA2fpZ+1IKrtZNa3k0/Myy7TNgNdS13kIGMQymvvyBZ
 a2PuMWHnh5+DwtPrM6DMOnySlPG9jzruamgfsftlddTdaLYjqWzH7a3lm9oWYThvcm
 hM2X7Y6qZ4TalvGSJ3rTO9BUquQFbZ2lpQQvoftLtMj0QW7so110r4kCt78WbCp5gO
 E8xhXvxwnOuIIIZdmm4VPfevPwv0hBhjEP1KY4zV/ehyRQJY8fLI8ec31a8iGkF5nl
 cc+qaVaHF86zg==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4NkllK3STxz6tmF
 for <bug-gnu-emacs@HIDDEN>; Sat, 31 Dec 2022 16:04:13 +0100 (CET)
From: Ihor Radchenko <yantar92@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 30.0.50; `format-message' does not allow displaying "`" and "'"
 verbatim
X-Debbugs-CC: Stefan Monnier <monnier@HIDDEN>
Date: Sat, 31 Dec 2022 15:04:36 +0000
Message-ID: <87tu1b8vi3.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@HIDDEN;
 helo=mout02.posteo.de
X-Spam_score_int: -43
X-Spam_score: -4.4
X-Spam_bar: ----
X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

Hi,

Following up https://list.orgmode.org/87k027af5x.fsf@localhost/T/#t
and https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=3D62dc4=
9509c8962bd2a19c4c4475fc616eebdfde8

`format-message' and thus also `warn' unconditionally replace _all_ the
instances of "`" and "'" in the message:

    This acts like =E2=80=98format=E2=80=99, except it also replaces each g=
rave accent (`)
    by a left quote, and each apostrophe (') by a right quote.

However, sometimes, it is desired to keep these chars literal.
For example, `org-assert-version' displays a warning that suggests Elisp
code:

(warn "...
   It is recommended to put
    (straight-use-package 'org)
...")

Replacing "'" is undesired here and will make copy-pasted Elisp code
incorrect.

Would it be possible to introduce some kind of escape mechanism in
`format-message' to produce literal "'" and "`" when needed?

In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.35, cairo version 1.17.6) of 2022-12-26 built on localhost
Repository revision: cc29fab3a66c59e77d0ff67c0f3e2e34ec80a03c
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101004
System Description: Gentoo Linux

--=20
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>




Acknowledgement sent to Ihor Radchenko <yantar92@HIDDEN>:
New bug report received and forwarded. Copy sent to monnier@HIDDEN, bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to monnier@HIDDEN, bug-gnu-emacs@HIDDEN:
bug#60454; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 4 Sep 2023 15:15:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.