GNU bug report logs -
#27776
26.0.50; `print-gensym' doesn't work as advertised
Previous Next
Reported by: Philipp <p.stephani2 <at> gmail.com>
Date: Thu, 20 Jul 2017 21:32:01 UTC
Severity: minor
Tags: fixed
Found in version 26.0.50
Fixed in version 26.1
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 27776 in the body.
You can then email your comments to 27776 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#27776
; Package
emacs
.
(Thu, 20 Jul 2017 21:32:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Philipp <p.stephani2 <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Thu, 20 Jul 2017 21:32:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
The docstring of `print-gensym' says:
When the uninterned symbol appears within a recursive data structure,
and the symbol appears more than once, in addition use the #N# and #N=
constructs as needed, so that multiple references to the same symbol are
shared once again when the text is read back.
However, that doesn't seem to be the case, e.g.:
emacs -Q -batch -eval '(let ((print-gensym t)) (print (quote (let ((#1=#:a 1)) #1#))))'
prints
(let ((#:a 1)) #:a)
In GNU Emacs 26.0.50 (build 73, x86_64-apple-darwin16.6.0, NS appkit-1504.83 Version 10.12.5 (Build 16F73))
of 2017-07-20 built on p
Repository revision: 644cdd1aa0a10dbfffa3b9b4c7a97f8cddded0b8
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Configured using:
'configure --with-modules --without-xml2 --without-pop --with-mailutils
--enable-gcc-warnings=yes MAKEINFO=/usr/local/opt/texinfo/bin/makeinfo
'CFLAGS=-O3 -g0' LDFLAGS=-O3'
Configured features:
DBUS NOTIFY ACL GNUTLS ZLIB TOOLKIT_SCROLL_BARS NS MODULES
Important settings:
value of $LANG: de_DE.UTF-8
locale-coding-system: utf-8-unix
Major mode: Lisp Interaction
Minor modes in effect:
tooltip-mode: t
global-eldoc-mode: t
eldoc-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Load-path shadows:
None found.
Features:
(shadow sort mail-extr emacsbug message subr-x puny seq byte-opt gv
bytecomp byte-compile cconv cl-loaddefs cl-lib dired dired-loaddefs
format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg
epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils term/xterm xterm
time-date tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/ns-win ns-win ucs-normalize mule-util
term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow isearch timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite charscript charprop case-table epa-hook jka-cmpr-hook
help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote dbusbind kqueue cocoa ns multi-tty make-network-process emacs)
Memory information:
((conses 16 208472 8349)
(symbols 48 20232 1)
(miscs 40 33 159)
(strings 32 29516 1081)
(string-bytes 1 777795)
(vectors 16 32977)
(vector-slots 8 669903 8589)
(floats 8 52 295)
(intervals 56 189 0)
(buffers 992 11))
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#27776
; Package
emacs
.
(Thu, 20 Jul 2017 21:47:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 27776 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Philipp <p.stephani2 <at> gmail.com> schrieb am Do., 20. Juli 2017 um 23:32 Uhr:
>
> The docstring of `print-gensym' says:
>
> When the uninterned symbol appears within a recursive data structure,
> and the symbol appears more than once, in addition use the #N# and #N=
> constructs as needed, so that multiple references to the same symbol are
> shared once again when the text is read back.
>
OK, so you could read this as "the numbering is only used for recursive
data structures". But I don't understand why; it seems equally appropriate
for non-recursive data structures.
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#27776
; Package
emacs
.
(Fri, 21 Jul 2017 01:19:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 27776 <at> debbugs.gnu.org (full text, mbox):
Philipp Stephani <p.stephani2 <at> gmail.com> writes:
> The docstring of `print-gensym' says:
>
> When the uninterned symbol appears within a recursive data structure,
> and the symbol appears more than once, in addition use the #N# and #N=
> constructs as needed, so that multiple references to the same symbol are
> shared once again when the text is read back.
>
> OK, so you could read this as "the numbering is only used for
> recursive data structures". But I don't understand why; it seems
> equally appropriate for non-recursive data structures.
AFAICT...I think the docstring of `print-gensym' just fails to say that
you get that behavior only with print-circle bound non-nil.
The second problem is that docs speak about recursive data structures
when they mean data structures with shared parts. `print-circle' is not
(only) about recursive (cyclic) structures.
In your example, it doesn't make a difference whether the list is
actually really recursive or not, as long as the same uninterned symbol
appears more than once in it.
Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#27776
; Package
emacs
.
(Fri, 21 Jul 2017 02:20:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 27776 <at> debbugs.gnu.org (full text, mbox):
Michael Heerdegen <michael_heerdegen <at> web.de> writes:
> Philipp Stephani <p.stephani2 <at> gmail.com> writes:
>
>> The docstring of `print-gensym' says:
>>
>> When the uninterned symbol appears within a recursive data structure,
>> and the symbol appears more than once, in addition use the #N# and #N=
>> constructs as needed, so that multiple references to the same symbol are
>> shared once again when the text is read back.
>>
>> OK, so you could read this as "the numbering is only used for
>> recursive data structures". But I don't understand why; it seems
>> equally appropriate for non-recursive data structures.
>
> AFAICT...I think the docstring of `print-gensym' just fails to say that
> you get that behavior only with print-circle bound non-nil.
I agree. Compare this note in cltl[1]
Implementation note: Because the #: syntax does not intern the
following symbol, it is necessary to use circular-list syntax if
*print-circle* is not nil and the same uninterned symbol appears
several times in an expression to be printed. For example, the
result of
(let ((x (make-symbol "FOO"))) (list x x))
would be printed as
(#:foo #:foo)
if *print-circle* were nil, but as
(#1=#:foo #1#)
if *print-circle* were not nil.
[1]: https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node193.html
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#27776
; Package
emacs
.
(Wed, 31 Jan 2018 03:40:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 27776 <at> debbugs.gnu.org (full text, mbox):
tags 27776 fixed
close 27776 26.1
quit
npostavs <at> users.sourceforge.net writes:
> Michael Heerdegen <michael_heerdegen <at> web.de> writes:
>> AFAICT...I think the docstring of `print-gensym' just fails to say that
>> you get that behavior only with print-circle bound non-nil.
>
> I agree.
Fixed in emacs-26.
[1: 16022626ba]: 2018-01-30 22:14:02 -0500
Clarify effect of print-gensym (Bug#27776)
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=16022626ba86eb96e12b7d919edfb50912cb26bd
Added tag(s) fixed.
Request was from
Noam Postavsky <npostavs <at> users.sourceforge.net>
to
control <at> debbugs.gnu.org
.
(Wed, 31 Jan 2018 03:40:02 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 26.1, send any further explanations to
27776 <at> debbugs.gnu.org and Philipp <p.stephani2 <at> gmail.com>
Request was from
Noam Postavsky <npostavs <at> users.sourceforge.net>
to
control <at> debbugs.gnu.org
.
(Wed, 31 Jan 2018 03:40: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
.
(Wed, 28 Feb 2018 12:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 7 years and 171 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.