From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: print-circle and describe-variable Date: Tue, 10 Apr 2007 12:13:16 -0400 Message-ID: <87fy78yzqb.fsf@stupidchicken.com> References: <461BAE37.9010208@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1176249446 30555 80.91.229.12 (10 Apr 2007 23:57:26 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 10 Apr 2007 23:57:26 +0000 (UTC) Cc: Drew Adams , emacs-devel@gnu.org To: "Lennart Borgman \(gmail\)" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Apr 11 01:56:46 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HbIw7-0004K5-Hp for ged-emacs-devel@m.gmane.org; Tue, 10 Apr 2007 18:11:15 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HbJ04-0001Ji-6p for ged-emacs-devel@m.gmane.org; Tue, 10 Apr 2007 12:15:20 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HbJ00-0001J8-Ue for emacs-devel@gnu.org; Tue, 10 Apr 2007 12:15:16 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HbJ00-0001Iw-D4 for emacs-devel@gnu.org; Tue, 10 Apr 2007 12:15:16 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HbJ00-0001IY-8a for emacs-devel@gnu.org; Tue, 10 Apr 2007 12:15:16 -0400 Original-Received: from cyd.mit.edu ([18.19.1.138]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1HbIw2-0000Oz-RJ for emacs-devel@gnu.org; Tue, 10 Apr 2007 12:11:10 -0400 Original-Received: by cyd.mit.edu (Postfix, from userid 1000) id 528FB4E480; Tue, 10 Apr 2007 12:13:16 -0400 (EDT) In-Reply-To: <461BAE37.9010208@gmail.com> (Lennart Borgman's message of "Tue\, 10 Apr 2007 17\:33\:11 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.97 (gnu/linux) X-detected-kernel: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:69267 Archived-At: "Lennart Borgman (gmail)" writes: >>>> I think you are seeing: 1) the side-effect result of `prin1' printing, >>>> followed by 2) the returned value, printed normally. (#1=(2) #1#) is the >>>> former; ((2) (2)) is the latter. >>> But it is the output of (prin1 (list toto toto)), isn't it? >> >> I'm not sure what you mean (by "it" and by "the output", for instance). >> >> During the invocation of `prin1', the `print-circle' binding is in effect, >> so (#1=(2) #1#) is what is printed (by the side effect of `prin1'). >> >> The binding is finished after the expression evaluation, and that is when >> the command loop prints the value that is returned by the expression. >> Printing of this value is thus done using the default value of >> `print-circle', nil, so you see ((2) (2)). > > Yes, but the let binding is in effect when printing the second toto > too, or? The argument to print1 is (list toto toto). No, the second list is the result of the `eval-expression', and print-circle is not in effect there. Here is another example: M-: (setq toto-list (let ((toto (list 2))) (list toto toto))) RET M-: (insert (format "%s" (let ((print-circle t)) (prin1 toto-list)))) RET => ((2) (2)) M-: (let ((print-circle t)) (insert (format "%s" (prin1 toto-list)))) RET => (#1=(2) #1#)