GNU bug report logs -
#18909
24.4.50; unexpected (prin1-to-string '(foo "bar") t)
Previous Next
Reported by: Oleh <ohwoeowho <at> gmail.com>
Date: Fri, 31 Oct 2014 15:41:02 UTC
Severity: minor
Tags: notabug
Found in version 24.4.50
Done: Noam Postavsky <npostavs <at> users.sourceforge.net>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 18909 in the body.
You can then email your comments to 18909 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18909
; Package
emacs
.
(Fri, 31 Oct 2014 15:41:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Oleh <ohwoeowho <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Fri, 31 Oct 2014 15:41:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18909
; Package
emacs
.
(Fri, 31 Oct 2014 18:17:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 18909 <at> debbugs.gnu.org (full text, mbox):
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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18909
; Package
emacs
.
(Fri, 31 Oct 2014 19:22:03 GMT)
Full text and
rfc822 format available.
Message #11 received at 18909 <at> debbugs.gnu.org (full text, mbox):
Oleh <ohwoeowho <at> gmail.com> 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 <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18909
; Package
emacs
.
(Sat, 10 Feb 2018 03:12:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 18909 <at> debbugs.gnu.org (full text, mbox):
tags 18909 notabug
close 18909
quit
Andreas Schwab <schwab <at> linux-m68k.org> writes:
> Oleh <ohwoeowho <at> gmail.com> 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.
Added tag(s) notabug.
Request was from
Noam Postavsky <npostavs <at> users.sourceforge.net>
to
control <at> debbugs.gnu.org
.
(Sat, 10 Feb 2018 03:12:02 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
18909 <at> debbugs.gnu.org and Oleh <ohwoeowho <at> gmail.com>
Request was from
Noam Postavsky <npostavs <at> users.sourceforge.net>
to
control <at> debbugs.gnu.org
.
(Sat, 10 Feb 2018 03:12:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 10 Mar 2018 12:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 7 years and 103 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.