emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug#5082: 23.1.50; print-circle and make-hash-table


From: Ted Zlatanov
Subject: Re: bug#5082: 23.1.50; print-circle and make-hash-table
Date: Wed, 2 Dec 2009 16:19:09 -0600
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1.50 (gnu/linux)

The following message is a courtesy copy of an article
that has been posted to gnu.emacs.bug as well.

On Tue, 1 Dec 2009 00:09:30 +0900 川幡太一 <address@hidden> wrote: 

> Dear Emacs Developers,
> I've found an Emacs behavior that seems a bug concerning to `print-circle'
> and make-hash-table, so I would like to report it.

> By setting `print-circle' to `t', printing Lisp Object with recursive
> or repetitive
> list should be displayed as #N= and #N# syntax.

> However, it seems this is not true when printing lisp objects within
> hash tables
> (which become possible in Emacs 23.1.50.)  Following is an example.

> Is it possible to display the repetitive lisp object within printed hash 
> tables
> by #N= and #N# syntax, when `print-circle' is set to `t'?

> I notify this behavior as a bug, but it may not be so.  I apologize in that
> case.

> (let ((print-circle t)
>       (x (list 10 20))
>       (y (make-hash-table)))
>   (insert (format "%S\n" (list x x)))
>   (puthash 1 x y)
>   (puthash 2 x y)
>   (insert (format "%S\n" y))
>   (setcar x 3)
>   (insert (format "%S\n" y)))

> Result:
 (#1=(10 20) #1#)
 #s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8
 data (1 (10 20) 2 (10 20)))
 #s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8
 data (1 (3 20) 2 (3 20)))
> nil

I looked at the source in src/print.c.  At the print_object() level the
behavior is correct for lists but fiendishly complicated so I couldn't
figure out the parallel structure for hashtables quickly.  I'll put it
on my TODO list if no one else is interested.

Ted




reply via email to

[Prev in Thread] Current Thread [Next in Thread]