From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: Andreas Schwab <schwab@linux-m68k.org>
Newsgroups: gmane.emacs.devel
Subject: Re: buffer-string considered as a Bad Thing.
Date: Tue, 04 Jun 2024 22:22:52 +0200
Message-ID: <878qzk8nkz.fsf@igel.home>
References: <Zl9lcuxkwBDw3GvZ@ACM>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
	logging-data="14087"; mail-complaints-to="usenet@ciao.gmane.io"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cc: emacs-devel@gnu.org
To: Alan Mackenzie <acm@muc.de>
Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Jun 04 22:24:01 2024
Return-path: <emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org>
Envelope-to: ged-emacs-devel@m.gmane-mx.org
Original-Received: from lists.gnu.org ([209.51.188.17])
	by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
	(Exim 4.92)
	(envelope-from <emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org>)
	id 1sEahN-0003VP-CQ
	for ged-emacs-devel@m.gmane-mx.org; Tue, 04 Jun 2024 22:24:01 +0200
Original-Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <emacs-devel-bounces@gnu.org>)
	id 1sEagQ-0007nD-3z; Tue, 04 Jun 2024 16:23:02 -0400
Original-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 <whitebox@nefkom.net>)
 id 1sEagO-0007mr-L6
 for emacs-devel@gnu.org; Tue, 04 Jun 2024 16:23:00 -0400
Original-Received: from mail-out.m-online.net ([212.18.0.9])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <whitebox@nefkom.net>)
 id 1sEagM-0000b3-EH
 for emacs-devel@gnu.org; Tue, 04 Jun 2024 16:23:00 -0400
Original-Received: from frontend01.mail.m-online.net (unknown [192.168.8.182])
 by mail-out.m-online.net (Postfix) with ESMTP id 4Vv28Y4RLNz1qsPP;
 Tue,  4 Jun 2024 22:22:53 +0200 (CEST)
Original-Received: from localhost (dynscan1.mnet-online.de [192.168.6.68])
 by mail.m-online.net (Postfix) with ESMTP id 4Vv28Y3StFz1qqlS;
 Tue,  4 Jun 2024 22:22:53 +0200 (CEST)
X-Virus-Scanned: amavis at mnet-online.de
Original-Received: from mail.mnet-online.de ([192.168.8.182])
 by localhost (dynscan1.mail.m-online.net [192.168.6.68]) (amavis, port 10024)
 with ESMTP id WodKS5WPYmQI; Tue,  4 Jun 2024 22:22:52 +0200 (CEST)
X-Auth-Info: kO/3LWXPsia0RdltzEe2RQMo1u6ILm+McNRru9ueMsp99Sbv/nd0W3KwRuqc+KdC
Original-Received: from igel.home (aftr-82-135-83-117.dynamic.mnet-online.de
 [82.135.83.117])
 (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;
 Tue,  4 Jun 2024 22:22:52 +0200 (CEST)
Original-Received: by igel.home (Postfix, from userid 1000)
 id 8639B2C1AB5; Tue,  4 Jun 2024 22:22:52 +0200 (CEST)
In-Reply-To: <Zl9lcuxkwBDw3GvZ@ACM> (Alan Mackenzie's message of "Tue, 4 Jun
 2024 19:05:22 +0000")
X-Yow: I left my WALLET in the BATHROOM!!
Received-SPF: pass client-ip=212.18.0.9; envelope-from=whitebox@nefkom.net;
 helo=mail-out.m-online.net
X-Spam_score_int: -23
X-Spam_score: -2.4
X-Spam_bar: --
X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9,
 HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_LOW=-0.7,
 RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-BeenThere: emacs-devel@gnu.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Emacs development discussions." <emacs-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-devel>,
 <mailto:emacs-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/emacs-devel>
List-Post: <mailto:emacs-devel@gnu.org>
List-Help: <mailto:emacs-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-devel>,
 <mailto:emacs-devel-request@gnu.org?subject=subscribe>
Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org
Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org
Xref: news.gmane.io gmane.emacs.devel:319827
Archived-At: <http://permalink.gmane.org/gmane.emacs.devel/319827>

On Jun 04 2024, Alan Mackenzie wrote:

> As an example, in pp, the function pp-to-string does this.  To see the
> effect, try
>
>     M-: (pp "foo \"bar\" baz")
>
> ..  This gets printed correctly to the temporary buffer  *temp* as:
>
>     "foo \"bar\" baz" ;; (a 13 character string)
>
> , but buffer-string wrongly converts those literal characters to
>
>     "foo \\\"bar\\\" baz" ;; (a 15 character string)

That's not what I get.

ELISP> (pp-to-string "foo \"bar\" baz")
"\"foo \\\"bar\\\" baz\""

This string correctly represents the contents of the buffer.

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