From unknown Thu Jun 19 14:31:37 2025 X-Loop: help-debbugs@gnu.org Subject: bug#18909: 24.4.50; unexpected (prin1-to-string '(foo "bar") t) Resent-From: Oleh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 31 Oct 2014 15:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 18909 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 18909@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.141477004014193 (code B ref -1); Fri, 31 Oct 2014 15:41:02 +0000 Received: (at submit) by debbugs.gnu.org; 31 Oct 2014 15:40:40 +0000 Received: from localhost ([127.0.0.1]:41357 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XkEJc-0003gq-2U for submit@debbugs.gnu.org; Fri, 31 Oct 2014 11:40:40 -0400 Received: from eggs.gnu.org ([208.118.235.92]:52663) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XkEJX-0003gP-KY for submit@debbugs.gnu.org; Fri, 31 Oct 2014 11:40:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XkEIe-0002bV-TT for submit@debbugs.gnu.org; Fri, 31 Oct 2014 11:40:30 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:50695) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XkEIe-0002bM-Qc for submit@debbugs.gnu.org; Fri, 31 Oct 2014 11:39:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50845) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XkEH2-0005mE-AW for bug-gnu-emacs@gnu.org; Fri, 31 Oct 2014 11:39:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xjt3Y-0008KY-DX for bug-gnu-emacs@gnu.org; Thu, 30 Oct 2014 12:58:44 -0400 Received: from mail-ig0-x230.google.com ([2607:f8b0:4001:c05::230]:48953) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xjt3Y-0008KT-7x for bug-gnu-emacs@gnu.org; Thu, 30 Oct 2014 12:58:40 -0400 Received: by mail-ig0-f176.google.com with SMTP id l13so4036443iga.3 for ; Thu, 30 Oct 2014 09:58:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=mQKs+AM6x0KC874d5oDykUyaZqs8toAeWoUmbLw/EZo=; b=E/7ipUp2spHTOkhr+FLudsXzi9VdzL2BXSwQNkDsoFKRzui5/n5WQgl0zwBAMkBMiH ZuQwHyo7p6ODPgZ57vbG/SUspYQJQQZLQoLOa+dfkvwGsZdCAHV7AlhrW3p//7UtmLAJ KFlnojdSW/13fwZxDiSImRtrxRJjk5eOVmWU4zwGx0mZRq/0rMzHMnbl1rEeWAMVrgG3 C4yRBNudnF9wU4+V8KplzmWD0JVM/vAxBV+KH4PJ4wOVQU2WhGQalZR1AG6sBf0pSKxV 1kXzRLPcGvlRuHRv+mFHgArVXG+O3Xz6noEA3YfFgji7aeo4nnALRlspys9Wur+cXBwo ZPzA== MIME-Version: 1.0 X-Received: by 10.43.62.75 with SMTP id wz11mr3093712icb.95.1414688319171; Thu, 30 Oct 2014 09:58:39 -0700 (PDT) Received: by 10.64.13.179 with HTTP; Thu, 30 Oct 2014 09:58:39 -0700 (PDT) Date: Thu, 30 Oct 2014 17:58:39 +0100 Message-ID: From: Oleh Content-Type: text/plain; charset=UTF-8 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) Hi, To my surprise, (prin1-to-string '(foo "bar") t) evaluates as "(foo bar)". This seems like a bug to me, since it doesn't conform to the doc (it's not the printed representation of the OBJECT any more). I want to use the NOESCAPE option to obtain instead of: (prin1-to-string '(foo.bar)) => "(foo\\.bar)" this output: (prin1-to-string '(foo.bar) t) => "(foo.bar)" But the downside is that the strings are unquoted as well: (prin1-to-string '(foo "bar") t) => "(foo bar)" Please let me know if it's a bug or not, and maybe suggest how I can obtain the behavior of (prin1-to-string x t) without unquoting the strings in x. regards, Oleh From unknown Thu Jun 19 14:31:37 2025 X-Loop: help-debbugs@gnu.org Subject: bug#18909: 24.4.50; unexpected (prin1-to-string '(foo "bar") t) Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 31 Oct 2014 18:17:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18909 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Oleh Cc: 18909@debbugs.gnu.org Received: via spool by 18909-submit@debbugs.gnu.org id=B18909.141477939515177 (code B ref 18909); Fri, 31 Oct 2014 18:17:01 +0000 Received: (at 18909) by debbugs.gnu.org; 31 Oct 2014 18:16:35 +0000 Received: from localhost ([127.0.0.1]:44098 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XkGkV-0003wh-Ae for submit@debbugs.gnu.org; Fri, 31 Oct 2014 14:16:35 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:18472) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XkGkT-0003wV-7K for 18909@debbugs.gnu.org; Fri, 31 Oct 2014 14:16:33 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhMNAOatTlRFpY87/2dsb2JhbABcgw5UWII2hn7EBIdPBAICgRwXAQF8hAMBAQRWIxALNBIUGA0kiFTLcgEBAQEGAgEfkQgHhEsFlk+CQ5kOgW+EFCEvgksBAQE X-IPAS-Result: AhMNAOatTlRFpY87/2dsb2JhbABcgw5UWII2hn7EBIdPBAICgRwXAQF8hAMBAQRWIxALNBIUGA0kiFTLcgEBAQEGAgEfkQgHhEsFlk+CQ5kOgW+EFCEvgksBAQE X-IronPort-AV: E=Sophos;i="5.04,797,1406606400"; d="scan'208";a="95686505" Received: from 69-165-143-59.dsl.teksavvy.com (HELO pastel.home) ([69.165.143.59]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 31 Oct 2014 14:16:27 -0400 Received: by pastel.home (Postfix, from userid 20848) id 9693B62BA; Fri, 31 Oct 2014 14:16:27 -0400 (EDT) From: Stefan Monnier Message-ID: References: Date: Fri, 31 Oct 2014 14:16:27 -0400 In-Reply-To: (Oleh's message of "Thu, 30 Oct 2014 17:58:39 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) I don't think you can get what you want with the current code. The best you can do is (prin1-to-string '(foo.bar "baz")) and then do a search-and-replace of the "\\.". But note that the "." is escaped this way in order to avoid ambiguity with the "." used to separate the car from the cdr of a cons cell, so you should not unescape every single "\\.", only the ones where the reader recognizes the "." has being part of the symbol. Stefan From unknown Thu Jun 19 14:31:37 2025 X-Loop: help-debbugs@gnu.org Subject: bug#18909: 24.4.50; unexpected (prin1-to-string '(foo "bar") t) Resent-From: Andreas Schwab Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 31 Oct 2014 19:22:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18909 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Oleh Cc: 18909@debbugs.gnu.org Received: via spool by 18909-submit@debbugs.gnu.org id=B18909.141478326621249 (code B ref 18909); Fri, 31 Oct 2014 19:22:03 +0000 Received: (at 18909) by debbugs.gnu.org; 31 Oct 2014 19:21:06 +0000 Received: from localhost ([127.0.0.1]:44113 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XkHkw-0005Wf-5q for submit@debbugs.gnu.org; Fri, 31 Oct 2014 15:21:06 -0400 Received: from mail-out.m-online.net ([212.18.0.10]:36746) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XkHkt-0005WT-3m for 18909@debbugs.gnu.org; Fri, 31 Oct 2014 15:21:04 -0400 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 3jTtfQ163Yz3hjtw; Fri, 31 Oct 2014 20:21:01 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.68]) by mail.m-online.net (Postfix) with ESMTP id 3jTtfP635WzvhLb; Fri, 31 Oct 2014 20:21:01 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.68]) (amavisd-new, port 10024) with ESMTP id j1JPYkItaCtT; Fri, 31 Oct 2014 20:21:00 +0100 (CET) X-Auth-Info: LvAWhR/q93nrD1SocOftivbDNkjSBSrNZxnTy5XwOIatVi3NQjQM1/OofMheJ6op Received: from igel.home (ppp-188-174-153-236.dynamic.mnet-online.de [188.174.153.236]) by mail.mnet-online.de (Postfix) with ESMTPA; Fri, 31 Oct 2014 20:21:00 +0100 (CET) Received: by igel.home (Postfix, from userid 1000) id 81E482C0552; Fri, 31 Oct 2014 20:21:00 +0100 (CET) From: Andreas Schwab References: X-Yow: I want to TAKE IT HOME and DRESS IT UP in HOT PANTS!! Date: Fri, 31 Oct 2014 20:21:00 +0100 In-Reply-To: (Oleh's message of "Thu, 30 Oct 2014 17:58:39 +0100") Message-ID: <87tx2knizn.fsf@igel.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) Oleh writes: > To my surprise, > > (prin1-to-string '(foo "bar") t) > > evaluates as "(foo bar)". This seems like a bug to me, since it doesn't > conform to the doc (it's not the printed representation of the OBJECT any more). "This function outputs quoting characters when necessary to make output that `read' can handle, whenever possible, unless the optional second argument NOESCAPE is non-nil." Escaping is about _all_ quotation, not only the backslash. It's the difference between prin1 and princ. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." From unknown Thu Jun 19 14:31:37 2025 X-Loop: help-debbugs@gnu.org Subject: bug#18909: 24.4.50; unexpected (prin1-to-string '(foo "bar") t) Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 10 Feb 2018 03:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18909 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Andreas Schwab Cc: Oleh , 18909@debbugs.gnu.org Received: via spool by 18909-submit@debbugs.gnu.org id=B18909.151823226611393 (code B ref 18909); Sat, 10 Feb 2018 03:12:01 +0000 Received: (at 18909) by debbugs.gnu.org; 10 Feb 2018 03:11:06 +0000 Received: from localhost ([127.0.0.1]:35924 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ekLZC-0002xc-3J for submit@debbugs.gnu.org; Fri, 09 Feb 2018 22:11:06 -0500 Received: from mail-it0-f50.google.com ([209.85.214.50]:36258) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ekLZ9-0002x1-Pc; Fri, 09 Feb 2018 22:11:04 -0500 Received: by mail-it0-f50.google.com with SMTP id n206so675432itg.1; Fri, 09 Feb 2018 19:11:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=wJ6SYUpklLfp4BnZpfxohFW79C/Nm5Qy/psN9SmVUfY=; b=frpqVyI2LvkU9tf68H2j9VDuenW/3+kSFjDG8hX9fL1B7hvjjeXf8iXyUCcF1Lxdai NeftO+XFJfbQHSJmVN+gNMTTGfukXW58YI2t0OqUvKA4Fu/YIVFTmr04bY8+6C5Wdvoo RVctekeUZqArwudVeJxLmh9EItSJCIDpNVasLpVWz2JyTr8PQznWPBgPWSxad7ksPoDz rDhX+XUU7stUVbp93LHw7E+Jwhadzqttoiqp3iXp1ziCbuJxhWtMGfFGNTi4nbYa2zgP GNf2iLBDHAxlOIwW2/4kqhIAyoO4pZ5FuSfjZ2RhImcMz8O64KUtrAvYpvx7lJ0st4u0 jPUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=wJ6SYUpklLfp4BnZpfxohFW79C/Nm5Qy/psN9SmVUfY=; b=FL5KtXLoIAtmA6MrZ91i6TVdQVd3m13Djpwtvvc+ZVMWxdM4gBosKH2F+A3V/1UBgT /MBbICkfEdgv65tigXEXf8bTr3l8yuWv8v10oHbhMSE4M0uPsX3sNHxDlJF6LIt0utNV QCIOHBnxm/8BDqd2FgHTDmCIsUJn6HBBkkrJxGxiF6VPAjtmaBCzjE5eR2/mXMN3vZXn zyHONho20r6ys5naJSUZUQKnEZ/TN/ikwLkxE802DYH4wlMb0SjFSip6E7tP2HcQr5al 5HFpwtBnyoIcehstBe4183VWXUcrWDAFq69ylJw8BrKyiDRdW4nxAzDNFo/1WHxtB++J A8ig== X-Gm-Message-State: APf1xPDpGUo7Ju8ghwTZfRXc/Vzz9voVxiSDZg6qDES/YdXNY1pKZSdh kDstwerGddxU/aJV5xD2s9KGlA== X-Google-Smtp-Source: AH8x227wpq7GnEj6gCFuepZYaCpsgzNy9nfS8+6N+pzvs00+SNn7ovCb0MB80W0tFNIyUobctEAsFA== X-Received: by 10.36.204.139 with SMTP id x133mr6216314itf.75.1518232258278; Fri, 09 Feb 2018 19:10:58 -0800 (PST) Received: from zebian (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.googlemail.com with ESMTPSA id m71sm4476746iom.70.2018.02.09.19.10.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 09 Feb 2018 19:10:57 -0800 (PST) From: Noam Postavsky References: <87tx2knizn.fsf@igel.home> Date: Fri, 09 Feb 2018 22:10:56 -0500 In-Reply-To: <87tx2knizn.fsf@igel.home> (Andreas Schwab's message of "Fri, 31 Oct 2014 20:21:00 +0100") Message-ID: <87k1vlczen.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.2 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.2 (/) tags 18909 notabug close 18909 quit Andreas Schwab writes: > Oleh writes: > >> To my surprise, >> >> (prin1-to-string '(foo "bar") t) >> >> evaluates as "(foo bar)". This seems like a bug to me, since it doesn't >> conform to the doc (it's not the printed representation of the OBJECT any more). > > "This function outputs quoting characters when necessary to make output > that `read' can handle, whenever possible, unless the optional second > argument NOESCAPE is non-nil." > > Escaping is about _all_ quotation, not only the backslash. It's the > difference between prin1 and princ. Therefore closing as notabug.